mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-30 05:40:58 +01:00
users/16064: example widget for line motion inside multiline buffers
without navigating history
This commit is contained in:
parent
f1667d2c62
commit
0cc65dba53
2 changed files with 20 additions and 1 deletions
16
Functions/Zle/move-line-in-buffer
Normal file
16
Functions/Zle/move-line-in-buffer
Normal file
|
|
@ -0,0 +1,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
|
||||
Loading…
Add table
Add a link
Reference in a new issue