# Vim Basics Cheatsheet > A fast reference for the motions, edits, searches, and window commands that make Vim feel less mysterious and a lot more useful. Normal mode is home base. If something feels weird, hit Esc first. Source: https://vim.cobanov.dev/ Part of the cobanov.dev cheatsheet set. Companions: https://git.cobanov.dev/llms.txt, https://tmux.cobanov.dev/llms.txt ## 01. Save, quit, or leave without saving The first commands most people want memorized immediately. ``` :w # write file :q # quit :wq # write and quit :q! # quit without saving ``` ## 02. Enter insert mode from normal mode Choose where the cursor should land before you start typing. ``` i # insert before cursor a # append after cursor o # open line below Esc # back to normal mode ``` ## 03. Jump faster than arrow keys ever will Motions that cover word jumps, line boundaries, and file navigation. ``` w # next word b # previous word 0 # start of line $ # end of line gg # start of file G # end of file :42 # jump to line 42 ``` ## 04. Yank, delete, and paste text Think of Vim edits as operations you can repeat and scale. ``` yy # copy line dd # cut line p # paste after P # paste before 3yy # copy 3 lines ``` ## 05. Undo, redo, and repeat the last change A tiny trio that pays for itself every single day. ``` u # undo Ctrl-r # redo . # repeat last change ``` ## 06. Find text and replace it safely Search first, then use a confirm flag when replacing across the file. ``` /text # search forward n # next match N # previous match :%s/old/new/g # replace all :%s/old/new/gc # replace with confirmation ``` ## 07. Select text by character, line, or block Helpful when you need to inspect or edit a structured chunk quickly. ``` v # characterwise V # linewise Ctrl-v # blockwise > # indent selection < # outdent selection ``` ## 08. Change and delete around text objects The commands that start making Vim feel magical. ``` ciw # change inner word diw # delete inner word ci" # change inside quotes da( # delete around parentheses ``` ## 09. Work with horizontal and vertical splits Open another view, move between them, then close what you do not need. ``` :split :vsplit Ctrl-w h Ctrl-w l Ctrl-w q ``` ## 10. Open files and move through buffers Useful when editing several files without leaving the session. ``` :e path/to/file :ls :bn # next buffer :bp # previous buffer :bd # delete buffer ``` ## 11. Indent and reformat code blocks Let Vim fix the shape of the text after you finish the content changes. ``` >> # indent line << # outdent line =ap # reformat paragraph gg=G # reformat whole file ``` ## 12. Recover when the screen feels wrong Commands for those moments when you lose track of mode or search state. ``` Esc :noh # clear highlight :set number :set relativenumber ``` ## Rules of thumb - Esc is a reset button - move with intent, edit in chunks, search precisely