From c4ce96941f4fa39463ad022493a5e4af0d8d17c8 Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Sat, 27 Sep 2025 02:33:20 +0200 Subject: [PATCH] fix nixvim lsp keymaps --- home.nix | 128 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 55 deletions(-) diff --git a/home.nix b/home.nix index 4e010f8..8119a33 100644 --- a/home.nix +++ b/home.nix @@ -137,13 +137,32 @@ in } ]; + diagnostic.settings = { + virtual_lines = { + current_line = true; + }; + virtual_text = true; + }; + keymaps = [ - # { # managed by easyescape plugin - # key = "jk"; - # action = ""; - # mode = [ "i" ]; - # options = { noremap = true; }; - # } + { + key = "e"; + action.__raw = "vim.diagnostic.open_float"; + options.silent = true; + options.desc = "Show Diagnostic"; + } + { + key = "j"; + action.__raw = "vim.diagnostic.goto_next"; + options.silent = true; + options.desc = "Next Diagnostic"; + } + { + key = "k"; + action.__raw = "vim.diagnostic.goto_prev"; + options.silent = true; + options.desc = "Previous Diagnostic"; + } { key = "pv"; @@ -381,7 +400,6 @@ in }; lsp = { - inlayHints.enable = true; servers = { "*" = { settings = { @@ -471,54 +489,54 @@ in rust_analyzer.enable = true; superhtml.enable = true; }; - # keymaps = [ - # { - # "*".options.silent = true; - # } - # ]; - # diagnostic = { - # "j" = "goto_next"; - # "k" = "goto_prev"; - # "e" = "open_float"; - # }; - # lspBuf = { - # gd = { - # action = "definition"; - # desc = "Goto Definition"; - # }; - # gr = { - # 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"; - # }; - # "cw" = { - # action = "workspace_symbol"; - # desc = "Workspace Symbol"; - # }; - # "cr" = { - # action = "rename"; - # desc = "Rename"; - # }; - # "ca" = { - # action = "code_action"; - # desc = "code action"; - # }; - # }; + keymaps = [ + # LSP buffer actions + { + key = "gd"; + lspBufAction = "definition"; + options.desc = "Goto Definition"; + } + { + key = "gr"; + lspBufAction = "references"; + options.desc = "Goto References"; + } + { + key = "gD"; + lspBufAction = "declaration"; + options.desc = "Goto Declaration"; + } + { + key = "gI"; + lspBufAction = "implementation"; + options.desc = "Goto Implementation"; + } + { + key = "gT"; + lspBufAction = "type_definition"; + options.desc = "Type Definition"; + } + { + key = "K"; + lspBufAction = "hover"; + options.desc = "Hover Documentation"; + } + { + key = "cw"; + lspBufAction = "workspace_symbol"; + options.desc = "Workspace Symbol"; + } + { + key = "cr"; + lspBufAction = "rename"; + options.desc = "Rename Symbol"; + } + { + key = "ca"; + lspBufAction = "code_action"; + options.desc = "Code Action"; + } + ]; }; plugins = {