MAGIC_EQUAL_SUBST like completion
authorSergey Matveev <stargrave@stargrave.org>
Tue, 28 Jan 2020 11:04:21 +0000 (14:04 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 28 Jan 2020 11:04:21 +0000 (14:04 +0300)
zsh/.zshrc

index 056f919104aebeeee3bb5d90d750be2f277b80e9..119bc385041c9ead3307be6f9d2240c8fc2fd1d4 100644 (file)
@@ -156,7 +156,13 @@ alias zc="zcalc"
 zstyle ":completion:*:functions" ignored-patterns "_*"
 zstyle ":completion:*" matcher-list "" 'm:{a-z\-}={A-Z\_}' 'r:|?=** m:{a-z\-}={A-Z\_}'
 _mycomp () {
-    [ $CURRENT -eq 1 ] && _command_names || _files
+    [ $CURRENT -eq 1 ] && _command_names || _files && return 0
+    # MAGIC_EQUAL_SUBST {{{
+    [[ "$PREFIX" = *\=* ]] || return 1
+    compstate[parameter]="${PREFIX%%\=*}"
+    compset -P 1 "*="
+    _value
+    # }}}
 }
 zstyle ":completion:*" completer _mycomp _parameters
 autoload -U compinit ; compinit -d /tmp/.zcompdump