nixvim/config/lsp/lsp.nix

113 lines
2.2 KiB
Nix
Raw Normal View History

{ pkgs, helpers, ... }:
2024-08-20 05:43:03 +00:00
{
plugins.lsp = {
enable = true;
servers = {
cmake = {
enable = true;
};
clangd = {
enable = true;
};
pyright = {
enable = true;
};
nixd = {
enable = true;
};
};
2024-08-21 04:13:09 +00:00
inlayHints = true;
2024-08-20 05:43:03 +00:00
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gA = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
K = {
action = "hover";
desc = "Hover";
};
"<leader>cw" = {
action = "workspace_symbol";
desc = "Workspace Symbol";
};
"<f2>" = {
action = "rename";
desc = "Rename";
};
};
diagnostic = {
"<leader>cd" = {
action = "open_float";
desc = "Line Diagnostics";
};
"[d" = {
action = "goto_next";
desc = "Next Diagnostic";
};
"]d" = {
action = "goto_prev";
desc = "Previous Diagnostic";
};
};
};
onAttach = ''
require("lsp_signature").on_attach({
bind = true,
handler_opts = {
border = "rounded"
};
}, bufnr)
'';
2024-08-20 05:43:03 +00:00
};
keymaps = [
{
mode = [ "n" ];
key = "<leader>th";
action = helpers.mkRaw ''
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end
'';
options = {
desc = "Toggle inlay hints";
};
}
];
extraConfigLua = ''
require("lspconfig").asm_lsp.setup {
filetypes = { "asm", "s", "S" }
}
require("lspconfig").verible.setup { }
'';
extraPlugins = with pkgs.vimPlugins; [
lsp_signature-nvim
];
extraPackages = with pkgs; [
asm-lsp
verible
];
2024-08-20 05:43:03 +00:00
}