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

interchange-line widget



If you start typing something, and change your mind, you can already
use the push-input widget. However, if you change your mind while
typing the new command and want to go back to your first command, your
options are more limited. With this widget, you can change your mind
as many times as you want! Hooray!

function _interchange_line() {
  local REPLY
  read -z
  print -rz - $BUFFER
  BUFFER=$REPLY
  CURSOR=$#BUFFER
}
zle -N interchange-line _interchange_line
bindkey your-favorite-key interchange-line

I personally use F11 for push-input, alt-F11 for get-line, and
ctrl-F11 for the above widget. push-line (not push-input) is bound to
alt-q by default in emacs mode, and get-line to alt-g.

-- 
Mikael Magnusson



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