-
-
Notifications
You must be signed in to change notification settings - Fork 71
Migrating From Another Plugin
kylechui edited this page Jul 19, 2022
·
3 revisions
TODO: Add table comparing features
- Dot-repeat
- Smart quotes
- Reverse jumping
The default configuration matches many things in vim-surround; most features
in nvim-surround are designed to be an extension of those found in
vim-surround, as opposed to completely different behavior. Here's a
configuration that gets reasonably close:
require("nvim-surround").setup({
delimiters = {
invalid_key_behavior = function(char)
return { char, char }
end,
pairs = {
["<"] = false,
},
HTML = {
["<"] = "type",
},
},
})A few quirks to take note of:
- In general, extraneous whitespace is ignored for all normal mode surrounds.
- The command
ysa"bfor the bufferlocal str = "test string"would yieldlocal str = ("test string"). - The command
ysibBfor the buffer( some text )would yield( {some text} ).
- The command
- HTML-related:
- When filling out the contents of an HTML tag,
<and>are optional. -
>does not end the user-input,<CR>does. - When changing the surrounding tag, the "HTML key" only needs to be pressed
once, e.g.
cstinstead ofcstt. - To differentiate between changing just the HTML tag type (ignoring
attributes) and the whole tag contents (including attributes), the values
"type" and "whole" are used in
setup. By default,cstwill change just the tag type, whilecsTwill change the whole tag contents.
- When filling out the contents of an HTML tag,
TODO: Include more detailed information about vim-sandwich
require("nvim-surround").setup({
keymaps = {
normal = "sa",
delete = "sd",
change = "sr",
},
})TODO: Add mini.surround configuration, differences