]> git.donarmstrong.com Git - zsh.git/commitdiff
jump-after-first-word zle function
authormartin f. krafft <madduck@madduck.net>
Wed, 3 Aug 2011 07:49:41 +0000 (09:49 +0200)
committermartin f. krafft <madduck@madduck.net>
Wed, 3 Aug 2011 07:49:41 +0000 (09:49 +0200)
.zsh/zshrc/80_zle

index 05c094e3c80ec02a5fba9ee6c213c57248a76a7a..a7378006980c8c241a5a5e47f41eb3004164ea99 100644 (file)
@@ -38,4 +38,18 @@ autoload insert-unicode-char
 zle -N insert-unicode-char
 bindkey '^Xi' insert-unicode-char
 
+# jump behind the first word on the cmdline to add options
+function _jump_after_first_word() {
+    local words
+    words=(${(z)BUFFER})
+
+    if (( ${#words} <= 1 )) ; then
+        CURSOR=${#BUFFER}
+    else
+        CURSOR=${#${words[1]}}
+    fi
+}
+zle -N _jump_after_first_word
+bindkey '^x1' _jump_after_first_word
+
 # vim:ft=zsh