my question is simillar to this: How do I surround a quoted string without including leading whitespace?

But not exactly. I am using vim-surround.

I have a string

print he^llo_and_welcome 

where ^ signify my cursor position

I want it to become

print "he^llo_and_welcome"

but ysaW" includes leading whitespace and trying ys2i"" doesn't seem to work.

What should I do?


Change your command to use inner Word: ysiW"

You might want to read the following help topic to understand better the difference between iW and aW: :h aW :h iW

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.