diff --git a/lua/astrocommunity/project/grug-far-nvim/README.md b/lua/astrocommunity/project/grug-far-nvim/README.md new file mode 100644 index 000000000..b90494063 --- /dev/null +++ b/lua/astrocommunity/project/grug-far-nvim/README.md @@ -0,0 +1,5 @@ +# grug-far.nvim + +Find And Replace plugin for neovim + +**Repository:** diff --git a/lua/astrocommunity/project/grug-far-nvim/init.lua b/lua/astrocommunity/project/grug-far-nvim/init.lua new file mode 100644 index 000000000..d20af43ec --- /dev/null +++ b/lua/astrocommunity/project/grug-far-nvim/init.lua @@ -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 = "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, +}