nvim.nix/config/plugins/lsp/lsp.nix

55 lines
1.3 KiB
Nix
Raw Normal View History

2024-08-08 09:58:48 +08:00
{...}: {
2024-08-04 21:19:37 +08:00
plugins.lsp = {
enable = true; # Enable neovim's built-in LSP.
# Configure our language servers
servers = {
# C/C++
clangd = {
enable = true;
};
# Clojure
clojure-lsp = {
enable = true;
};
# Haskell
hls = {
enable = true;
};
# Lua
lua-ls = {
enable = true;
};
# Nix
nil-ls = {
enable = true;
};
# YAML
yamlls = {
enable = true;
};
};
keymaps = {
# nvim-lsp keymaps should be silent
silent = true;
2024-08-08 09:58:48 +08:00
# Configure keymaps for our diagnostics.
2024-08-04 21:19:37 +08:00
diagnostic = {
"<leader>n" = "open_float"; # Show diagnostics in floating window.
2024-08-08 09:58:48 +08:00
"<leader>o" = "goto_prev"; # Jump to previous diagnostic.
"<leader>e" = "goto_next"; # Jump to next diagnostic.
2024-08-04 21:19:37 +08:00
};
# Configure keymaps for our lspbuf.
lspBuf = {
2024-08-08 09:58:48 +08:00
K = "hover"; # Displays hover information¹
gr = "references"; # Lists all the references¹
gd = "definition"; # Jumps to the definition¹
gD = "declaration"; # Jumps to the declaration¹
gi = "implementation"; # Lists all the implementations¹
2024-08-04 21:19:37 +08:00
gt = "type_definition"; # Jumps to the definition of the type¹
# ¹ for the symbol under the cursor
};
};
};
}