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 mode) |
| 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
See also: The Vim Grammar, Case Changing, Indent and Auto-Indent