diff --git a/config/plugins/editor/buffers.nix b/config/plugins/editor/buffers.nix index 6a629d4..ccff402 100644 --- a/config/plugins/editor/buffers.nix +++ b/config/plugins/editor/buffers.nix @@ -17,7 +17,7 @@ { # goto next buffer mode = ["n"]; - key = "bn"; + key = "]b"; action = ":bnext"; options = { silent = true; @@ -27,7 +27,7 @@ { # goto previous buffer mode = ["n"]; - key = "bp"; + key = "[b"; action = ":bprevious"; options = { silent = true; diff --git a/config/plugins/editor/treesitter.nix b/config/plugins/editor/treesitter.nix index 6cdeea8..67a5e4e 100644 --- a/config/plugins/editor/treesitter.nix +++ b/config/plugins/editor/treesitter.nix @@ -19,25 +19,23 @@ grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars; }; + # Refactor modules for nvim-treesitter plugins.treesitter-refactor = { enable = true; + # Highlights definitions and usages. highlightDefinitions = { enable = true; }; + # Provides "go to usage" navigation = { enable = true; - keymaps = { - gotoNextUsage = "n"; - gotoPreviousUsage = "N"; - }; - }; - smartRename = { - enable = true; + # Go to the next / previous usage. keymaps = { - smartRename = "r"; + gotoNextUsage = "]u"; + gotoPreviousUsage = "[u"; }; }; }; diff --git a/config/plugins/git/lazygit.nix b/config/plugins/git/lazygit.nix index c0c982b..6f92f92 100644 --- a/config/plugins/git/lazygit.nix +++ b/config/plugins/git/lazygit.nix @@ -6,7 +6,7 @@ keymaps = [ { mode = "n"; - key = "g"; + key = "gL"; action = "LazyGit"; options = { desc = "Open LazyGit"; @@ -16,7 +16,9 @@ { mode = "n"; key = "glr"; - action = "lua require(\"telescope\").extensions.lazygit.lazygit()"; + action = { + __raw = "require('telescope').extensions.lazygit.lazygit"; + }; options = { desc = "List repositories"; }; diff --git a/config/plugins/lsp/conform.nix b/config/plugins/lsp/conform.nix index 520bdfd..aa542cf 100644 --- a/config/plugins/lsp/conform.nix +++ b/config/plugins/lsp/conform.nix @@ -55,7 +55,7 @@ # Keymaps for conform.nvim keymaps = [ { - mode = ""; + mode = ["n"]; key = "F"; action.__raw = '' function() diff --git a/config/plugins/lsp/lsp.nix b/config/plugins/lsp/lsp.nix index befd4fe..4fdcbe6 100644 --- a/config/plugins/lsp/lsp.nix +++ b/config/plugins/lsp/lsp.nix @@ -1,6 +1,7 @@ {...}: { plugins.lsp = { enable = true; # Enable neovim's built-in LSP. + inlayHints = true; # Configure our language servers servers = { @@ -53,7 +54,66 @@ gi = "implementation"; # Lists all the implementations¹ gt = "type_definition"; # Jumps to the definition of the type¹ # ¹ for the symbol under the cursor + + # Renames all references to the symbol under the cursor. + "r" = { + action = "rename"; + desc = "Rename"; + }; }; + + # Extra keymaps to register when an LSP is attached + extra = [ + { + mode = ["n"]; + key = "l"; + action = ""; + options = { + silent = true; + desc = "+lsp"; + }; + } + + { + mode = ["n"]; + key = "lc"; + action = "LspStop"; + options = { + silent = true; + desc = "Stop server"; + }; + } + + { + mode = ["n"]; + key = "ls"; + action = "LspStart"; + options = { + silent = true; + desc = "Start server"; + }; + } + + { + mode = ["n"]; + key = "lr"; + action = "LspRestart"; + options = { + desc = "Restart server"; + }; + } + + { + mode = ["n"]; + key = "fd"; + action = { + __raw = "require('telescope.builtin').lsp_definitions"; + }; + options = { + desc = "Find definitions"; + }; + } + ]; }; }; } diff --git a/config/plugins/ui/nvim-tree.nix b/config/plugins/ui/nvim-tree.nix index e283662..49535b5 100644 --- a/config/plugins/ui/nvim-tree.nix +++ b/config/plugins/ui/nvim-tree.nix @@ -26,6 +26,15 @@ }; keymaps = [ + { + mode = ["n"]; + key = "n"; + action = "NvimTreeToggle"; + options = { + desc = "Toggle NvimTree"; + }; + } + { mode = ["n"]; key = "e"; diff --git a/config/plugins/ui/whichkey.nix b/config/plugins/ui/whichkey.nix index 480ffb7..a34510b 100644 --- a/config/plugins/ui/whichkey.nix +++ b/config/plugins/ui/whichkey.nix @@ -9,16 +9,7 @@ # Prefixes, No operation. keymaps = [ { - mode = "n"; - key = "s"; - action = ""; - options = { - desc = "+search"; - }; - } - - { - mode = "n"; + mode = ["n" "v"]; key = "g"; action = ""; options = { @@ -27,7 +18,7 @@ } { - mode = "n"; + mode = ["n"]; key = "gl"; action = ""; options = { @@ -36,7 +27,7 @@ } { - mode = "n"; + mode = ["n"]; key = "gt"; action = ""; options = {