Skip to main content

Vim Visual Block

In Vim, the Visual Block mode is a powerful feature that allows you to select text in a block, enabling efficient text manipulation. Here are some essential commands and shortcuts for working with Visual Block:

Visual Modes and Text Manipulation Commands

  1. To enter Visual Block mode, press Ctrl + V.
  2. To enter Visual Line mode, press Shift + V.
  3. Use the d command to delete selected text in Visual mode.
  4. Press Shift + I to enter insert mode at the beginning of the selected block.
  5. Enter the desired text.
  6. Hit Esc to exit insert mode.
  7. Move the cursor down to the next line.
  8. Use yy to yank (copy) the selected line.
  9. Press p to paste the yanked line.
  10. Use d to delete the line if needed.
  11. The command :%w !pbcopy saves the modified note and copies it to the clipboard.

These commands and shortcuts make Vim a versatile text editor for various tasks, especially when dealing with blocks of text.