Two Wrongs

Email Quoting with Vim Visual Block Mode

Email Quoting with Vim Visual Block Mode

Block mode selection is not one of the most common modes of selection, but it can be very useful in a few select circumstances. One of those is when you want to insert or delete characters at the start of a bunch of lines. This is the primary use case I have for the visual block mode in Vim – especially when I'm composing emails.

animation of block mode being used as described

To make something a quote, I enter visual block mode with ctrl+v, and then I select the first column of the relevant lines. I press shift-i to enter insert mode in the beginning of the line, I type and press esc to exit insert mode. Bam! Vim has inserted the characters at the start of every selected line.

Deleting the quote characters is even easier. Just enter visual block mode, select the characters and press d to delete.