awful.completion: zsh: fix command completion from PWD

Fixes https://github.com/awesomeWM/awesome/issues/1734.
This commit is contained in:
Daniel Hahler 2017-04-17 13:28:40 +02:00
parent 956ac3c50d
commit 2a69ffa374
1 changed files with 6 additions and 4 deletions

View File

@ -103,15 +103,17 @@ function completion.shell(command, cur_pos, ncomp, shell)
-- 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]) .. "}* ); "
.. string.format('%q', words[cword_index]) .. "}*(N) ); "
.. "print -ln -- ${res[@]}'"
else
-- check commands, aliases, builtins, functions and reswords
shell_cmd = "/usr/bin/env zsh -c 'local -a res; "..
-- Check commands, aliases, builtins, functions and reswords.
-- Adds executables and non-empty dirs from $PWD (pwd_exe).
shell_cmd = "/usr/bin/env zsh -c 'local -a res pwd_exe; "..
"pwd_exe=(*(N*:t) *(NF:t)); "..
"res=( "..
"\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" "..
"\"${(k)reswords[@]}\" "..
"${PWD}/*(:t)"..
"./${^${pwd_exe}} "..
"); "..
"print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'"
end