Professional Documents
Culture Documents
To Start vi
1. 2. vi filename vi -r filename Create or Edit filename starting at line 1 Recover filename that was being edited when system crashed
To Exit vi
1. 2. &. '. :x ret!rn" :w% ret!rn" :% ret!rn" :%( ret!rn" #!it vi$ writing o!t modified file to file named in original invocation #!it vi$ writing o!t modified file to file named in original invocation #!it or exit vi #!it vi even tho!gh latest changes have not been saved for this vi call
Basic vi commands
6. 7. 9. 1/.
)ove c!rsor bac- to beginning of .receding word )ove c!rsor to first line in file )ove c!rsor to line n in file )ove c!rsor to last line in file
Screen )ani.!lation
1. 2. &. '. 3. 5. :f :b :d :! :l :r )ove forward one screen )ove bac-ward one screen )ove down0forward2 one half screen )ove !.0bac-2one half sreen Redraws the screen Redraws the screen$removing the deleted lines
Basic vi commands
Basic vi commands
2. &. '. 3.
Erite c!rrent contents to a file named in original vi call Erite c!rrent contents to a new file named newfile Erite the contents of the line n!mbered 12 thro!gh &3 to a new file named smallfile Erite c!rrent contents over a .re-existing file named .revfile
Basic vi commands