Editing with vi
From Hugme.org
Contents |
Moving around the screen
- h left
- l right
- j down
- k up
- (notice these commands are across the home keys on your right hand)
- $ go to the end of the line
- ^ go to the beginning of the line
- :1 go to the first line of the file
- :$ go to the last line of the file
- [ctrl]+f go forward a page
- [ctrl]+b go back a line
Edit
- i - insert - start editing before the curser
- I - insert - start editing at the beginning of the line
- a - append - start editing after the curser
- A - append - start editing at the end of the line
- o - open a new line after the one you are on and start editing
- O - open a line before the one you are on and start editing
- r - replace one character
- cw - replace from the curser tol the end of the word
- c$ - replace from the curser to the end of the line
- c^ - replace from the beginning of the line to your curser
Cut
- Notice I did not say delete. When you use these what's gone goes into your 'clipboard'
- dh - cut character to the left
- dl - cut character to the right
- dj - cut the line you are on and the one below it
- dk - cut the line you are on and the one above it
- dd - delete the line your curser is on
- D - delete from your curser to the end of the line
Yank and put (cut and paste)
- yy - yank line
- yw - yank word
- p - put (print out what's on the clipboard)
Other commands
- u - undo... yeah, I use this one a LOT
- . - repeat the last command
- :set number - show the page numbers
vim
If you're using vim you can turn colors on and off with this:
- :syntax on
- :syntax off