add actions-preview.nvim

Wed, 30 Aug 2023 23:35:00 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 30 Aug 2023 23:35:00 -0500
changeset 1128
30d81fbc6a7b
parent 1127
a120f1d3d932
child 1129
1bd6edeaf6ae

add actions-preview.nvim

.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
@@ -96,7 +96,7 @@ vim.api.nvim_create_autocmd("LspAttach",
     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", "<leader>ca", vim.lsp.buf.code_action, bufopts)
     map("n", "gr", vim.lsp.buf.references, bufopts)
     map({ "n", "x" }, "<leader>f", function()
       vim.lsp.buf.format({ async = true })
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -32,4 +32,18 @@ return {
       })
     end,
   },
+
+  {
+    "aznhe21/actions-preview.nvim",
+    keys = "<leader>ca",
+    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