i
- Insert mode (before cursor)a
- Insert mode (after cursor)A
- Insert at end of lineI
- Insert at beginning of lineo
- Open new line belowO
- Open new line abovev
- Visual mode (character)V
- Visual mode (line)Ctrl+v
- Visual block modeEsc
or Ctrl+c
- Normal mode:
- Command modeh/j/k/l
- Left/Down/Up/Rightw
- Next word startW
- Next WORD start (space-separated)e
- End of wordE
- End of WORDb
- Previous word startB
- Previous WORD start0
- Beginning of line^
- First non-blank character$
- End of linegg
- Top of fileG
- Bottom of file{number}G
- Go to line numberCtrl+u
- Half page upCtrl+d
- Half page downCtrl+f
- Full page forwardCtrl+b
- Full page backward%
- Jump to matching bracket/paren]]
- Next function/class[[
- Previous function/classgd
- Go to definition (LSP)gr
- Go to references (LSP)K
- Show documentation (LSP)Ctrl+o
- Jump backCtrl+i
- Jump forwardm{letter}
- Set mark'{letter}
- Jump to mark''
- Jump to last positionx
- Delete character under cursorX
- Delete character before cursordd
- Delete lineyy
- Yank (copy) linep
- Paste after cursor/lineP
- Paste before cursor/lineu
- UndoCtrl+r
- Redor{char}
- Replace single characterR
- Replace modes
- Substitute characterS
- Substitute linec
- Change (followed by motion)C
- Change to end of linecc
- Change entire lined
- Delete (followed by motion)y
- Yank (followed by motion)iw
- Inner wordaw
- A word (includes space)is
- Inner sentenceas
- A sentenceip
- Inner paragraphap
- A paragraphi"
- Inner quotesa"
- A quotes (includes quotes)i'
- Inner single quotesa'
- A single quotesi(
or ib
- Inner parenthesesa(
or ab
- A parenthesesi[
- Inner bracketsa[
- A bracketsi{
or iB
- Inner bracesa{
or aB
- A bracesit
- Inner tag (HTML/XML)at
- A tagv
- Character visualV
- Line visualCtrl+v
- Block visualo
- Switch cursor to other end>
- Indent selected<
- Unindent selectedy
- Yank selectiond
- Delete selectionc
- Change selection~
- Toggle caseU
- Uppercaseu
- Lowercase/pattern
- Search forward?pattern
- Search backwardn
- Next matchN
- Previous match*
- Search word under cursor (forward)#
- Search word under cursor (backward):s/old/new/
- Replace first on line:s/old/new/g
- Replace all on line:%s/old/new/g
- Replace all in file:%s/old/new/gc
- Replace all with confirmation:noh
- Clear search highlighting:w
- Save file:w filename
- Save as filename:q
- Quit:q!
- Quit without saving:wq
- Save and quit:x
- Save and quit (only if modified):e filename
- Edit file:e!
- Reload current file:r filename
- Insert file contents:pwd
- Show current directory:cd path
- Change directory:sp
- Horizontal split:vsp
- Vertical splitCtrl+w h/j/k/l
- Navigate windowsCtrl+w w
- Cycle through windowsCtrl+w =
- Equal window sizesCtrl+w _
- Maximize heightCtrl+w |
- Maximize widthCtrl+w q
- Close windowCtrl+w o
- Close other windows:tabnew
- New tab:tabc
- Close tab:tabo
- Close other tabsgt
- Next tabgT
- Previous tab{number}gt
- Go to tab numberzf
- Create fold (with motion)za
- Toggle foldzo
- Open foldzc
- Close foldzR
- Open all foldszM
- Close all foldszj
- Next foldzk
- Previous fold>>
- Indent line<<
- Unindent line={motion}
- Auto-indentgg=G
- Auto-indent entire file:retab
- Convert tabs to spacesgq{motion}
- Format text (wrap lines)gqip
- Format paragraph:ls
- List buffers:b{number}
- Go to buffer number:bn
- Next buffer:bp
- Previous buffer:bd
- Delete buffer:b filename
- Go to buffer by name:!command
- Execute shell command:r !command
- Insert command output!!command
- Replace line with command output:.!command
- Filter line through command"ay
- Yank to register ‘a’"ap
- Paste from register ‘a’:reg
- Show all registers"0
- Last yank register"+
- System clipboard (Linux/Mac)"*
- Selection clipboard (Linux)q{letter}
- Record macroq
- Stop recording@{letter}
- Execute macro@@
- Repeat last macro{number}@{letter}
- Execute macro n timesgd
- Go to definitiongD
- Go to declarationgi
- Go to implementationgr
- Go to referencesK
- Hover documentation<leader>rn
- Rename symbol<leader>ca
- Code actions[d
- Previous diagnostic]d
- Next diagnostic<leader>f
- Format code:set number
- Show line numbers:set relativenumber
- Relative line numbers:set expandtab
- Use spaces instead of tabs:set tabstop=4
- Tab width:set shiftwidth=4
- Indent width:set autoindent
- Auto-indent new lines:set smartindent
- Smart indenting:syntax on
- Enable syntax highlighting:set hlsearch
- Highlight search results:set ignorecase
- Case-insensitive search:set smartcase
- Smart case search:checkhealth
- Check plugin health:Telescope
- Fuzzy finder (with plugin):Mason
- Package manager (with plugin):Lazy
- Plugin manager (with plugin)Ctrl+/
- Terminal toggle (with plugin):term
- Open terminal:vs term://bash
- Vertical terminal split:recover
- Recover from swap file:e!
- Discard changes and reloadu
- Undo (can be repeated):earlier 5m
- Go back 5 minutes:later 5m
- Go forward 5 minutesCtrl+z
- Suspend vim (return with fg
).
to repeat last command3dd
, 5j
, 2w
ci"
to change inside quotesda(
to delete around parenthesesJ
to join linesCtrl+a
/ Ctrl+x
to increment/decrement numberszt
/ zz
/ zb
to position cursor (top/center/bottom)f{char}
to find character on line, ;
to repeatt{char}
to go before character, ,
to reverseciw
- Change inner worddiw
- Delete inner wordyiw
- Yank inner wordci"
- Change inside quotesdi(
- Delete inside parenthesesva{
- Visual select around braces=ip
- Auto-indent paragraph>}
- Indent to next paragraph