Professional Documents
Culture Documents
Vi Editor has two main modes of operation: 1. Command mode : Initially Vi Editor Opens in Command Mode. To Switch from Insert Mode to Command Mode Press ESC Key. 2. Insert mode : To switch into insert mode, simply press the 'i' key. To Exit Insert Mode Press ESC Key. If you are unsure which mode you are in, press 'ESC'. If you were in insert mode, you will be returned to command mode. If you were already in command mode, you will be left in command mode (possibly with a 'beep', to indicate that you were already in command mode).
Vi Editor Commands
Find match of current parenthesis, brace, or bracket. Display line number of cursor Move cursor to line number n Move cursor to line number n Move to last line in file
Editing
Press ESC Key & then the below mentioned command. dd Delete current line ndd Delete n lines D Delete remainer of line dw Delete word d} Delete rest of paragraph d^ Delete back to start of line dL Delete up to last line on screen dG Delete to end of file u Undo last change U Restore current line J Joins two lines (Current Line & the next line)) rx Replace character with x Rtext Replace text beginning at cursor ~ Reverse case yy Copy current line Paste Copied line below the Current Line p Paste Copied line above the Current Line P Ctrl-U Delete current line ESC End of insert mode :e file2 :e! :e# :n1,n2w >> file :n1,n2w :q :q! :r file :w :w file :w! :w! filename :wq :x ZZ Edit file2 (current file becomes alternate file) Reload file from disk (revert to previous saved version) Edit alternate file Append lines n1 to n2 to file Write lines n1 to n2 to file Quit Quit (even if changes not saved) Insert file after cursor Write file Write file as file, leaving original untouched Write file (ignoring warnings) Overwrite file (ignoring warnings) Write file and quit Quit, only writing file if changed Quit, only writing file if changed
Page 2