Basic Introduction to the vi Editor http://www.seas.gwu.edu/~csci51/intro-vi.txt ------------------------------------------------------------------------ COMMAND COMMENT EXAMPLES ------------------------------------------------------------------------------ vi filename editor vi file1 i insert before cursor a add after cursor R replace o open new line below cursor O open new line above cursor esc ******************** exit insert mode *************************** arrow keys cursor movement x delete this character dw delete this word [n]dd delete line(s) 3dd p paste delete-buffer control-f page forward control-b page backward control-u 1/2 page up control-d 1/2 page down :set number display with line numbers :set nonumber return to no line numbers :n move cursor to line n :149 :$ move cursor to end of file / search forward for string /BEGIN n gives next occurence ? search backward for string ?LOOP n gives next occurence :w write to file :w myfile :q! quit vi without writing :1,$ s/st1/st2/g replaces all occurences of st1 by st2 ZZ write and quit --------------------------------------------------------------------------------