From 2d9be4518c8a11930cbfb3697e61730dd3ceab42 Mon Sep 17 00:00:00 2001 From: CharlesChiuGit Date: Mon, 3 Feb 2025 14:35:53 +0800 Subject: [PATCH 1/3] feat(grug-far): replace `nvim-spectre` with `grug-far.nvim` --- lua/modules/configs/editor/grug-far.lua | 20 ++++++++++++++++++++ lua/modules/configs/ui/catppuccin.lua | 1 + lua/modules/plugins/editor.lua | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 lua/modules/configs/editor/grug-far.lua diff --git a/lua/modules/configs/editor/grug-far.lua b/lua/modules/configs/editor/grug-far.lua new file mode 100644 index 000000000..4af4ea122 --- /dev/null +++ b/lua/modules/configs/editor/grug-far.lua @@ -0,0 +1,20 @@ +return function() + vim.g.maplocalleader = "," + require("modules.utils").load_plugin("grug-far", { + engine = "ripgrep", + engines = { + ripgrep = { + path = "rg", + showReplaceDiff = true, + placeholders = { + enabled = true, + }, + }, + }, + windowCreationCommand = "bot split", + disableBufferLineNumbers = false, + icons = { + enabled = true, + }, + }) +end diff --git a/lua/modules/configs/ui/catppuccin.lua b/lua/modules/configs/ui/catppuccin.lua index f30bcd1d5..480556fdc 100644 --- a/lua/modules/configs/ui/catppuccin.lua +++ b/lua/modules/configs/ui/catppuccin.lua @@ -61,6 +61,7 @@ return function() flash = true, gitgutter = false, gitsigns = true, + grug_far = true, harpoon = false, headlines = false, hop = true, diff --git a/lua/modules/plugins/editor.lua b/lua/modules/plugins/editor.lua index 204ff047d..67f99bcd1 100644 --- a/lua/modules/plugins/editor.lua +++ b/lua/modules/plugins/editor.lua @@ -84,11 +84,11 @@ editor["tpope/vim-sleuth"] = { lazy = true, event = { "BufNewFile", "BufReadPost", "BufFilePost" }, } -editor["nvim-pack/nvim-spectre"] = { +editor["MagicDuck/grug-far.nvim"] = { lazy = true, - cmd = "Spectre", + cmd = "GrugFar", + config = require("editor.grug-far"), } - ---------------------------------------------------------------------- --  :treesitter related plugins -- ---------------------------------------------------------------------- From 9563010da6202537c001c83edeefc70acc9077e1 Mon Sep 17 00:00:00 2001 From: ayamir Date: Wed, 5 Feb 2025 10:15:29 +0800 Subject: [PATCH 2/3] chore(keymap.editor): replace `nvim-spectre` with `grug-far.nvim`. --- lua/keymap/editor.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/keymap/editor.lua b/lua/keymap/editor.lua index 8c8c8cd30..752615f44 100644 --- a/lua/keymap/editor.lua +++ b/lua/keymap/editor.lua @@ -102,27 +102,27 @@ local mappings = { ["nv|c"] = map_cmd("HopChar1MW"):with_noremap():with_desc("jump: Goto one char"), ["nv|C"] = map_cmd("HopChar2MW"):with_noremap():with_desc("jump: Goto two chars"), - -- Plugin: nvim-spectre + -- Plugin: grug-far ["n|Ss"] = map_callback(function() - require("spectre").toggle() + require("grug-far").open() end) :with_silent() :with_noremap() :with_desc("editn: Toggle search & replace panel"), ["n|Sp"] = map_callback(function() - require("spectre").open_visual({ select_word = true }) + require("grug-far").open({ prefills = { search = vim.fn.expand("") } }) end) :with_silent() :with_noremap() :with_desc("editn: search&replace current word (project)"), ["v|Sp"] = map_callback(function() - require("spectre").open_visual() + require("grug-far").with_visual_selection() end) :with_silent() :with_noremap() :with_desc("edit: search & replace current word (project)"), ["n|Sf"] = map_callback(function() - require("spectre").open_file_search({ select_word = true }) + require("grug-far").open({ prefills = { paths = vim.fn.expand("%") } }) end) :with_silent() :with_noremap() From 876594c6f05eb228a32531c171aa68eafa47c350 Mon Sep 17 00:00:00 2001 From: Charles Chiu Date: Wed, 5 Feb 2025 10:21:39 +0800 Subject: [PATCH 3/3] chore(grug-far): enable integration in catppuccin Signed-off-by: Charles Chiu --- lua/modules/configs/ui/catppuccin.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/modules/configs/ui/catppuccin.lua b/lua/modules/configs/ui/catppuccin.lua index c1eb52620..3f2126253 100644 --- a/lua/modules/configs/ui/catppuccin.lua +++ b/lua/modules/configs/ui/catppuccin.lua @@ -39,6 +39,7 @@ return function() flash = true, fzf = true, gitsigns = true, + grug_far = true, hop = true, illuminate = true, indent_blankline = { enabled = true, colored_indent_levels = true },