To Invoke vi on the command line type: 'vi filename'
Command mode and input (insert) mode
Vi starts in command mode. The positioning commands operate only while vi is in command mode. You switch vi to input mode by entering any one of several vi input commands. Once in input mode, any character you type is taken to be text and is added to the file. You cannot execute any commands until you exit input mode.To exit input mode, press the escape (Esc) key.
Format of vi commands: 'vi [count][command]' (count repeats the effect of the command)
Below some commands to get you started:
|
Append after cursor | |
|
insert (append) at the end of the line | |
|
Insert before cursor | |
|
Open line below | |
|
Open line above | |
|
Import a file into the current file | |
|
Import a file into the current file after line 12 |
|
Back one character | |
|
Back one word | |
|
Back to beginning of insert |
|
Upper left corner (home) | |
|
Middle line | |
|
Lower left corner | |
|
Back a character | |
|
Down a line | |
|
Up a line | |
|
Beginning of line | |
|
End of line | |
|
Forward a character | |
|
One word forward | |
|
Back one word | |
|
Find c | |
|
Repeat find (find next c) |
|
Move one line upwards | |
|
Move one character to the right | |
|
Move one character to the left | |
|
Move one word to the right | |
|
Move one word to the right past punctuation | |
|
Move one word to the left | |
|
Move one word to the left past punctuation | |
|
Move to the end of the current word | |
|
Move to the beginning of the file | |
|
Move to the top of the current screen | |
|
Move to the middle of the current screen | |
|
Move to the bottom of the current screen | |
|
Move to the last line in the file | |
|
Move one screen towards the end of the file | |
|
Move 1/2 screen towards the end of the file | |
|
Move one screen towards the beginning of the file | |
|
Move 1/2 screen towards the beginning of the file | |
|
Refresh the screen | |
|
Move to line 5 of the file (5 can be any line number) |
|
Write out the file to save changes | |
|
Write the file to named file | |
|
Save the file exit vi | |
|
Force save the file | |
|
Quit vi but don’t save changes | |
|
Same as wq | |
|
Execute shell commands (<ctrl>d) |
|
Delete n lines to general buffer | |
|
Delete to end of sentence | |
|
Delete previous word | |
|
Delete to end of line | |
|
Delete character |
|
Undo last change | |
|
Undo all changes on line |
|
Display current line number | |
|
Redraw screen | |
|
Search backward | |
|
Search forward | |
|
Page backward | |
|
Page forward | |
|
Scroll up (half a screen) | |
|
Scroll down (half a screen) | |
|
Go to last line | |
|
Go to line n | |
|
Go to line n |
|
Find text string forward | |
|
Find text string backward | |
|
Find forward next string instance after a string search | |
|
Find backward next string instance after a string search | |
|
Global Search and substitute replace (O=search object r=replace object) |
© Copyright 2001-2022 CCRMA, Stanford University. All rights reserved.
Created and Mantained by Juan Reyes