Selecting columns with visual block mode
If you want to edit several adjacent lines with a similar format, you might save a lot of time by making a columnar selection. This episode will demonstrate how to achieve this using Vim’s visual block mode.
I’ll be running my Core Vim Class online on Thursday, December 5th. Tickets cost $255, but you can get the earlybird discount of $230 if you buy yours before November 29th. The price includes an exclusive screencast that summarises the material from the class.
Visual block mode allows you to select a rectangular section of text. From normal mode, you can enter visual block mode by pressing
In most text editing environments, if you want to replace some text, you can just start typing and the replacement will overwrite the selection. But Vim’s visual modes are similar to normal mode, in that each key will execute a command. Here are some of the commands covered in this episode:
||change selection (delete and switch to insert mode)|
||insert in front of cursor|
||append after cursor|
||replace every character in selection|
||toggle cursor to opposite corner|