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

Re: Behaviour of {beginning,end}-of-buffer-or-history

On 2011-06-02 04:22, Bart Schaefer wrote:
On Jun 1,  9:57pm, Bernhard Tittelbach wrote:

Thanks ! :)

} Jumping to the beginning/end of a line in a multi-line buffer
} is just an extra my function does, and not somewhere I think
} {beginning,end}-of-buffer-or-history
} should do (it's name does not imply any such functionality :)

If you care to travel back in time 20 years or so you can take that
up with Paul Falstad. :-)

If I learn how to do that, I'm sure that will be the first thing I'll use it for ;-)

Meanwhile ... I think there's an easier way than whatever that is
you're doing with buflines and cur_array ...

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/} "$@"
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 ...

But it certainly is shorter, faster and more readable ;-)
and on single-line buffers completely equivalent to what my code did which is obviously going to be the predominant use-case.

Thanks again,

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