Skip to content

Commit 959d180

Browse files
pkazmiermehalter
andauthored
fix(mini-surround): use keys to lazy load instead (#449)
* fix(mini-surround): use keys to lazy load instead * Update lua/astrocommunity/motion/mini-surround/init.lua --------- Co-authored-by: Micah Halter <micah@mehalter.com>
1 parent e9244d8 commit 959d180

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • lua/astrocommunity/motion/mini-surround

lua/astrocommunity/motion/mini-surround/init.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ return {
77
{ "machakann/vim-sandwich", enabled = false },
88
{
99
"echasnovski/mini.surround",
10-
event = "User AstroFile",
10+
keys = function(plugin, keys)
11+
-- Populate the keys based on the user's options
12+
local mappings = {
13+
{ plugin.opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } },
14+
{ plugin.opts.mappings.delete, desc = "Delete surrounding" },
15+
{ plugin.opts.mappings.find, desc = "Find right surrounding" },
16+
{ plugin.opts.mappings.find_left, desc = "Find left surrounding" },
17+
{ plugin.opts.mappings.highlight, desc = "Highlight surrounding" },
18+
{ plugin.opts.mappings.replace, desc = "Replace surrounding" },
19+
{ plugin.opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
20+
}
21+
mappings = vim.tbl_filter(function(m) return m[1] and #m[1] > 0 end, mappings)
22+
return vim.list_extend(mappings, keys)
23+
end,
1124
opts = {
1225
mappings = {
1326
add = prefix .. "a", -- Add surrounding in Normal and Visual modes

0 commit comments

Comments
 (0)