mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-16 14:41:02 +02: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
|
@ -1,5 +1,8 @@
|
||||||
2011-06-01 Barton E. Schaefer <schaefer@zsh.org>
|
2011-06-01 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* users/16064: Functions/Zle/move-line-in-buffer: example widget
|
||||||
|
for moving in multiline buffers without navigating history
|
||||||
|
|
||||||
* 29416 (plus typo fixes): Doc/Zsh/contrib.yo: Fix (mis-)uses of
|
* 29416 (plus typo fixes): Doc/Zsh/contrib.yo: Fix (mis-)uses of
|
||||||
var() in vcs_info documentation.
|
var() in vcs_info documentation.
|
||||||
|
|
||||||
|
@ -14909,5 +14912,5 @@
|
||||||
|
|
||||||
*****************************************************
|
*****************************************************
|
||||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.5351 $
|
* $Revision: 1.5352 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
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…
Reference in a new issue