Closed petobens closed 2 years ago
See the breaking changes issue (#77), many changes have been made to configuration that break things. You're going to want to put the table under the add
key.
Hi! I indeed saw that but if I add:
require('nvim-surround').setup({
surrounds = {
['('] = {
add = { '(', ')' },
},
},
})
and then for instance try ds(
on (foo)
it won't work since I probably also need to add a delete
entry to the surrounds
table.. My question therefore is: is there an easy way to simple map/swap (
to have the same of )
for add, delete and change?
You can set the (
surround to false, then alias (
to )
in the aliases
table. See the default configuration for examples.
Edit: @petobens I was away from my computer earlier, but here's a config you can try:
require("nvim-surround").setup({
surrounds = {
["("] = false,
},
aliases = {
["("] = ")",
},
})
Hi! I indeed saw that but if I add:
require('nvim-surround').setup({ surrounds = { ['('] = { add = { '(', ')' }, }, }, })
and then for instance try
ds(
on(foo)
it won't work since I probably also need to add adelete
entry to thesurrounds
table.. My question therefore is: is there an easy way to simple map/swap(
to have the same of)
for add, delete and change?
Also with respect to why your original setup didn't work: you are correct that you would need to provide find/delete keys; they were defaulting to the invalid_key_behavior
behavior, and was trying to delete { '(', '(' }
pairs.
Thanks!
just want to leave a comment for OP: I had the exact same issue. And of course, thank you kylechui for providing the exact solution we need!
Hi if I have a something like:
[foo]
and I presscs[(
then I get[ foo ]
. I would like open parenthesis to avoid adding the leading/trailing whitespace (i.e basically swap the default behaviour of(
for)
)? Is that possible? I had something working prior to todays changes with:but that is not working anymore.. Thanks in advance!