Skip to content

Commit

Permalink
feat: add grug-far.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
fcying committed Nov 21, 2024
1 parent 741acd4 commit 94d73f6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/_lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ local plugins = {
-- coding {{{
{ import = "plugins.gen_clang_conf" },
{ import = "plugins.conform" },
{ import = "plugins.grug_far" },
{ import = "plugins.todo-comments" },
{ import = "plugins.lazydev" },
{ import = vim.g.complete_engine == "blink" and "plugins.blink" or "plugins.cmp" },
Expand Down
32 changes: 32 additions & 0 deletions lua/plugins/grug_far.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
return {
"MagicDuck/grug-far.nvim",
keys = {
{
"<leader>fr",
mode = { "n", "x" },
function()
require("grug-far").open({ prefills = { search = vim.fn.expand("<cword>") } })
end,
desc = "far"
},
},
opts = {
engines = {
ripgrep = {
path = "rg",
extraArgs = "--no-config",
showReplaceDiff = true,
placeholders = {
enabled = true,
search = "ex: foo foo([a-z0-9]*) fun\\(",
replacement = "ex: bar ${1}_foo $$MY_ENV_VAR ",
replacement_lua =
'ex: if vim.startsWith(match, "use") \\n then return "employ" .. match \\n else return match end',
filesFilter = "ex: *.lua *.{css,js} **/docs/*.md (specify one per line)",
flags = "ex: --help --ignore-case (-i) --replace= (empty replace) --multiline (-U)",
paths = "ex: /foo/bar ../ ./hello\\ world/ ./src/foo.lua",
},
},
}
},
}

0 comments on commit 94d73f6

Please sign in to comment.