Vim logoVim INTERMEDIATE

Vim

Essential Vim editor commands, modes, motions, and shortcuts for efficient text editing

8 min read
vimeditorshortcutscommandsproductivityterminal

Modes

Understanding Vim modes and how to switch between them

Vim Modes

Different modes in Vim and how to navigate between them

📄 Codetext
💡 Normal mode is the default and most powerful mode
⚡ Press Esc from any mode to return to Normal mode
📌 Use i for insert, v for visual selection, : for commands
🟢 Start with i and Esc until comfortable with other modes
modesbasics

Movement

Navigate efficiently through text

Basic Movement

Fundamental cursor movement commands

📄 Codetext
💡 Use numbers before commands: 5j moves down 5 lines
⚡ w/b for small words, W/B for WORDS (faster navigation)
📌 hjkl keeps your hands on home row
🟢 Master hjkl before using arrow keys
movementnavigation

Advanced Movement

Efficient navigation commands for larger jumps

📄 Codetext
💡 Use f/F/t/T for precise line navigation
⚡ % is perfect for navigating code with brackets
📌 */# instantly searches for current word
🟢 Ctrl+d/u for comfortable scrolling
movementnavigationadvanced

Editing

Commands for editing and manipulating text

Basic Editing

Essential editing commands

📄 Codetext
💡 d is delete, c is change (delete + insert), y is yank (copy)
⚡ Use . to repeat the last edit command
📌 dd deletes line, yy copies line, p pastes
🟢 Remember: d cuts, y copies, p pastes
editingdeletecopy

Text Objects & Operators

Powerful text manipulation with operators and text objects

📄 Codetext
💡 Combine operators (d/c/y/v) with text objects for power
⚡ "i" means inner (excludes delimiters), "a" means around
📌 ciw changes word from anywhere inside it
🟢 Master diw, ciw, and yiw first
editingtext-objectsadvanced

Visual Mode

Selecting and manipulating text visually

Visual Selection

Commands for visual mode selection and manipulation

📄 Codetext
💡 Visual block mode (Ctrl+v) for column editing
⚡ Use V for line selection, v for precise selection
📌 o jumps to other end of selection for adjustments
🟢 Press Esc to exit visual mode
visualselection

Search & Replace

Finding and replacing text

Search Commands

Search and navigation within files

📄 Codetext
💡 Use * to quickly search for word under cursor
⚡ Add \c for case-insensitive searches
📌 n/N to navigate through search results
🟢 Press / and start typing to search
searchfind

Find & Replace

Substitution and replacement commands

📄 Codetext
💡 Use %s for whole file, s for current line
⚡ Add c flag for interactive replacement
📌 Visual select then :s for selection only
🟢 Remember :%s/old/new/g for global replace
searchreplacesubstitution

Files & Buffers

Managing files, buffers, and windows

File Operations

Opening, saving, and managing files

📄 Codetext
💡 Use :w to save frequently
⚡ :x is shorthand for :wq
📌 :q! forces quit without saving
🟢 Remember :w (save) and :q (quit)
filesbuffers

Windows & Tabs

Managing multiple windows and tabs

📄 Codetext
💡 Use splits for comparing files side by side
⚡ Ctrl+w then hjkl to navigate windows
📌 :vsp for vertical split is most common
🟢 gt/gT for tab navigation
windowstabssplits

Macros & Registers

Recording and using macros, working with registers

Macros

Recording and executing repetitive tasks

📄 Codetext
💡 Use any letter a-z as macro register
⚡ @@ repeats the last executed macro
📌 Record once, replay many times
🟢 Start simple: record, test, then bulk apply
macrosautomation

Registers

Using registers for advanced copy/paste

📄 Codetext
💡 Use named registers (a-z) to store multiple yanks
⚡ "+ accesses system clipboard
📌 "_ for true deletion (no register storage)
🟢 Default operations use the unnamed register ""
registersclipboard

Settings & Customization

Common Vim settings and configuration

Common Settings

Useful Vim settings and options

📄 Codetext
💡 Add settings to ~/.vimrc for persistence
⚡ :set paste before pasting formatted code
📌 number + relativenumber for hybrid line numbers
🟢 Start with :set number and :syntax on
settingsconfiguration

Tips & Tricks

Productivity tips and useful combinations

Productivity Boosters

Time-saving tips and powerful combinations

📄 Codetext
💡 ci + text object is incredibly powerful
⚡ Use marks for quick navigation in large files
📌 gg=G auto-formats entire file
🟢 Master ciw and ci" for quick edits
tipsproductivityadvanced