normal·mode
~ / operators
3

Operators & the Dot

Vim's grammar: an operator (d, c, y, gU, >…) plus a motion. Learn to make changes that repeat with a single ..

  1. 01

    Operator + motion: d, c and y

    Vim edits are sentences: a verb (the operator) and how far (the motion).

    d{motion}c{motion}y{motion}dwdedbd$d0
  2. 02

    Line shortcuts: dd, cc, D, C, J and friends

    Doubled operators act on whole lines; capitals run to the end of the line.

    ddccyyDCYxXnvim
  3. 03

    Put, undo and redo: p, P, u and <C-r>

    Deleted text is cut, not lost. Put it back anywhere, and undo freely.

    pPu<C-r>xpddpyyp
  4. 04

    The dot command: repeat the last change

    Make a change once, then move and press . to do it again.

    .{count}.f{char};A
  5. 05

    Rename one at a time: *, n and cgn

    Search for a word, change it once, then repeat at each match you choose.

    *#nNcgndgn{Visual}*nvim
  6. 06

    Counts: do it N times

    A number before a command repeats it, and <C-a> / <C-x> do arithmetic.

    {count}{cmd}3dwd3w3p<C-a><C-x>nvim
  7. 07

    Case, indent and replace: gU, gu, >, < and r

    More operators for any motion, plus one-character fixes with ~ and r.

    gU{motion}gu{motion}g~{motion}gUU>{motion}<{motion}>>={motion}
outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim