Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can't use bindkey -c

Steve Talley wrote:
> Does zsh's "bindkey" allow the same functionality as tcsh's "bindkey
> -c"?  This allows a keystroke to be bound to a builtin or external
> command instead of an editor command.  This is useful when I'd like to
> run a command and see it's output without having to destroy the
> contents of the command-line buffer.
> Example:
> bindkey -c "^P" pwd

Currently the way to do this is:

bindkey -s "^P" "^qpwd\n"

in which the ^q saves the line on the buffer stack, which is restored
after "pwd\n" is executed as input (this assumes emacs bindings; it's
actually a little better to have push-input bound to something and use
that instead of the ^q).

Maybe other ways will be forthcoming.

Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.

Messages sorted by: Reverse Date, Date, Thread, Author