Warning this is a beta and my first plugin. I won't be responsible for broken codes because the parser failed or something. You are encouraged to test this and report bugs and feature requests.
- sandwich and surround and they can be set using the options mentioned below.
- Provides key mapping to add surrounding characters.( visually select then press
s<char>
) - Provides key mapping to replace surrounding characters.(
sr<from><to>
) - Provides key mapping to delete surrounding characters.(
sd<char>
) ss
repeats last surround command.
- Provides key mapping to add surrounding characters.( visually select then press
s<char>
) - Provides key mapping to replace surrounding characters.(
cs<from><to>
) - Provides key mapping to delete surrounding characters.(
ds<char>
)
<c-s><char>
will insert both pairs in insert mode.<c-s><char><space>
will insert both pairs in insert mode with surrounding whitespace.<c-s><char><c-s>
will insert both pairs on newlines insert mode.
- Cycle surrounding quotes type. (
stq
) - Cycle surrounding brackets type. (
stb
) - Use
<char> == f
for adding, replacing, deleting functions.
- vim-plug:
Plug 'blackcauldron7/surround.nvim'
- minPlug:
MinPlug blackcauldron7/surround.nvim
- Put this somewhere in your init.vim:
lua require"surround".setup{}
- pairs: dictionary or lua table of form
{ nestable: {{},...}, linear: {{},....} }
where linear is an array of arrays which contain non nestable pairs of surrounding characters first opening and second closing like ", ' and nestable is an array of arrays which contain nestable pairs of surrounding characters like (, {, [.(default: { nestable = { {"(", ")"}, {"[", "]"}, {"{", "}"} }, linear = { {"'", "'"}, {'"', '"'} } })
- context_offset: number of lines to look for above and below the current line while searching for nestable pairs.
(default: 100)
- load__autogroups: whether to load inbuilt autogroups or not.
(default: false)
- mappings_style: "surround" or "sandwich"
(default: sandwich)
- load__keymaps: whether to load inbuilt keymaps or not.
(default: true)
- quotes: an array of items to be considered as quotes while cycling through them.
(default: ["'", '"']
- brackets: an array of items to be considered as brackets while cycling through them.
(default: ["(", "{", "["]
- Only supports neovim and always will because it's written in lua which is neovim exclusive.
- Doesn't support python docstrings and html tags yet.
- No vim docs(idk how to make them. Need help)
- Beta plugin not tested too much.(Help would be appreciated by testing and reporting bugs)
- No . repeat support(idk how to achieve this help would be appreciated.) (although there is a mapping
ss
only available in sandwich mode which repeats last surround command.)
You are more than welcome to submit PR for a feature you would like to see or bug fixes.