Vim & Nano Commands Cheatsheet
Quick reference for Vim and Nano text editors: navigation, editing, search, and essential keyboard shortcuts.
| Feature | Description | Example | Category |
|---|---|---|---|
| Open File | Open file in Vim | vim filename.txt | Vim Basic |
| Insert Mode | Enter insert mode | i (insert before cursor) a (insert after cursor) I (insert at line start) A (insert at line end) | Vim Basic |
| Exit Insert Mode | Return to normal mode | ESC or Ctrl+[ | Vim Basic |
| Save File | Write changes to disk | :w | Vim Basic |
| Save and Quit | Save and exit Vim | :wq or ZZ | Vim Basic |
| Quit Without Save | Exit without saving | :q! | Vim Basic |
| Visual Mode | Enter visual selection mode | v (character) V (line) Ctrl+v (block) | Vim Basic |
| Move Cursor | Basic cursor movement | h (left) j (down) k (up) l (right) | Vim Navigation |
| Word Movement | Move by words | w (next word) b (previous word) e (end of word) | Vim Navigation |
| Line Movement | Move within line | 0 (line start) $ (line end) ^ (first non-blank) | Vim Navigation |
| Page Movement | Scroll pages | Ctrl+f (page down) Ctrl+b (page up) Ctrl+d (half page down) Ctrl+u (half page up) | Vim Navigation |
| File Navigation | Jump to file positions | gg (file start) G (file end) :42 (go to line 42) | Vim Navigation |
| Screen Position | Move cursor on screen | H (top of screen) M (middle) L (bottom) | Vim Navigation |
| Delete Character | Remove single character | x (delete under cursor) X (delete before cursor) | Vim Editing |
| Delete Line | Remove entire line | dd (delete line) D (delete to end of line) | Vim Editing |
| Delete Word | Remove word | dw (delete word) de (delete to end of word) | Vim Editing |
| Undo/Redo | Undo or redo changes | u (undo) Ctrl+r (redo) | Vim Editing |
| Copy (Yank) | Copy text | yy (yank line) yw (yank word) y$ (yank to end of line) | Vim Editing |
| Paste | Paste yanked/deleted text | p (paste after) P (paste before) | Vim Editing |
| Replace | Replace characters | r (replace char) R (replace mode) cw (change word) | Vim Editing |
| Join Lines | Join current line with next | J | Vim Editing |
| Search Forward | Search from cursor down | /pattern | Vim Search |
| Search Backward | Search from cursor up | ?pattern | Vim Search |
| Next/Previous | Navigate search results | n (next) N (previous) | Vim Search |
| Find and Replace | Substitute text | :%s/old/new/g (all file) :s/old/new/g (current line) | Vim Search |
| Find Character | Jump to character in line | f{char} (forward) F{char} (backward) t{char} (till forward) | Vim Search |
| Open File (Nano) | Open file in Nano | nano filename.txt | Nano Basic |
| Save (Nano) | Write changes to disk | Ctrl+O (WriteOut) Enter to confirm | Nano Basic |
| Exit (Nano) | Exit Nano editor | Ctrl+X | Nano Basic |
| Help (Nano) | Display help menu | Ctrl+G | Nano Basic |
| Cancel (Nano) | Cancel current operation | Ctrl+C | Nano Basic |
| Cut Text (Nano) | Cut current line or selection | Ctrl+K | Nano Editing |
| Paste (Nano) | Paste cut text | Ctrl+U | Nano Editing |
| Copy (Nano) | Copy text (mark first) | Alt+6 (after marking with Alt+A) | Nano Editing |
| Mark Text (Nano) | Start text selection | Alt+A or Ctrl+6 | Nano Editing |
| Search (Nano) | Search for text | Ctrl+W | Nano Editing |
| Replace (Nano) | Search and replace | Ctrl+\ or Alt+R | Nano Editing |
| Go to Line (Nano) | Jump to specific line | Ctrl+_ then enter line number | Nano Editing |
| Delete (Nano) | Delete character | Del or Ctrl+D | Nano Editing |
| Undo (Nano) | Undo last action | Alt+U | Nano Editing |
| Redo (Nano) | Redo last action | Alt+E | Nano Editing |