nvim-surround-wk is a Neovim plugin that integrates nvim-surround with [Which Key] to provide rich keymap visual hints for adding, modifying, and deleting surrounds.
- Neovim 0.11+
- Required plugin dependencies:
- nvim-surround (> v4.0.5 or HEAD)
- [Which Key]
Install the plugin with your preferred package manager, such as Lazy:
{
"gregorias/nvim-surround-wk",
config = true,
}Nvim-surround-wk uses a label in a surround definition.
Nvim-surround comes with labels for its built-in surrounds.
For user-defined surrounds, you need to provide the label field like so:
require"nvim-surround".buffer_setup{
surrounds = {
["$"] = {
add = { "${", "}" },
find = "$%b{}",
delete = "^(..)().-(.)()$",
label = "${…}"
},
}
}- All available surrounds need to be preconfigured. Which Key doesn’t process unconfigured triggers.
- Can’t use the space character as a trigger. This is probably a Which Key bug/limitation.
