Fork me on GitHub
#vim
<
2022-05-20
>
Hukka05:05:59

How can I make vim-surround stop inserting extra spaces for example when replacing parenthesis with brackets?

Nikolay Kotsev06:05:13

IIRC giving an opening bracket (e.g. () in the command will insert extra spaces, while using closing ones ) wouldn’t. For example if you are in the middle of the word surround and use ysiw( it will yield ( surround ), while using ysiw) will result in (surround).

👍 3
Hukka08:05:05

Oh wow, never realized that. Thanks!

dharrigan05:05:40

Whilst I can't speak for vim-surround, I use vim-sandwich which works with text objects similarly to vim-surround (https://github.com/machakann/vim-sandwich). From their docs...For example, a key sequence saiw( makes foo to (foo).

dharrigan05:05:07

Perhaps worth an evaluation? (ha! no pun intended!)

Sigve06:05:11

vim-surround inserts whitespace around the parenthesis/brackets when using (/`[` and not when using )/`]`