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.

Apart from the method that Peter has posted, if you have version 3.1.1
and have applied the patches that have been posted recently, the following
can be done:

bindkey "^P" run-pwd
zle -N run-pwd
function run-pwd {
  echo
  pwd
  zle redisplay
}

Presumably that patch will be in 3.1.2.  In a later version, there will
be a slightly more general solution, probably looking something like:

zle -N run-command
function run-command {
  zle trash-zle
  eval "$STACK"
  zle -s
}
bindkey -x "^P" run-command pwd

-zefram



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