O'Reilly logo

Using csh & tcsh by Paul DuBois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Examining and Modifying Key Bindings

tcsh lets you display and change your key bindings using the bindkey command. The various forms of bindkey are summarized in Table 7-9, and discussed below.

Table 7-9. Forms of the bindkey Command

Command

Description

bindkey -e

Select emacs bindings

bindkey -v

Select vi bindings

bindkey -d

Restore default bindings

bindkey -u

Display bindkey usage message

bindkey -l

List editing commands and their meanings

bindkey

List all key bindings

bindkey key

List binding for key

bindkey key cmd

Bind key to editing command cmd

bindkey -c key cmd

Bind key to UNIX command cmd

bindkey -s key str

Bind key to string str

bindkey -r key

Remove binding for key

The forms of bindkey that take a key argument also allow the following flags:

–k

Allows key to be up, down, left, or right, to indicate an arrow key.

–b

Allows key to be C-X or M-X, to indicate CTRL-X or META-X.

–a

Allows you to specify the alternate key map (the map used for vi command mode).

––

May be used immediately preceding key to tell bindkey to stop processing arguments as flags. This flag is useful when key itself begins with a dash.

–k and -b cannot both be used in the same command.

Selecting a Set of Bindings

To select a set of bindings en masse, use the -e or -v option:

% bindkey -e                     Select emacs bindings
% bindkey -v                     Select vi bindings

Selecting either set rebinds every key to the default for that set, undoing any prior bindings you may have established. To bind any individual keys specially (as discussed under Changing Key Bindings ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required