dotfiles/hm/vim/lsp.nix

80 lines
2 KiB
Nix
Raw Normal View History

2024-12-15 00:29:51 +01:00
{
pkgs,
lib,
config,
...
}:
2024-01-12 18:08:11 +01:00
{
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";
2024-06-01 21:32:11 +02:00
action.__raw = ''
2024-01-20 19:24:04 +01:00
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end
'';
options.silent = true;
}
{
mode = "n";
key = "<space>f";
2024-06-01 21:32:11 +02:00
action.__raw = ''
2024-01-20 19:24:04 +01:00
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;
2024-06-01 18:22:50 +02:00
settings.autocmd.enabled = true;
2024-01-12 18:08:11 +01:00
};
};
};
};
}