Download CERN UNIX User Guide
Transcript
Undoing and other vi Commands Repeat last edit command. Undo last edit. Restore current line. Join two lines. . u U J Exiting Commands Z :x :wq :w :w filename :q :q! Q :e file Save (write) and quit file. Save (write) and quit file. Save (write) and quit file. Save (write) file. Write current buffer to filename. Quit file. Quit file with no save. Quit vi and invoke ex. Edit file without leaving vi. Some ex Commands :set :set all :set number :set showmode :set option :set option=value :set option? :set nooption :sh <Ctrl-d> !command :r newfile :r !command 6.1.7 Display options set by user. Display list of all current options, both default and those set by the user. Display line numbers. Displays in insert mode a message on the promptline indicating the type of insert you are making. Activate option. Assign value to option. Display value of option. Deactivate option. Invoke shell. Return to editor from shell. Execute UNIX command. Read contents of newfile into current file. Read output of UNIX command into current file. The .exrc File Your can control your vi environment with the $HOME/.exrc file in your home directory. A sample .exrc file looks like this: set number set showmode The file is read by ex before it enters the vi mode; commands in .exrc should not have a preceding colon. 54