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


Using the vi command editor

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

If you run the command:
bindkey -v
it tells the shell that you want the ability to edit commands the way that you normally edit text with vi; you are set up for vi command editing. Whenever the shell prompts you for input, it is as if the shell puts you into vi insert mode on a new line at the end of the history file. You can type in a new command just as you normally would.
You can also press <Esc> to enter a vi-like command mode. When you enter command mode, you can use the usual cursor movement commands to move around on the command line, or to move up and down in the history file. For example:
  • Press the k key to move back to the previous line in the history file (the last command line you entered). Press the k key again, and you move to the line before that.
  • Press j and you move forward in the history file.

In this way it is simple to retrieve recent commands from the history file. You can then edit them using standard vi commands. For example, you can use $ to move to the end of the line, and A to begin appending text to the end of the line. When you have edited the line to produce the command that you want to run, simply press <Enter> to run that line.

As you might expect, you can use these search commands:
/string
?string
to search backwards and forwards through the history file. You can edit the command line with these vi commands:
w
Move to next word
b
Move to previous word
d
delete
c
change
a
append
i
insert
u
undo
and many of the other vi commands. For a complete list of available commands, see the tcsh command description in z/OS UNIX System Services Command Reference.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014