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

Re: "lock" command line



On 14/03/2008, Eric Smith <Eric.Smith@xxxxxxxxxxxx> wrote:
> What is a nice way to lock the command line so that accept-line
>  does not execute (or whatever).  Only when a certain key combination is
>  pressed does it "unlock"

Maybe something like this

function _lock() {
  unbindkey '^M'
}

function _unlock() {
  bindkey '^M' accept-line
}

zle -N lock-accept-line _lock
zle -N unlock-accept-line _unlock
bindkey '^X^L' lock-accept-line
bindkey '^X^U' unlock-accept-line #or whatever binds you want

I can make something more general if you want to disable all widgets
that accept the line, based on my own weird accept-line :).
-- 
Mikael Magnusson



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