Match LSP maps to neovim 0.10 defs

Tue, 30 Apr 2024 21:53:24 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 30 Apr 2024 21:53:24 -0500
changeset 1152
59d9ca2ec2fd
parent 1151
ecfcc61310d4
child 1153
57809d2642ff

Match LSP maps to neovim 0.10 defs

.config/nvim/lua/config/maps.lua file | annotate | diff | comparison | revisions
.config/nvim/lua/plugins/lsp.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/config/maps.lua
+++ b/.config/nvim/lua/config/maps.lua
@@ -88,18 +88,22 @@ vim.api.nvim_create_autocmd("LspAttach",
     map("n", "gd", vim.lsp.buf.definition, bufopts)
     map("n", "K", vim.lsp.buf.hover, bufopts)
     map("n", "gi", vim.lsp.buf.implementation, bufopts)
-    map("n", "<F12>", vim.lsp.buf.signature_help, bufopts)
+    map("n", "<C-S>", vim.lsp.buf.signature_help, bufopts)
     map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
     map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
     map("n", "<leader>wl", function()
       print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
     end, bufopts)
     map("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
-    map("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
-    -- map("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
+    map("n", "crn", vim.lsp.buf.rename, bufopts)
     map("n", "gr", vim.lsp.buf.references, bufopts)
     map({ "n", "x" }, "<leader>f", function()
       vim.lsp.buf.format({ async = true })
     end, bufopts)
+
+    local code_actions = require("actions-preview").code_actions
+    map("n", "crr", code_actions, bufopts)
+    map("x", "<C-R><C-R>", code_actions, bufopts)
+    map("x", "<C-R>", code_actions, bufopts)
   end,
 })
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -41,16 +41,12 @@ return {
 
   {
     "aznhe21/actions-preview.nvim",
-    keys = "<leader>ca",
+    event = "LspAttach",
     opts = {
       nui = {
         keymap = { close = { "<ESC>", "<C-c>", "q" } },
       },
     },
-    config = function(_, opts)
-      require("actions-preview").setup(opts)
-      vim.keymap.set("n", "<leader>ca", require("actions-preview").code_actions, { silent = true })
-    end,
   },
 
   {

mercurial