vim-surround
vim-surround copied to clipboard
Space change in multi-line surround change
Perhaps this is related to #19
cs{(
on this text is off
{
line 1
line 2
}
becomes (line re-ordering happens, too, but I'm not showing it here #19)
(
line 1
line 2
)
and another example
something {
line 1
line 2
}
becomes
something ( line 1
line 2
)
I can confirm this is a distinct, unrelated issue.
The first issue is simply the standard whitespace swallowing of open parentheses being misapplied (the same thing that makes ds{
delete the spaces in { foo }
). https://github.com/tpope/vim-surround/blob/1a73f607f8f5477d6942df2eb6e7245c4864f4d3/plugin/surround.vim#L406-409 is the most obvious related code. I don't know the solution, but I understand the problem. I'd tell you to just use cs})
instead, but that has a harder to understand problem. :( So I'm going to instead mention g:surround_indent
as a possible workaround.
The only clue I have about the second one is that it doesn't suffer from the line re-ordering issue. Which, incidentally, reveals that the trigger condition of the line re-ordering issue is the brace on its own line.
any news/workaround about this issue?
The "another example" is what happens for me still - unfortunately, all of my code is in this format, meaning I can't use this plugin. If anyone has any ideas, love to hear them.