From 33713717ea0577efbfbed9a7781aeb4cac9d409c Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 16 Mar 2025 14:28:42 -0500 Subject: [PATCH] help --- config/default.nix | 103 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 5 deletions(-) diff --git a/config/default.nix b/config/default.nix index c93a602..dee0edf 100644 --- a/config/default.nix +++ b/config/default.nix @@ -26,11 +26,6 @@ web-devicons.enable = true; - cmp-nvim-lsp.enable = true; - #cmp-path.enable = true; - #cmp-buffer.enable = true; - #cmp_luasnip.enable = true; - lsp = { enable = true; servers = { @@ -48,6 +43,103 @@ cssls.enable = true; }; + + keymaps = { + # Diagnostic keymaps + diagnostic = { + "q" = { + #mode = "n"; + action = "setloclist"; + desc = "Open diagnostic [Q]uickfix list"; + }; + }; + + extra = [ + # Jump to the definition of the word under your cusor. + # This is where a variable was first declared, or where a function is defined, etc. + # To jump back, press . + { + mode = "n"; + key = "gd"; + action.__raw = "require('telescope.builtin').lsp_definitions"; + options = { + desc = "LSP: [G]oto [D]efinition"; + }; + } + # Find references for the word under your cursor. + { + mode = "n"; + key = "gr"; + action.__raw = "require('telescope.builtin').lsp_references"; + options = { + desc = "LSP: [G]oto [R]eferences"; + }; + } + # Jump to the implementation of the word under your cursor. + # Useful when your language has ways of declaring types without an actual implementation. + { + mode = "n"; + key = "gI"; + action.__raw = "require('telescope.builtin').lsp_implementations"; + options = { + desc = "LSP: [G]oto [I]mplementation"; + }; + } + # Jump to the type of the word under your cursor. + # Useful when you're not sure what type a variable is and you want to see + # the definition of its *type*, not where it was *defined*. + { + mode = "n"; + key = "D"; + action.__raw = "require('telescope.builtin').lsp_type_definitions"; + options = { + desc = "LSP: Type [D]efinition"; + }; + } + # Fuzzy find all the symbols in your current document. + # Symbols are things like variables, functions, types, etc. + { + mode = "n"; + key = "ds"; + action.__raw = "require('telescope.builtin').lsp_document_symbols"; + options = { + desc = "LSP: [D]ocument [S]ymbols"; + }; + } + # Fuzzy find all the symbols in your current workspace. + # Similar to document symbols, except searches over your entire project. + { + mode = "n"; + key = "ws"; + action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols"; + options = { + desc = "LSP: [W]orkspace [S]ymbols"; + }; + } + ]; + + lspBuf = { + # Rename the variable under your cursor. + # Most Language Servers support renaming across files, etc. + "rn" = { + action = "rename"; + desc = "LSP: [R]e[n]ame"; + }; + # Execute a code action, usually your cursor needs to be on top of an error + # or a suggestion from your LSP for this to activate. + "ca" = { + #mode = "n"; + action = "code_action"; + desc = "LSP: [C]ode [A]ction"; + }; + # WARN: This is not Goto Definition, this is Goto Declaration. + # For example, in C this would take you to the header. + "gD" = { + action = "declaration"; + desc = "LSP: [G]oto [D]eclaration"; + }; + }; + }; }; cmp = { @@ -63,6 +155,7 @@ ]; completion = { + autocomplete = true; completeopt = "menu,menuone,noinsert"; };