From 07cf759d98aa6299ff7b6c307cd2625d03a0b40a Mon Sep 17 00:00:00 2001 From: salomaestro Date: Sat, 22 Feb 2025 01:24:07 +0100 Subject: [PATCH] Add actions-preview to gf to show telescope preview of code action changes --- lua/mappings.lua | 6 +++--- lua/plugins/init.lua | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lua/mappings.lua b/lua/mappings.lua index 53b4b8b..6ea1b00 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -10,9 +10,9 @@ local diag = vim.diagnostic map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") -map("n", "ca", function() - vim.lsp.buf.code_action() -end, { desc = "LSP code action" }) +map("n", "j", "gj", { desc = "Move down" }) +map("n", "k", "gk", { desc = "Move up" }) + map("n", "tt", function() require("base46").toggle_transparency() end, { desc = "Toggle transparency" }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 71cbe0b..43f8788 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -227,7 +227,6 @@ return { lazy = false, }, - -- Install a plugin { "max397574/better-escape.nvim", event = "InsertEnter", @@ -235,4 +234,28 @@ return { require("better_escape").setup() end, }, + + { + "aznhe21/actions-preview.nvim", + keys = { + { + "gf", + function() + require("actions-preview").code_actions() + end, + mode = { "n", "v" }, + desc = "Show code actions", + silent = true, + }, + }, + config = function() + require("actions-preview").setup { + highlight_command = { + require("actions-preview.highlight").delta(), + }, + } + end, + lazy = false, + }, + }