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 -- NOTE: ${~:-"..."} turns on GLOB_SUBST, useful for expansion of
-- "~/" ($HOME). ${:-"foo"} is the string "foo" as var. -- "~/" ($HOME). ${:-"foo"} is the string "foo" as var.
shell_cmd = "/usr/bin/env zsh -c 'local -a res; res=( ${~:-" 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[@]}'" .. "print -ln -- ${res[@]}'"
else else
-- check commands, aliases, builtins, functions and reswords -- Check commands, aliases, builtins, functions and reswords.
shell_cmd = "/usr/bin/env zsh -c 'local -a res; ".. -- 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=( ".. "res=( "..
"\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" ".. "\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" "..
"\"${(k)reswords[@]}\" ".. "\"${(k)reswords[@]}\" "..
"${PWD}/*(:t)".. "./${^${pwd_exe}} "..
"); ".. "); "..
"print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'" "print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'"
end end