Vim Basics A Quick Start Guide
Vim is a lightweight, keyboard-driven text editor available on almost every Unix-like system. This quick guide covers the essential concepts and commands to get productive fast.
- Normal (command) mode: navigate and manipulate text.
- Insert mode: type text (enter with i, a, o; return to Normal with Esc).
- Visual mode: select text (v for char, V for line, Ctrl+v for block).
Basic navigation (from Normal mode)
Section titled âBasic navigation (from Normal mode)â- h j k l : left, down, up, right
- w / e / b : word forward, end of word, word back
- 0 / ^ / $ : begin of line, first non-blank, end of line
- gg / G : top of file / end of file
Editing commands
Section titled âEditing commandsâ- x : delete character
- dd / yy : delete line / yank (copy) line
- p / P : paste after / before cursor
- u / Ctrl+r : undo / redo
- ~ : toggle case
Search and replace
Section titled âSearch and replaceâ- /pattern + Enter : search forward
- n / N : next / previous match
- :%s/old/new/g : replace all in file (use c for confirm)
Saving and quitting
Section titled âSaving and quittingâ- :w : write (save)
- :q : quit
- :wq or :x : save and quit
- :q! : quit without saving
Useful tips
Section titled âUseful tipsâ- Use counts: 5j moves down 5 lines, 2dw deletes two words.
- Combine commands: d$ deletes to end of line, caw changes a word.
- Use registers: âayyp stores a line into register a and pastes it.
- Sessions and buffers: :e filename to open, :bn / :bp to cycle buffers.
Customization and plugins
Section titled âCustomization and pluginsâ- ~/.vimrc (or init.vim for Neovim) holds your settings. Example minimal options: set number set expandtab set shiftwidth=2 set tabstop=2
- Popular plugin managers: vim-plug, Vundle, Pathogen.
Further learning: vimtutor (run vimtutor in terminal) and practice small edits until motions become muscle memory.