Mini.Surround Neovim plugin
GitHub repo: https://github.com/nvim-mini/mini.surround
My use case is fairly minimal: surround words that have been entered into a markdown buffer with
square brackets ([]).
I’m using the
LazyVim Neovim distribution.
LazyVim configures but does
not enable mini.surround. I’ve enabled mini.surround through :LazyExtras.
LazyVim prepends the default mini.surround keyboard mappings with a "g":
opts = {
mappings = {
add = "gsa", -- Add surrounding in Normal and Visual modes
delete = "gsd", -- Delete surrounding
find = "gsf", -- Find surrounding (to the right)
find_left = "gsF", -- Find surrounding (to the left)
highlight = "gsh", -- Highlight surrounding
replace = "gsr", -- Replace surrounding
update_n_lines = "gsn", -- Update `n_lines`
},
}
Surrounding existing words with square brackets
This is for turning words into markdown links.
Select the word(s) in visual mode, then: gsa]. Note that gsa[ will add padding between the
selected area and what it’s surrounded with, gsa] (using the closing surround character in the
command) will not add padding.