mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
## Description Most of the "visual mode" mappings use "v" instead of "x", and therefore also affect select mode. If the key is a printable character, it is now unusable in select mode. This is most prominent with `<leader>`, which is space by default, a printable character. The most common use of select mode is when it is automatically triggered by snippets. Currently, trying to type space, g, <, >, etc. as the first character of a snippet field will trigger their bind instead of actually inserting the character. I cannot currently think of any good reason why anyone would rely on using select mode to execute any of these mapped actions. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
36 lines
1.4 KiB
Lua
36 lines
1.4 KiB
Lua
-- Fast and feature-rich surround actions. For text that includes
|
|
-- surrounding characters like brackets or quotes, this allows you
|
|
-- to select the text inside, change or modify the surrounding characters,
|
|
-- and more.
|
|
return {
|
|
"nvim-mini/mini.surround",
|
|
keys = function(_, keys)
|
|
-- Populate the keys based on the user's options
|
|
local opts = LazyVim.opts("mini.surround")
|
|
local mappings = {
|
|
{ opts.mappings.add, desc = "Add Surrounding", mode = { "n", "x" } },
|
|
{ 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)
|
|
end,
|
|
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`
|
|
},
|
|
},
|
|
}
|