=================== Vim Quick Reference =================== This is a quick reference list of commonly used Vim key bindings and commands. This is not a complete list. `:help ` will bring up the help for any (for control + use `:help CTRL-`). move ---- h left j down k up l right H top of screen M middle of screen L bottom of screen w forward to start of word W forward to start of word (w/punctuation) b backward to start of word B backward to start of word (w/punctuation) e forward to end of word E forward to end of word (w/punctuation) ge backward to end of word gE backward to end of word (w/punctuation) 0 to start of line ^ to first non-blank character in line $ to end of line g_ to last non-blank character in line } to next blank line { to previous blank line % to matching bracket gg to first line G to last line 7gg to line 7 fX to next X tX to before next X FX to previous X TX to before previous X ; repeat previous f,t,F,T movement , repeat previous f,t,F,T movement backwards down half page up half page down one page up one page to previous jump position to next jump position scroll ------ down one line without moving cursor up one line without moving cursor zz center cursor on screen enter insert mode ----------------- i before cursor a after cursor I at beginning of line A at end of line o on new line below O on new line above delete ------ x character dd line D to end of line 5x 5 characters 7dd 7 lines dw to start of next word diw word daw word and space d^ to first non-blank character in line change ------ s character cc entire line C to end of line replace ------- r single character R enter replace mode format ------ gq selected text gqip paragraph gq} to next blank line indent ------ >> indent line << de-indent line join ---- J with line below with a space in between gJ with line below without a space in between repeat ----- . repeat last text changing command undo/redo --------- u undo redo U restore last changed line yank/put -------- yy yank a line Y yank to end of line (`noremap Y y$`) p put after cursor P put before cursor ]p put and indent to current line search ------ /X search for pattern X ?X search backwards for pattern X n repeat search N repeat search backwards enter visual mode ----------------- v visual V visual line visual block spelling -------- ]s next misspelled word [s previous misspelled word z= show suggestions zg add word to dictionary zw remove word from dictionary buffers ------- next (`noremap :bnext`) previous (`noremap :bprevious`) save (`noremap :write`) close (`:call BufClose('','')`) registers --------- "Xy yank into register X "Xp put from register X macros ------ qX record macro X q stop recording macro @X run macro X @@ rerun last macro windows ------- q quit quit (`noremap q`) s split v split vertically w focus next h focus left l focus right j focus below k focus above H move left L move right J move down L move up x exchange next < increase columns > decrease columns + increase rows - decrease rows = make all widows equal size insert mode =========== move right (`inoremap `) move left (`inoremap `) move to beginning of line (`inoremap `) move to end of line (`inoremap `) indent line de-indent line (`inoremap `) delete character before cursor (`inoremap `) delete character under cursor (`inoremap `) delete word before cursor auto-complete next match auto-complete previous match X insert contents of register X X issue command X in normal mode exit insert mode command mode ============ move right (`cnoremap `) move left (`cnoremap `) move to beginning of line (`cnoremap `) move to end of line (`cnoremap `) delete character before cursor (`cnoremap `) delete character under cursor (`cnoremap `) delete word before cursor X insert contents of register X exit command mode visual ====== y yank d delete > indent text < de-indent text u change to lowercase U change to uppercase ~ switch case gq format terminal ======== move right move left move to beginning of line move to end of line delete character before cursor delete character under cursor delete word before cursor N enter normal mode commands ======== :setlocal spell! toggle spelling :reg show registers content :%s/X/Y/gc replace all X with Y with confirmations regex ===== .\{-} non-greedy .* special registers ================= 0 last yank " last delete or yank % current file name / last search pattern : last command-line