From 3986409e70a3ec5602512c0d9a148ba0a57cb015 Mon Sep 17 00:00:00 2001 From: Arvydas Sidorenko Date: Sun, 6 May 2012 23:35:07 +0200 Subject: [PATCH] Improved ZSH completion (#535) Signed-off-by: Arvydas Sidorenko Signed-off-by: Uli Schlachter --- lib/awful/completion.lua.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/awful/completion.lua.in b/lib/awful/completion.lua.in index 66158e145..776389c27 100644 --- a/lib/awful/completion.lua.in +++ b/lib/awful/completion.lua.in @@ -12,6 +12,7 @@ local table = table local math = math local print = print local pairs = pairs +local string = string local util = require("awful.util") --- Completion module. @@ -88,21 +89,22 @@ function shell(command, cur_pos, ncomp, shell) i = i + 1 end - if cword_index == 1 then + if cword_index == 1 and not string.find(words[cword_index], "/") then comptype = "command" end local shell_cmd if shell == "zsh" or (not shell and os.getenv("SHELL"):match("zsh$")) then if comptype == "file" then - shell_cmd = "/usr/bin/env zsh -c 'local -a res; res=( " .. words[cword_index] .. "* ); print -l -- ${res[@]}'" + shell_cmd = "/usr/bin/env zsh -c 'local -a res; res=( " .. words[cword_index] .. "* ); print -ln -- ${res[@]}'" else -- check commands, aliases, builtins, functions and reswords shell_cmd = "/usr/bin/env zsh -c 'local -a res; ".. "res=( ".. "\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" \"${(k)reswords[@]}\" ".. + "${PWD}/*(:t)".. "); ".. - "print -l -- ${(M)res[@]:#"..words[cword_index].."*}'" + "print -ln -- ${(M)res[@]:#"..words[cword_index].."*}'" end else if bashcomp_funcs[words[1]] then