1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

manipulate words and CURRENT to fix magic completions in Zsh

This commit is contained in:
Kelly Brazil
2022-06-14 16:51:45 -07:00
parent 8fba47f449
commit 4b86fd8d8a

View File

@ -179,8 +179,9 @@ _jc() {
# if magic command is found anywhere in the line, use called command's autocompletion # if magic command is found anywhere in the line, use called command's autocompletion
for i in $${words:0:-1}; do for i in $${words:0:-1}; do
if (( $$jc_commands[(Ie)$${i}] )); then if (( $$jc_commands[(Ie)$${i}] )); then
# still not working 100%. works fine as `jc dig`, but `jc -p dig` shift $$(( $${#words} - 2 )) words
# will only complete with files, not program-specific completions words[1,0]=(jc)
CURRENT=$${#words}
_arguments '*::arguments:_normal' _arguments '*::arguments:_normal'
return 0 return 0
fi fi