Vim Recall繁體中文

Append text to a Visual block

<C-v>2j$A;<Esc>

Example

Normal mode on a in alpha. Lines: alpha, b, gamma.

Before
alpha
b
gamma
Cursor on line 1, column 1
  1. <C-v>2j$ Three-line Visual block · extends to each line’s end
  2. A;<Esc> Append semicolons · alpha;, b;, gamma;
After
alpha;
b;
gamma;
Cursor on line 1, column 1
Details & Vim help

Append the same suffix to the ends of selected lines.

Add separators to a short list with uneven line lengths.

Using $ makes the block extend to each line’s end. A fixed-width block appends at the block edge instead and may pad shorter lines with spaces.

Try it in Vim

  1. Start at the first character of alpha and press Ctrl-v, 2j, then $.
  2. Press uppercase A and type ;.
  3. Press <Esc> to apply the suffix to all selected lines.