Operators on Visual Selections
Any operator works on a Visual range. Plus a few visual-only ones.
After selecting visually, any operator (d, c, y, gU, etc.) acts on the selection. A few operators are visual-only: u/U for case, J for join, > / < for indent.
After Visual selection, every operator key acts on the selection โ no motion needed. The selection IS the range.
| Key | Effect on selection |
|---|---|
| d | Delete |
| c | Change (delete + Insert) |
| y | Yank |
| p | Replace selection with register contents |
| >, < | Indent / outdent |
| = | Reindent (per 'indentexpr') |
| gU, gu, g~ | Uppercase / lowercase / toggle case |
| U, u | Same โ but visual-only single-key shortcuts |
| ~ | Toggle case (visual-only single-key) |
| J | Join lines (with space) |
| gJ | Join lines (no space added) |
Watch
- ๐บ #0439 v_r โ Replace Selection (not yet published)
- ๐บ #0442 v_> / v_< / v_= โ Indent (not yet published)
See also: The Vim Grammar, Case Changing, Indent and Auto-Indent