about summary refs log tree commit diff
path: root/Functions/Zle/move-line-in-buffer
blob: 1a0efd9cacf0917c6482be8e317de058ca55faa6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#autoload

# Line motions that do not leave the current history entry,
# for editing in multi-line buffers.

# To use:
#  autoload -Uz move-line-in-buffer
#  zle -N up-line-in-buffer move-line-in-buffer
#  zle -N down-line-in-buffer move-line-in-buffer
#
# then bindkey as you prefer

local hno=$HISTNO curs=$CURSOR
zle .${WIDGET:s/in-buffer/or-history} "$@" &&
    (( HISTNO != hno && (HISTNO=hno, CURSOR=curs) ))
return 0