Skip to content

Commit

Permalink
fix(grug-far): fix bugs and also use new transient mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jul 24, 2024
1 parent 8e1a2a4 commit 08fff8c
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions lua/astrocommunity/search/grug-far-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@ return {
{
"AstroNvim/astroui",
---@type AstroUIOpts
opts = {
icons = {
GrugFar = "󰛔",
},
},
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"
if not opts.mappings then opts.mappings = require("astrocore").empty_map_table() end
local maps, prefix = opts.mappings, "<Leader>r"

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

maps.x[prefix] = {
function() require("grug-far").with_visual_selection {} end,
function() require("grug-far").grug_far { transient = true, startCursorRow = 4 } end,
desc = require("astroui").get_icon("GrugFar", 1, true) .. "Search and Replace (current word)",
}
end,
Expand All @@ -40,14 +36,16 @@ return {
},
},
},
{
"catppuccin",
optional = true,
---@type CatppuccinOptions
opts = { integrations = { grug_far = true } },
},
},
---@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]])
if not opts.icons then opts.icons = {} end
opts.icons.enabled = vim.g.icons_enabled
end,
}

0 comments on commit 08fff8c

Please sign in to comment.