Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mini-surround): use keys to lazy load instead #449

Merged
merged 2 commits into from
Jul 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lua/astrocommunity/motion/mini-surround/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ return {
{ "machakann/vim-sandwich", enabled = false },
{
"echasnovski/mini.surround",
event = "User AstroFile",
keys = function(plugin, keys)
-- 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`" },
}
mappings = vim.tbl_filter(function(m) return m[1] and #m[1] > 0 end, mappings)
return vim.list_extend(mappings, keys)
end,
opts = {
mappings = {
add = prefix .. "a", -- Add surrounding in Normal and Visual modes
Expand Down