From 4b86fd8d8abb1ee1c80884f613c61dcbf93edc60 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Tue, 14 Jun 2022 16:51:45 -0700 Subject: [PATCH] manipulate words and CURRENT to fix magic completions in Zsh --- jc/shell_completions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jc/shell_completions.py b/jc/shell_completions.py index e3bee1ba..a8120791 100644 --- a/jc/shell_completions.py +++ b/jc/shell_completions.py @@ -179,8 +179,9 @@ _jc() { # if magic command is found anywhere in the line, use called command's autocompletion for i in $${words:0:-1}; do if (( $$jc_commands[(Ie)$${i}] )); then - # still not working 100%. works fine as `jc dig`, but `jc -p dig` - # will only complete with files, not program-specific completions + shift $$(( $${#words} - 2 )) words + words[1,0]=(jc) + CURRENT=$${#words} _arguments '*::arguments:_normal' return 0 fi