about summary refs log tree commit diff
path: root/Functions/Zle/cycle-completion-positions
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-11 10:06:40 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-01-11 10:06:40 +0000
commit2a78c248425635ebeca509097a92f5e190174813 (patch)
treeb39aecc28faad0aa51ddfb8e2817cccc34d8242f /Functions/Zle/cycle-completion-positions
parent18530897142b1b8031b2028954415a5b98550388 (diff)
downloadzsh-2a78c248425635ebeca509097a92f5e190174813.tar.gz
zsh-2a78c248425635ebeca509097a92f5e190174813.tar.xz
zsh-2a78c248425635ebeca509097a92f5e190174813.zip
*** empty log message ***
Diffstat (limited to 'Functions/Zle/cycle-completion-positions')
-rw-r--r--Functions/Zle/cycle-completion-positions16
1 files changed, 16 insertions, 0 deletions
diff --git a/Functions/Zle/cycle-completion-positions b/Functions/Zle/cycle-completion-positions
new file mode 100644
index 000000000..34a2d8174
--- /dev/null
+++ b/Functions/Zle/cycle-completion-positions
@@ -0,0 +1,16 @@
+# This may be called after a completion that inserted the unambiguous
+# (i.e. non-menu- and non-single-match-) string into the command line.
+# If there are multiple positions in the string with missing or differing
+# characters, repeatedly calling this widget cycles between all these
+# positions.
+
+emulate -L zsh
+setopt extendedglob
+
+local p="$_lastcomp[insert_positions]"
+
+if [[ $p = ((#s)|*:)${CURSOR}:* ]]; then
+  CURSOR=${${p#(|*:)${CURSOR}:}%%:*}
+elif [[ -n $p ]]; then
+  CURSOR=${p%%:*}
+fi