Vi Documentation
Note: The original vi.html file appears to contain Firefox content instead of vi documentation. This is a placeholder for actual vi/vim documentation.
Basic Vi Commands
Mode Switching
i
- Enter insert mode before cursora
- Enter insert mode after cursoro
- Open new line below and enter insert modeO
- Open new line above and enter insert modeESC
- Return to normal mode
Navigation
h
- Move leftj
- Move downk
- Move upl
- Move rightw
- Move to beginning of next wordb
- Move to beginning of previous word0
- Move to beginning of line$
- Move to end of linegg
- Go to first lineG
- Go to last line
Editing
x
- Delete character under cursordd
- Delete entire lineyy
- Copy (yank) entire linep
- Paste after cursorP
- Paste before cursoru
- UndoCtrl+r
- Redo
Search and Replace
/pattern
- Search forward for pattern?pattern
- Search backward for patternn
- Next search resultN
- Previous search result:s/old/new/g
- Replace all occurrences in current line:%s/old/new/g
- Replace all occurrences in file
File Operations
:w
- Save file:q
- Quit:wq
or:x
- Save and quit:q!
- Quit without saving
Visual Mode
v
- Enter visual mode (character selection)V
- Enter visual line modeCtrl+v
- Enter visual block mode
This is a basic reference. For complete vi/vim documentation, consult the manual with :help
within vim or man vi
from the command line.