Fix awful.completion for zsh

This fixes 704cf21.
This commit is contained in:
Daniel Hahler 2015-03-31 00:11:20 +02:00
parent 418b7cf459
commit 594825c929
1 changed files with 5 additions and 3 deletions

View File

@ -99,9 +99,11 @@ function completion.shell(command, cur_pos, ncomp, shell)
local shell_cmd
if shell == "zsh" or (not shell and os.getenv("SHELL"):match("zsh$")) then
if comptype == "file" then
-- NOTE: wrapped in ${} to make `${"~/.X"}*` work (`"~/X."*` does not).
shell_cmd = "/usr/bin/env zsh -c 'local -a res; res=( "
.. string.format('${%q}', words[cword_index]) .. "* ); print -ln -- ${res[@]}'"
-- NOTE: ${~:-"..."} turns on GLOB_SUBST, useful for expansion of
-- "~/" ($HOME). ${:-"foo"} is the string "foo" as var.
shell_cmd = "/usr/bin/env zsh -c 'local -a res; res=( ${~:-"
.. string.format('%q', words[cword_index]) .. "}* ); "
.. "print -ln -- ${res[@]}'"
else
-- check commands, aliases, builtins, functions and reswords
shell_cmd = "/usr/bin/env zsh -c 'local -a res; "..