Skip to content

gregorias/nvim-surround-wk

Repository files navigation

nvim-surround-wk

A Neovim plugin that adds Which Key support for nvim-surround.

Which Key hints showing available surrounds

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.

⚡️ Requirements

📦 Installation

Install the plugin with your preferred package manager, such as Lazy:

{
  "gregorias/nvim-surround-wk",
  config = true,
}

🚀 Usage

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 = "${…}"
    },
  }
}

Limitations

  • 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.

About

A Neovim plugin that integrates nvim-surround with Which Key.

Resources

License

Stars

Watchers

Forks

Contributors