{
"kylechui/nvim-surround",
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
}
use({
"kylechui/nvim-surround",
tag = "*", -- Use for stability; omit to use `main` branch for the latest features
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
})
🚀 Usage
The three “core” operations of add/delete/change can be done with the
keymaps ys{motion}{char}, ds{char}, and cs{target}{replacement},
respectively. For the following examples, * will denote the cursor position:
Old text Command New text
--------------------------------------------------------------------------------
surr*ound_words ysiw) (surround_words)
surr*ound_words ysiw( ( surround_words )
*make strings ysquot; "make strings"
[delete ar*ound me!] ds] delete around me!
remove <b>HTML t*ags</b> dst remove HTML tags
'change quot*es' cs'" "change quotes"
<b>or tag* types</b> csth1<CR> <h1>or tag types</h1>
delete(functi*on calls) dsf function calls
Note that surrounding with an opening delimiter (e.g. () will add a space before/after
the selection, while surrounding with the closing delimiter (e.g. )) will not include
the spaces. Detailed information on how to use this plugin can be found in
:h nvim-surround.usage.
:gear: Configuration
The default configuration is found
here.
Simply call require("nvim-surround").setup or
require("nvim-surround").buffer_setup with the desired options.
nvim-surround
Surround selections, stylishly
✨ Features
qis aliased to`,',", socsqbreplaces the nearest set of quotes with parentheses🔒 Requirements
📦 Installation
Install this plugin using your favorite plugin manager, and then call
require("nvim-surround").setup().lazy.nvim
packer.nvim
🚀 Usage
The three “core” operations of
add/delete/changecan be done with the keymapsys{motion}{char},ds{char}, andcs{target}{replacement}, respectively. For the following examples,*will denote the cursor position:Note that surrounding with an opening delimiter (e.g.
() will add a space before/after the selection, while surrounding with the closing delimiter (e.g.)) will not include the spaces. Detailed information on how to use this plugin can be found in:h nvim-surround.usage.:gear: Configuration
The default configuration is found here. Simply call
require("nvim-surround").setuporrequire("nvim-surround").buffer_setupwith the desired options.More information on how to configure this plugin can be found in
:h nvim-surround.configuration.Contributing
See the contributing file.
Shoutouts