diff options
Diffstat (limited to 'ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/grug-far.lua')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/grug-far.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/grug-far.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/grug-far.lua new file mode 100644 index 0000000..6f6ff48 --- /dev/null +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/plugins/grug-far.lua @@ -0,0 +1,31 @@ +return { + "MagicDuck/grug-far.nvim", + --- Ensure existing keymaps and opts remain unaffected + config = function(_, opts) + require("grug-far").setup(opts) + vim.api.nvim_create_autocmd("FileType", { + pattern = "grug-far", + callback = function() + -- Map <Esc> to quit after ensuring we're in normal mode + vim.keymap.set({ "i", "n" }, "<Esc>", "<cmd>stopinsert | bd!<CR>", { buffer = true }) + end, + }) + end, + keys = { + { + "<leader>rp", + function() + local grug = require("grug-far") + local ext = vim.bo.buftype == "" and vim.fn.expand("%:e") + grug.open({ + transient = true, + prefills = { + filesFilter = ext and ext ~= "" and "*." .. ext or nil, + }, + }) + end, + mode = { "n", "v" }, + desc = "Search and Replace", + }, + }, +} |
