vi Editor: Commands: Other Commands
Here is a list of other useful commands for vi.
- :wq - write and quit
- :r xxx - read in file 'xxx' at this location of the cursor
- :e xxx - edit file 'xxx', first clearing the buffer
- :sh - run a subshell
- n - repeat last search
- N - repeat last search but in opposite direction
- - find matching brace or parenthesis
- ) - forward to next sentence or to next s-expr (lisp option)
- ( - backward sentence or back s-expr (lisp option)
- '' - back to previous location
- mX - mark this spot with letter 'X'
- 'X - go back to spot marked with 'X'
- J - join this line and next
- D - delete to end of line (same as d$)
- X - delete character before cursor
- > - left shift operator
- < - right shift operator
- ! - filter through command operator
- :[addr1,addr2]s/pattern/replacement/[option] - general pattern-match replacement (see ed(1) and ex(1))
- :[addr1,addr2]d - delete everything between addr1 and addr2