Skip to content

Commit

Permalink
fix(mini-surround): properly load opts when building keys lazy lo…
Browse files Browse the repository at this point in the history
…ading
  • Loading branch information
mehalter committed Apr 11, 2024
1 parent bb88a06 commit 4d2ee01
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lua/astrocommunity/motion/mini-surround/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ return {
end,
},
},
keys = function(plugin, keys)
keys = function(_, keys)
local plugin = require("lazy.core.config").spec.plugins["mini.surround"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false) -- resolve mini.clue options
-- Populate the keys based on the user's options
local mappings = {
{ plugin.opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } },
{ plugin.opts.mappings.delete, desc = "Delete surrounding" },
{ plugin.opts.mappings.find, desc = "Find right surrounding" },
{ plugin.opts.mappings.find_left, desc = "Find left surrounding" },
{ plugin.opts.mappings.highlight, desc = "Highlight surrounding" },
{ plugin.opts.mappings.replace, desc = "Replace surrounding" },
{ plugin.opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
{ opts.mappings.add, desc = "Add surrounding", mode = { "n", "v" } },
{ opts.mappings.delete, desc = "Delete surrounding" },
{ opts.mappings.find, desc = "Find right surrounding" },
{ opts.mappings.find_left, desc = "Find left surrounding" },
{ opts.mappings.highlight, desc = "Highlight surrounding" },
{ opts.mappings.replace, desc = "Replace surrounding" },
{ opts.mappings.update_n_lines, desc = "Update `MiniSurround.config.n_lines`" },
}
mappings = vim.tbl_filter(function(m) return m[1] and #m[1] > 0 end, mappings)
return vim.list_extend(mappings, keys)
Expand Down

0 comments on commit 4d2ee01

Please sign in to comment.