vimtricks.wiki Concise Vim tricks, one at a time.

How do I replace a visual block selection with digraph or special characters?

Answer

<C-v>jjr<C-k>12

Explanation

Visual block mode combined with the replace command and digraph input lets you replace a column of characters with special Unicode characters. By pressing r followed by <C-k> and a digraph code, every character in the block selection is replaced with the chosen special character.

How it works

  • <C-v>jj — select a vertical block of characters
  • r — enter replace mode for the entire selection
  • <C-k> — activate digraph input
  • Type a two-character digraph code (e.g., 12 for ½, * for bullet)
  • All selected characters are replaced simultaneously

Example

Before:
| x | data1 |
| x | data2 |
| x | data3 |

After <C-v>jjr<C-k>OK (✓ digraph):
| ✓ | data1 |
| ✓ | data2 |
| ✓ | data3 |

Tips

  • Use :digraphs to see all available digraph codes
  • Common digraphs: OK → ✓, XX → ✗, *2 → ★, 13 → ⅓, Db → ◆
  • <C-k> works in any insert/replace context, not just visual block
  • Use ga on any character to see its digraph code

Next

How do I return to normal mode from absolutely any mode in Vim?