From 5f9d587780775cd2c1c528c61a9b6cf10b93fe1e Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 1 Dec 2024 11:29:43 -0800 Subject: [PATCH] feat: grug-far.nvim --- nix/neovim-overlay.nix | 1 + nvim/lua/plugins/editor/grug-far-nvim.lua | 25 +++++++++++++++++++++++ nvim/lua/plugins/editor/init.lua | 1 + 3 files changed, 27 insertions(+) create mode 100644 nvim/lua/plugins/editor/grug-far-nvim.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 14fa59c..bda2c1a 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -51,6 +51,7 @@ with final.pkgs.lib; let # Editor neo-tree-nvim + grug-far-nvim ]; extraPackages = with pkgs; [ diff --git a/nvim/lua/plugins/editor/grug-far-nvim.lua b/nvim/lua/plugins/editor/grug-far-nvim.lua new file mode 100644 index 0000000..4d4da38 --- /dev/null +++ b/nvim/lua/plugins/editor/grug-far-nvim.lua @@ -0,0 +1,25 @@ +return { + 'grug-far.nvim', + cmd = 'GrugFar', + keys = { + { + 'sr', + 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', + }, + }, + after = function() + require('grug-far').setup({ headerMaxWidth = 80 }) + end, +} diff --git a/nvim/lua/plugins/editor/init.lua b/nvim/lua/plugins/editor/init.lua index 1b9058f..ba2bb31 100644 --- a/nvim/lua/plugins/editor/init.lua +++ b/nvim/lua/plugins/editor/init.lua @@ -1,5 +1,6 @@ local req = MarleyVim.local_require('plugins.editor') return { + req('grug-far-nvim'), req('neo-tree-nvim'), }