summaryrefslogtreecommitdiff
path: root/Functions/Zle/move-line-in-buffer
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2011-12-01 10:02:04 +0100
commitd8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca (patch)
tree9fd9a57486ac4702608d92088ffd91f52971244f /Functions/Zle/move-line-in-buffer
parentaf2bb4fdb09414d21922d3fafe4e3a0ac1332f01 (diff)
parent9d71f4c207fb34e8d64af0443c83231b1cc3b494 (diff)
downloadzsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.tar.gz
zsh-d8da5ea2f2bc5f837d0b364fff2636ebdb2f90ca.zip
Merge commit 'zsh-4.3.13' into debian
Diffstat (limited to 'Functions/Zle/move-line-in-buffer')
-rw-r--r--Functions/Zle/move-line-in-buffer16
1 files changed, 16 insertions, 0 deletions
diff --git a/Functions/Zle/move-line-in-buffer b/Functions/Zle/move-line-in-buffer
new file mode 100644
index 000000000..5f37a9d71
--- /dev/null
+++ b/Functions/Zle/move-line-in-buffer
@@ -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