nixos-config/configs/nixvim/fiesta/modules/setups/lsp.nix

55 lines
1.3 KiB
Nix
Raw Normal View History

{ config, lib, helpers, ... }:
2024-02-03 13:26:52 +00:00
let
nixvimConfig = config.nixvimConfigs.fiesta;
cfg = nixvimConfig.setups.lsp;
in
{
options.nixvimConfigs.fiesta.setups.lsp.enable =
lib.mkEnableOption null // {
description = ''
Whether to enable LSP setup. Take note you'll have to enable and
configure individual language servers yourself since the resulting
NixVim config can be pretty heavy.
'';
};
config = lib.mkIf cfg.enable {
keymaps = [
{
mode = [ "n" ];
key = "<leader>Li";
options.desc = "Toggle inlay hints";
action = helpers.mkRaw ''
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
'';
}
];
plugins.lsp = {
enable = true;
inlayHints = true;
};
2024-02-03 13:26:52 +00:00
# Keymaps for moving around in the buffer.
plugins.lsp.keymaps.lspBuf = {
2024-02-03 13:26:52 +00:00
K = "hover";
gD = "references";
gd = "definition";
gi = "implementation";
gt = "type_definition";
};
# Keymaps for moving around with the doctor.
plugins.lsp.keymaps.diagnostic = {
2024-02-03 13:26:52 +00:00
"<leader>j" = "goto_next";
"<leader>k" = "goto_prev";
};
# Make those diagnostics fit the screen, GODDAMNIT!
plugins.lsp-lines.enable = true;
};
}