Published
-
Vim Tricks: Visual Block Mode

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.
Photo by Florian Olivo on Unsplash