Skip to main content
Ganesh Joshi
Back to Cheatsheets

Vim commands

Updated 2026-02-14

Vim keybindings: navigation, editing, search, and ex commands. Quick reference for daily use.

Navigation

  • h j k l

    Left, down, up, right.

  • w / b

    Next / previous word start.

  • 0 / ^ / $

    Line start / first non-blank / line end.

  • gg / G

    First line / last line.

  • Ctrl+u / Ctrl+d

    Half page up / down.

  • /pattern / ?pattern

    Search forward / backward.

  • n / N

    Next / previous match.

Editing

  • i / a

    Insert before / after cursor.

  • I / A

    Insert at line start / end.

  • o / O

    New line below / above.

  • dd / yy

    Delete / yank line.

  • x / X

    Delete char under / before cursor.

  • p / P

    Paste after / before cursor.

  • u / Ctrl+r

    Undo / redo.

  • ci" / ciw

    Change inside " / word.

Ex commands

  • :w

    Save.

  • :q

    Quit.

  • :wq / :x

    Save and quit.

  • :q!

    Quit without saving.

  • :s/old/new/g

    Substitute in line (g = all).

  • :%s/old/new/g

    Substitute in file.

  • :set number

    Show line numbers.

  • :noh

    Clear search highlight.

Vim commands | Cheatsheet | Ganesh Joshi