neovim-flake/modules/lsp/module.nix
Kalle Jepsen c693d2fbd4 lsp: make key bindings configurable
This exposes the keybindings for the lsp commands to the configuration
and maps a few more commands (e.g. `vim.lsp.buf.format()`) It also adds
a description to be picked up by whichkey to make the whichkey UX a bit
nicer (ie. we're now showing "Go to definition" instead of just
"vim.lsp.buf.definition()")
2023-10-22 22:42:55 +02:00

68 lines
1.9 KiB
Nix

{lib, ...}:
with lib;
with builtins; let
in {
options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
formatOnSave = mkEnableOption "format on save";
mappings = {
goToDefinition =
mkMappingOption "Go to definition"
"<leader>lgd";
goToDeclaration =
mkMappingOption "Go to declaration"
"<leader>lgD";
goToType =
mkMappingOption "Go to type"
"<leader>lgt";
listImplementations =
mkMappingOption "List implementations"
"<leader>lgi";
listReferences =
mkMappingOption "List references"
"<leader>lgr";
nextDiagnostic =
mkMappingOption "Go to next diagnostic"
"<leader>lgn";
previousDiagnostic =
mkMappingOption "Go to previous diagnostic"
"<leader>lgp";
openDiagnosticFloat =
mkMappingOption "Open diagnostic float"
"<leader>le";
documentHighlight =
mkMappingOption "Document highlight"
"<leader>lH";
listDocumentSymbols =
mkMappingOption "List document symbols"
"<leader>lS";
addWorkspaceFolder =
mkMappingOption "Add workspace folder"
"<leader>lwa";
removeWorkspaceFolder =
mkMappingOption "Remove workspace folder"
"<leader>lwr";
listWorkspaceFolders =
mkMappingOption "List workspace folders"
"<leader>lwl";
listWorkspaceSymbols =
mkMappingOption "List workspace symbols"
"<leader>lws";
hover =
mkMappingOption "Trigger hover"
"<leader>lh";
signatureHelp =
mkMappingOption "Signature help"
"<leader>ls";
renameSymbol =
mkMappingOption "Rename symbol"
"<leader>ln";
codeAction =
mkMappingOption "Code action"
"<leader>la";
format =
mkMappingOption "Format"
"<leader>lf";
};
};
}