From a57c6527cecd33b16d5eb4c89d116e7082266238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 20 Jan 2024 19:24:04 +0100 Subject: [PATCH] vim: Fix lsp todos --- hm/vim/default.nix | 4 ---- hm/vim/lsp.nix | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/hm/vim/default.nix b/hm/vim/default.nix index a963a13..1107ea6 100644 --- a/hm/vim/default.nix +++ b/hm/vim/default.nix @@ -50,10 +50,6 @@ gH = "command_history"; gS = "search_history"; gC = "commands"; - gr = "lsp_references"; - ge = "diagnostics"; - gd = "lsp_definitions"; - gs = "lsp_document_symbols"; }; defaults = { vimgrep_arguments = [ diff --git a/hm/vim/lsp.nix b/hm/vim/lsp.nix index 03df26e..54b8271 100644 --- a/hm/vim/lsp.nix +++ b/hm/vim/lsp.nix @@ -12,6 +12,28 @@ lsp_signature-nvim # Show argument definition when typing a function ]; keymaps = [ + { + mode = "n"; + key = "wl"; + lua = true; + action = '' + function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end + ''; + options.silent = true; + } + { + mode = "n"; + key = "f"; + lua = true; + action = '' + function() + vim.lsp.buf.format { async = true } + end + ''; + options.silent = true; + } ]; plugins = { # Language Server @@ -25,25 +47,24 @@ "]e" = "goto_next"; }; lspBuf = { - # TODO Include the Telescope ones in this file "gD" = "declaration"; "K" = "hover"; "gi" = "implementation"; "" = "signature_help"; "wa" = "add_workspace_folder"; "wr" = "remove_workspace_folder"; - # "wl" = "list_workspace_folder"; - # TODO Full thing was function() print(vim.inspect(vim.lsp.buf.list_workspace_folder())) end but not sure I'm ever really using this - # Also makes nvim crash like this, so uncommented "D" = "type_definition"; "rn" = "rename"; - "ca" = "code_action"; - "f" = "format"; - # TODO Full thing was function() vim.lsp.buf.format { async = true } end, so async while this isn't - # Maybe replace this with lsp-format? + "ca" = "code_action"; # Reference has a binding for visual mode, but it doesn't work }; }; }; + telescope.keymaps = { + gr = "lsp_references"; + ge = "diagnostics"; + gd = "lsp_definitions"; + gs = "lsp_document_symbols"; + }; nvim-lightbulb = { # Shows a lightbulb whenever a codeAction is available under the cursor enable = true;