dotfiles/hm/vim/lsp.nix

77 lines
2 KiB
Nix
Raw Normal View History

2024-01-12 18:08:11 +01:00
{ pkgs, lib, config, ... }:
{
config = {
programs.nixvim = {
extraConfigLua = ''
require'lsp_signature'.on_attach({
hint_enable = false,
})
'';
extraPlugins = with pkgs.vimPlugins; [
# Language server
lsp_signature-nvim # Show argument definition when typing a function
];
keymaps = [
2024-01-20 19:24:04 +01:00
{
mode = "n";
key = "<space>wl";
lua = true;
action = ''
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
'';
options.silent = true;
}
{
mode = "n";
key = "<space>f";
lua = true;
action = ''
function()
vim.lsp.buf.format { async = true }
end
'';
options.silent = true;
}
2024-01-12 18:08:11 +01:00
];
plugins = {
# Language Server
lsp = {
enable = true;
keymaps = {
silent = true;
diagnostic = {
"<Space>e" = "open_float";
"[e" = "goto_prev";
"]e" = "goto_next";
};
lspBuf = {
"gD" = "declaration";
"K" = "hover";
"gi" = "implementation";
"<C-S-k>" = "signature_help";
"<space>wa" = "add_workspace_folder";
"<space>wr" = "remove_workspace_folder";
"<space>D" = "type_definition";
"<space>rn" = "rename";
2024-01-20 19:24:04 +01:00
"<space>ca" = "code_action"; # Reference has a binding for visual mode, but it doesn't work
2024-01-12 18:08:11 +01:00
};
};
};
2024-01-20 19:24:04 +01:00
telescope.keymaps = {
gr = "lsp_references";
ge = "diagnostics";
gd = "lsp_definitions";
gs = "lsp_document_symbols";
};
2024-01-12 18:08:11 +01:00
nvim-lightbulb = {
# Shows a lightbulb whenever a codeAction is available under the cursor
enable = true;
autocmd.enabled = true;
};
};
};
};
}