There are a number of functions that ZLE calls in response to particular events. For example, zle-line-init is called when ZLE starts, zle-line-finish when ZLE finishes successfully, zle-keymap-select indicates a change of keymap which is useful for vi indicators.

This page is for example uses of these functions.

* Make aborted command-lines available after pressing undo. So if you abort a line with Ctrl-C, you can get it back with undo.

zle-line-init() {
  if [[ -n $ZLE_LINE_ABORTED ]]; then
    local savebuf="$BUFFER" savecur="$CURSOR"
    zle split-undo
    BUFFER="$savebuf" CURSOR="$savecur" 
zle/zle_hooks.txt · Last modified: 2015/06/16 01:27 by opk