Name
bindkey
Syntax
bindkey bindkey [option
] bindkey [option
] [key
] bindkey [option
] [key
] [command
] bindkey [option
] [key
] [string
]
Description
bindkey is a tcsh shell command that is used to select, examine, and define key bindings for use in the Terminal.
Options
The following list describes the various uses of the bindkey command.
- bindkey
Lists all of the key bindings.
-
bindkey -c
key cmd
Binds
key
to the Unix commandcmd
.- bindkey -d
Restores the default key bindings.
- bindkey -e
Changes the key bindings to Emacs mode.
-
bindkey
key
Lists the bindings for
key
.-
bindkey
key cmd
Binds
key
to the editing commandcmd
.- bindkey -l
Lists the editing commands and their meanings.
-
bindkey -r
key
Removes the binding for
key
.-
bindkey -s
key string
Binds
key
to the stringstring
.- bindkey -u
Displays a message, showing how to use the bindkey command.
- bindkey -v
Changes the key bindings to vi mode.
For example, to create a binding between the F2 key and the proto.term script from Section 1.3.1.1, earlier in this chapter, use this command:
bindkey -c ^[OQ 'open ~/Documents/proto.term'
To get the key sequence ^[OQ
, type Control-V
followed by the function key you want to bind, in this case F2. Now,
any time you type F2 in the first Terminal window, it will open a new
Terminal window using the settings saved in the
proto.term file. You can put
bindkey commands in your
.tcshrc or .login script to
make them permanent. For additional information on key bindings, and
how to alter them, see Using csh ...
Get Mac OS X for Unix Geeks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.