VC

Vim Commands Cheat Sheet

Vim reference with navigation, editing, visual mode, macros, registers, and text objects. Essential for terminal-based editing.

64 entries 9 sections

Navigation

Syntax Description Example
Move left / down / up / right 5j → move 5 lines down
Move forward / backward by word 3w → move 3 words forward
Move to end of word 2e → end of 2nd word
Move to beginning / end of line 0 → first column, $ → last char
First / last non-blank character ^ → first non-space char
Go to first / last line 10G → go to line 10
Move by paragraph } → next empty line
Half-page down / up Ctrl+f / Ctrl+b → full page
Jump to matching bracket % on ( jumps to matching )
Find char forward / backward on line fa → jump to next 'a' on line
Jump to before char t) → jump to just before )
Repeat last f/F/t/T forward / backward ; → repeat last find

Insert Mode

Syntax Description Example
Insert before / after cursor i → start typing at cursor
Insert at beginning / end of line A → append at end of line
Open new line below / above o → new line below, start typing
Substitute char / line s → delete char, enter insert mode
Change (delete + insert) cw → change word, ciw → change inner word
Change to end of line C → delete to end, enter insert mode
Exit insert mode Esc → return to normal mode

Editing

Syntax Description Example
Delete char under / before cursor 5x → delete 5 chars
Delete (cut) entire line 3dd → delete 3 lines
Delete with motion dw → delete word, d$ → delete to end
Delete to end of line D → same as d$
Yank (copy) entire line 5yy → yank 5 lines
Yank with motion yw → yank word, y$ → yank to end
Paste after / before cursor ddp → swap current and next line
Undo / redo 5u → undo 5 changes
Repeat last change dd then . → delete another line
Indent / outdent line 3>> → indent 3 lines
Join line below to current 3J → join 3 lines
Toggle / upper / lower case gUw → uppercase word
Replace char under cursor rX → replace with X
Enter replace mode R → overtype characters

Visual Mode

Syntax Description Example
Character / line / block visual mode V → select entire lines
Reselect last visual selection gv → re-highlight previous selection
Move to other end of selection o in visual → toggle cursor end
Delete / yank / change selection Vjd → select and delete 2 lines

Search

Syntax Description Example
Search forward /function → find 'function'
Search backward ?error → search backward for 'error'
Next / previous match n → next match, N → previous
Search word under cursor fwd / bwd * → find next occurrence of current word
Replace all in file :%s/foo/bar/gc → replace with confirm
Replace all in current line :s/yes/no/g → replace in line
Clear search highlighting :noh → remove yellow highlights

Text Objects

Syntax Description Example
Inner word / a word (with space) ciw → change inner word
Inner / around quotes ci" → change inside quotes
Inner / around parentheses di( → delete inside parens
Inner / around braces ci{ → change inside braces
Inner / around HTML tag cit → change inside <tag>...</tag>
Inner / around paragraph dap → delete paragraph

Files

Syntax Description Example
Write / quit / write and quit :wq → save and exit
Quit without saving :q! → force quit
Open file for editing :e ~/.bashrc → open bashrc
Next / previous buffer :ls → list all buffers
Horizontal / vertical split :vsp file.txt → split vertically
Navigate between splits Ctrl+w w → cycle through windows

Macros

Syntax Description Example
Record macro into register qa → record into 'a', q → stop
Play macro from register 10@a → play macro 'a' 10 times
Replay last macro @@ → repeat last played macro
Yank/paste to/from named register "ayy → yank line into register a
Show all register contents :reg → view all registers

Marks

Syntax Description Example
Set mark at cursor position ma → set mark 'a'
Jump to mark (line / exact) 'a → jump to line of mark a
Jump to last position '' → return to previous position

Frequently asked questions

How do I exit Vim?

Press Esc to ensure you're in normal mode, then type :q to quit (if no changes) or :wq to save and quit. Use :q! to force quit without saving. The joke about being unable to exit Vim exists because beginners don't know about normal mode vs insert mode.

What's the difference between Vim and Neovim?

Neovim is a modern fork of Vim with better defaults, built-in LSP support, Lua scripting (in addition to VimScript), async plugins, and a more active development community. Most Vim configs work in Neovim. For new users, Neovim is generally recommended.

How long does it take to learn Vim?

Basic proficiency (navigation, editing, saving) takes a few days. Comfort with motions and text objects takes 2-4 weeks. Real mastery (macros, registers, advanced motions) is ongoing. Use vimtutor (built-in tutorial) to start, and force yourself to use it daily.

Should I use Vim or a Vim plugin in my editor?

If you already use VS Code, IntelliJ, etc., start with a Vim plugin (like VSCodeVim) to learn the keybindings without losing your workflow. If you want the full experience, use Neovim with plugins like telescope, nvim-lsp, and treesitter.

What are the most essential Vim commands to learn first?

Start with: hjkl (navigation), i/Esc (insert/normal mode), :w/:q (save/quit), dd/yy/p (delete/copy/paste lines), / (search), u (undo), w/b (word movement), and ciw/diw (change/delete inner word). These cover 80% of daily editing.

How do I configure Vim?

Edit ~/.vimrc (Vim) or ~/.config/nvim/init.lua (Neovim). Essential settings: set number, set relativenumber, set expandtab, set tabstop=2, set ignorecase, set smartcase. Use a plugin manager like vim-plug or lazy.nvim for extensions.

Go from reference to real skills

Cheat sheets are great for quick lookups. Our in-depth courses take you from the fundamentals to professional-level mastery.

Browse all courses