summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Väth <martin@mvath.de>2012-08-16 22:41:32 +0200
committerMartin Väth <martin@mvath.de>2015-10-11 10:48:17 +0200
commit5a92fe1aa255ec676b466307d87755644cffc408 (patch)
tree4c9389418575e553f03f2c57df1db687d5b8617b /app-shells/auto-fu-zsh/files/kill-line.patch
parentBump noscript. Improve zsh comments (diff)
downloadmv-5a92fe1aa255ec676b466307d87755644cffc408.tar.gz
mv-5a92fe1aa255ec676b466307d87755644cffc408.tar.bz2
mv-5a92fe1aa255ec676b466307d87755644cffc408.zip
Add several usability patches to auto-fu-zsh
Diffstat (limited to 'app-shells/auto-fu-zsh/files/kill-line.patch')
-rw-r--r--app-shells/auto-fu-zsh/files/kill-line.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/app-shells/auto-fu-zsh/files/kill-line.patch b/app-shells/auto-fu-zsh/files/kill-line.patch
new file mode 100644
index 00000000..cca7af05
--- /dev/null
+++ b/app-shells/auto-fu-zsh/files/kill-line.patch
@@ -0,0 +1,35 @@
+--- auto-fu.zsh
++++ auto-fu.zsh
+@@ -285,19 +285,21 @@
+ }
+ }
+
+-afu-eof-maybe () {
+- local eof="$1"; shift
+- [[ "$BUFFER" != '' ]] || { $eof; return }
+- "$@"
+-}
+-
+ afu-ignore-eof () { zle -M "zsh: use 'exit' to exit." }
+
+-afu-register-zle-eof () {
+- local fun="$1"
+- local then="$2"
+- local else="${3:-delete-char-or-list}"
+- eval "$fun () { afu-eof-maybe $then zle $else }; zle -N $fun"
++afu-kill-line() {
++if (($#BUFFER > CURSOR))
++then zle kill-line
++else zle kill-whole-line
++fi
++}
++afu-register-zle-eof() {
++eval $1'() { [[ -z $BUFFER ]] && { '$2'
++return
++}
++afu-kill-line
++}'
++zle -N $1
+ }
+ afu-register-zle-eof afu+orf-ignoreeof-deletechar-list afu-ignore-eof
+ afu-register-zle-eof afu+orf-exit-deletechar-list exit