z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Setting up an editing options command file

z/OS UNIX System Services User's Guide
SA23-2279-00

A command file contains a number of commands that can be executed as if they were typed in a vi session. For example, you might use vi to create a file with the contents:
set wrapmargin=8
set tabstop=5
set shiftwidth=5
ab www World Wide Web
This sets all the options you want to use and all the abbreviations you need. The file can only contain instructions that normally start with a colon (:) in vi, but you omit the colons in the command file. During a vi session, you can execute all the instructions in the command file with the instruction:
:so cmdfile
where cmdfile is the name of your command file. so stands for source, and it tells vi that the given file should be taken as the source of a number of commands.
You can execute the commands in a command file when you first start vi. Start vi with the command:
vi -c 'so cmdfile' filename
where cmdfile is the name of your command file and filename is the name of the file you want to edit. You might want to set up an alias for vi -c 'so cmdfile'; for example:
alias vic="vi -c 'so cmdfile'"

You can also set up a $HOME/.exrc file that contains all the commands you may want to run whenever you enter vi.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014