cursor position
|
|
| editing |
|
| a | Enter insert mode, the characters typed in will be inserted after the current cursor position\. A count inserts all the text that had been inserted that many times. |
|---|---|
| i | Enter insert mode, the characters typed in will be inserted before the current cursor position. A count inserts all the text that had been inserted that many times. |
| u | undo the last change to the file. Typing u again will re-do the change. |
| y | y5y ---> yank 5 lines y5w ---> yank 5 words |
| p | Paste the specified buffer after the current cursor position or line. If no buffer is specified (with the " command.) then 'p' uses the general buffer. |
| x | Delete character under the cursor. 5x ---> deletes 5 characters. |
| d | dd deletes the current line. d5d ---> deletes 5 lines. d5w ---> deletes 5 words. |
| / | Search the file downwards for the string specified after the
/. n-->go to the next word |
| ? | Search the file upwards for the string specified after the ?. |
| . |
To repeat the last modification |
| :q! | Quit VI without saving changes. |
| :w | Write out the current file. |
| :w filename | Write the buffer to the filename specified. |
| :w >> filename | Append the contents of the buffer to the filename. |
| :wq | Write the buffer and quit. |
| :123 | Brings you to line 123. |
| :$ | Brings you to last line. |
| :se number | Shows line-numbers for all lines. |
| :se nonumber | Shows no linenumbers. |
| :5,10d | Deletes lines 5 to 10. |
| :1,$d | Cleans the file. |