Compare commits

..

2 commits

Author SHA1 Message Date
irl
3b810aebc0 feat: adding rust lsp to neovim 2025-06-07 15:44:01 +01:00
irl
c03c840154 fix: use new per-system target for hms alias 2025-06-07 15:43:38 +01:00

View file

@ -19,12 +19,15 @@ in
home.packages = with pkgs; [ home.packages = with pkgs; [
fish fish
neofetch neofetch
rust-analyzer
starship starship
tree tree
]; ];
home.shellAliases = { home.shellAliases = {
hms = hms =
"home-manager switch --flake ~/.config/nix-configs#irl" + (if cfg.gui-packages then "-gui" else ""); "home-manager switch --flake ~/.config/nix-configs#irl"
+ (if cfg.gui-packages then "-gui" else "")
+ "-${pkgs.system}";
}; };
programs.bash = { programs.bash = {
enable = true; enable = true;
@ -91,8 +94,47 @@ in
vimdiffAlias = true; vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
bufferline-nvim bufferline-nvim
nvim-lspconfig
nvim-treesitter.withAllGrammars nvim-treesitter.withAllGrammars
]; ];
extraLuaConfig = ''
vim.lsp.config('rust_analyzer', {
settings = {
['rust-analyzer'] = {},
},
})
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('my.lsp', {}),
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client:supports_method('textDocument/implementation') then
-- Create a keymap for vim.lsp.buf.implementation ...
end
-- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y|
if client:supports_method('textDocument/completion') then
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
-- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
-- client.server_capabilities.completionProvider.triggerCharacters = chars
vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true})
end
-- Auto-format ("lint") on save.
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
if not client:supports_method('textDocument/willSaveWaitUntil')
and client:supports_method('textDocument/formatting') then
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('my.lsp', {clear=false}),
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
end,
})
end
end,
})
'';
}; };
programs.starship = { programs.starship = {
enable = true; enable = true;