Stupid Vim Tricks: "Visual Block Mode"

Aug 3, 2017

I thought I'd write down one of my favorite vim tricks. This one is to change or comment a vertical block of text all at once, instead of one line at a time.

* Step One

Enter Visual Block mode with "Ctrl+V", then highlight a single character wide slice you wish to add comment characters to.

* Step two

Press "Shift+i" to enter insert mode, then enter your comment character. Don't worry, this will only effect one line at first.

* Step three

Press "Esc" to apply your change to all lines you previously had highlighted.

Ryan Buzzell

Computer Systems Engineer @ Eastman School of Music | Find me on the macadmins slack @rbuzzell https://macadmins.herokuapp.com/

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.