vim – Quote something quickly

This is actually two tricks. Surrounding and highlighting something easier.

Step 1: Install the “Surround” vim plugin
Step 2: type the following: viwS”

This means, go into visual mode, and select the inner word, then surround it with quotes.
If you use “W” instead of “w”, it will select the whole chain of words.. Or highlight them.

If your cursor is situation on the word “car2” and you use:
lower case w: car.car2.car3 will select car2
upper case W: car.car2.car3 will select car.car2.car3

Leave a Reply

You must be logged in to post a comment.