Skip to content

Commit

Permalink
feat(project): add grug-far-nvim (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuuurino authored Jul 2, 2024
1 parent 6a1b312 commit 22e2c58
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/astrocommunity/project/grug-far-nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# grug-far.nvim

Find And Replace plugin for neovim

**Repository:** <https://github.com/MagicDuck/grug-far.nvim>
43 changes: 43 additions & 0 deletions lua/astrocommunity/project/grug-far-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---@type LazySpec
return {
"MagicDuck/grug-far.nvim",
cmd = "GrugFar",
dependencies = {
{
"AstroNvim/astroui",
---@type AstroUIOpts
opts = {
icons = {
GrugFar = "󰛔",
},
},
},
{
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
opts = function(_, opts)
local maps = opts.mappings and opts.mappings or require("astrocore").empty_map_table()
local prefix = "<Leader>r"

maps.n[prefix] = {
function() require("grug-far").grug_far {} end,
desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search and Replace",
}

maps.x[prefix] = {
function() require("grug-far").with_visual_selection {} end,
desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search and Replace (current word)",
}
end,
},
},
---@param opts GrugFarOptionsOverride
-- NOTE: Wrapping opts into a function, because `astrocore` can set vim options
opts = function(_, opts)
return require("astrocore").extend_tbl(opts, {
icons = {
enabled = vim.g.icons_enabled,
},
} --[[@as GrugFarOptionsOverride]])
end,
}

0 comments on commit 22e2c58

Please sign in to comment.