I recently started to use the "surround" plugin. I realized I don't know how to surround the current line. I mean, ysap<p> surrounds a paragraph and ysaw<p> surrounds a word. Apparently dw deletes a word and das deletes a sentence. dd deletes a line, however, the second d is not a selection I'm afraid. So ys??<p> for a line?
What you are looking for is the _ movement.
Ryan's answer is also right,
dd is a easier to type version of d_ and a lot of commands have this optimization.
As it turns out, surround.vim has it too (thank you Ryan!) and cheats a bit.
As you can see with :h _ it does actually not refer the current line, but the first non-blank character on the [count] -1 line downwards. This is the behaviour dd etc. uses. But isn't really what we want in your usecase, ys_ will actually give you this:
"
line
"
Instead of this:
"line"
So the surround.vim plugin "cheats" a bit, by implementing a yss command which does not work like dd, cc or yy but works for the usecase it has.
So to answer the question as in the title: _ is the general solution.
If you are just looking for surround.vim use Ryan's answer
Repeat s (yss), like cc, dd, yy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With