liminfo

Vim Cheatsheet

Free reference guide: Vim Cheatsheet

65 results

About Vim Cheatsheet

This Vim Cheat Sheet provides a complete, searchable reference of over 70 essential Vim commands organized across six categories: Normal mode movement, Normal mode editing, Normal mode search, Insert mode, Visual mode, and Command mode. Each entry shows the exact keybinding alongside a concise description, making it easy to quickly look up any command while working in your terminal.

The reference covers the full breadth of everyday Vim usage, from basic cursor movement with h/j/k/l and word-based navigation with w/b/e, through text manipulation commands like dd, yy, and text objects (diw, di", da(), to advanced features such as screen splits (:split, :vsplit), tab management (gt, gT), register inspection (:reg), and global substitution (:%s/old/new/g). Whether you are editing configuration files on a remote server or writing code locally, these commands are the building blocks of efficient Vim workflows.

Designed for developers, system administrators, and anyone who works with terminal-based text editing, this reference is filterable by category so you can focus on the specific mode or command group you need. All content renders client-side with no server requests, and the interface supports both light and dark themes for comfortable reading in any environment.

Key Features

  • Over 70 Vim commands organized into Normal (movement, editing, search), Insert, Visual, and Command mode categories
  • Full text object coverage including diw, daw, di", da", di(, and da( for precise inner/around operations
  • Complete movement reference from basic h/j/k/l to f{char}, %, *, and screen positioning with zz/zt/zb
  • Insert mode entry points explained: i, I, a, A, o, O with in-mode shortcuts like Ctrl+n autocomplete
  • Visual mode variants documented: character-wise (v), line-wise (V), and block (Ctrl+v) with selection operations
  • Command mode essentials including :split/:vsplit window management, :tabnew tab control, and :! shell execution
  • Search and substitution patterns: /{pattern}, :%s/old/new/g for whole-file replacement, :noh to clear highlights
  • Instant keyword search and category filtering to find any keybinding in under a second

Frequently Asked Questions

What is the difference between Normal, Insert, Visual, and Command mode in Vim?

Normal mode is the default mode for navigating and issuing commands. Insert mode (entered via i, a, o, etc.) is for typing text. Visual mode (v, V, Ctrl+v) is for selecting text regions. Command mode (entered with :) is for executing ex commands like saving, quitting, substitution, and shell commands. Understanding modal editing is the key to Vim productivity.

How do I efficiently delete text in Vim without counting characters?

Use text objects instead of character counting. "diw" deletes the inner word under the cursor, "daw" deletes the word plus surrounding space, "di\"" deletes everything inside double quotes, and "da(" deletes the parenthesized expression including the parentheses. Combine d, c, or y with any text object for precise operations.

What is the difference between w and W for word movement?

Lowercase w treats punctuation as word boundaries, so "foo.bar" is three words (foo, ., bar). Uppercase W uses only whitespace as boundaries, so "foo.bar" is one WORD. The same distinction applies to b/B (backward) and e/E (end of word). Use W/B/E when you want to jump over punctuation-heavy code quickly.

How do I perform search and replace across an entire file in Vim?

Use ":%s/old/new/g" where % means the entire file, s is substitute, and g replaces all occurrences on each line (without g, only the first match per line is replaced). Add "c" for confirmation (:%s/old/new/gc), or restrict to a line range with ":10,20s/old/new/g". Use \< and \> for whole-word matching.

How do I split the screen and manage multiple files in Vim?

:split opens a horizontal split and :vsplit opens a vertical split. Navigate between splits with Ctrl+w w (cycle) or Ctrl+w h/j/k/l (directional). For tabs, :tabnew opens a new tab, gt/gT moves between tabs, and :tabc closes the current tab. You can also open a file in a split with :split filename.

What is the dot command (.) and why is it so powerful?

The dot command repeats the last change you made. If you type "ciwfoo<Esc>" to change a word to "foo", pressing . on another word will repeat that exact change. This makes repetitive edits extremely fast. Combine it with n (next search match) for a manual search-and-replace: search, change, then n. n. n. to apply selectively.

How do Visual block mode (Ctrl+v) operations work?

Ctrl+v enters block Visual mode, which selects a rectangular region of text. After selecting, press I to insert text at the beginning of every selected line, A to append, d to delete the block, or r to replace all characters. This is especially useful for editing columns of data, adding comment prefixes to multiple lines, or aligning code.

What are Vim registers and how do I use them?

Registers are named clipboard slots. The unnamed register (\"\") holds the last delete/yank. Named registers (\"a through \"z) let you store multiple clips: \"ayy yanks a line into register a, \"ap pastes it. The + register is the system clipboard. Use :reg to view all register contents. Uppercase register names (e.g., \"Ayy) append to the existing register content instead of overwriting.