Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

🏠 Back to Blog

Neovim Cheatsheet

Mode Switching:

  • i: Insert mode before cursor
  • I: Insert mode at the beginning of line
  • a: Insert mode after cursor
  • A: Insert mode at the end of line
  • v: Visual mode
  • V: Visual line mode
  • ^V (Ctrl + V): Visual block mode
  • :q: Quit (add ! to force)
  • :w: Save/write
  • :wq or ZZ: Save and Quit

Cursor Movement:

  • h: Left
  • j: Down
  • k: Up
  • l: Right
  • w: Jump by start of words
  • e: Jump to end of words
  • b: Jump backward by words
  • 0: Start of line
  • $: End of line
  • G: Go to last line of document
  • gg: Go to first line of document
  • ^: First non-blank character of line
  • : followed by a number: Go to that line number (e.g., :10)

Editing:

  • u: Undo
  • ^R (Ctrl + R): Redo
  • yy or Y: Yank/copy line
  • dd: Delete line
  • D: Delete from cursor to end of line
  • x: Delete character under cursor
  • p: Paste after cursor
  • P: Paste before cursor
  • r followed by a character: Replace character under cursor with the new character
  • cw: Change word

Search and Replace:

  • / followed by a term: Search for term (press n to go to next and N for previous)
  • :%s/old/new/g: Replace all occurrences of β€œold” with β€œnew” in the entire file

Windows & Tabs:

  • ^W (Ctrl + W) followed by h/j/k/l: Move cursor to another window
  • :split or :sp: Split window horizontally
  • :vsplit or :vsp: Split window vertically
  • :tabnew or :tabn: Create a new tab
  • gt: Move to next tab
  • gT: Move to previous tab

Others:

  • .: Repeat last command
  • *: Search for word under cursor
  • #: Search for word under cursor, backwards
  • ~: Switch case of character under cursor
  • o: Insert new line below and enter insert mode
  • O: Insert new line above and enter insert mode
  • : Indent line

  • <<: Dedent line