From 15fdfd7bcf4d88ccc1c1d26d83e82a1926eefc06 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+tobealive@users.noreply.github.com> Date: Sun, 23 Jul 2023 12:15:23 +0200 Subject: [PATCH] tools: fix vcomplete for zsh (#18950) --- cmd/tools/vcomplete.v | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index aee4023d76..2289aa5bfb 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.v @@ -342,11 +342,19 @@ fn auto_complete(args []string) { exit(0) } mut lines := []string{} + mut dirs := []string{} + mut files := []string{} list := auto_complete_request(sub_args[1..]) for entry in list { - lines << 'compadd -U -S' + '""' + ' -- ' + "'${entry}';" + match true { + os.is_dir(entry) { dirs << entry } + os.is_file(entry) { files << entry } + else { lines << entry } + } } - println(lines.join('\n')) + println('compadd -q -- ${lines.join(' ')}') + println('compadd -J "dirs" -X "directory" -d -- ${dirs.join(' ')}') + println('compadd -J "files" -X "file" -f -- ${files.join(' ')}') } '-h', '--help' { println(help_text)