It's not specific to vim-surround - va'
also selects the leading whitespace. From :h a'
:
a" v_aquote aquote
a' v_a' a'
a` v_a` a`
"a quoted string". Selects the text from the previous
quote until the next quote. The 'quoteescape' option
is used to skip escaped quotes.
Only works within one line.
When the cursor starts on a quote, Vim will figure out
which quote pairs form a string by searching from the
start of the line.
Any trailing white space is included, unless there is
none, then leading white space is included.
Reading on:
i" v_iquote iquote
i' v_i' i'
i` v_i` i`
Like a", a' and a`, but exclude the quotes and
repeating won't extend the Visual selection.
Special case: With a count of 2 the quotes are
included, but no extra white space as with a"/a'/a`.
So:
ys2i')
And with my tests, this worked as desired:
a 'aaa'
Changes to:
a ('aaa')
W
must be capitalized which forces it to surround around the'
. Finally use)
instead of(
which surrounds it the way you were asking. Good luck.:h surround
(great tutorial and few of nice examples including answer to your question).ysa')
seems to work correctly for me. If your cursor is on the opening'
, thenysf')
also works.