about summary refs log tree commit diff
path: root/Functions/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/Zle')
-rw-r--r--Functions/Zle/.distfiles3
-rw-r--r--Functions/Zle/edit-command-line18
2 files changed, 20 insertions, 1 deletions
diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles
index 429c133a0..8e9e1acee 100644
--- a/Functions/Zle/.distfiles
+++ b/Functions/Zle/.distfiles
@@ -1,3 +1,4 @@
 DISTFILES_SRC='
-    .distfiles incremental-complete-word insert-files
+    .distfiles history-search-end edit-command-line incremental-complete-word
+    incarg insert-files predict-on
 '
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
new file mode 100644
index 000000000..8019329bd
--- /dev/null
+++ b/Functions/Zle/edit-command-line
@@ -0,0 +1,18 @@
+# Edit the command line using your usual editor.
+# Binding this to 'v' in the vi command mode map,
+#   autoload edit-command-line
+#   zle -N edit-command-line
+#   bindkey -M vicmd v edit-command-line
+# will give ksh-like behaviour for that key.
+
+local tmpfile=${TMPPREFIX:-/tmp/zsh}ecl$$
+
+print $BUFFER >$tmpfile
+exec </dev/tty
+${VISUAL:-${EDITOR:-vi}} $tmpfile
+LBUFFER=
+RBUFFER=
+BUFFER=$(<$tmpfile)
+
+rm -f $tmpfile
+zle redisplay