Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Behaviour of {beginning,end}-of-buffer-or-history
On Jun 2, 5:04am, Bernhard Tittelbach wrote:
}
} > beginning-or-end-of-somewhere() {
} > local hno=$HISTNO
} > zle .${WIDGET:s/somewhere/line-hist/} "$@"
} > if (( HISTNO != hno )); then
} > zle .${WIDGET:s/somewhere/buffer-or-history/} "$@"
} > fi
} > }
} > zle -N beginning-of-somewhere beginning-or-end-of-somewhere
} > zle -N end-of-somewhere beginning-or-end-of-somewhere
} >
}
} Mhh, just when I got used to jumping to the beginning/end of a
} multi-line buffer with a double keypress of HOME/END ...
A quick test of [[ $LBUFFER[-1] = $'\n' ]] should fix that.
beginning-or-end-of-somewhere() {
local hno=$HISTNO
if [[ "${LBUFFER[-1]}" = $'\n' ]]
then
zle .${WIDGET:s/somewhere/buffer-or-history/} "$@"
else
zle .${WIDGET:s/somewhere/line-hist/} "$@"
if (( HISTNO != hno )); then
zle .${WIDGET:s/somewhere/buffer-or-history/} "$@"
fi
fi
}
zle -N beginning-of-somewhere beginning-or-end-of-somewhere
zle -N end-of-somewhere beginning-or-end-of-somewhere
Messages sorted by:
Reverse Date,
Date,
Thread,
Author