Use shell-candidates for :git command completion

This commit is contained in:
Maxime Coste 2016-08-30 01:01:18 +01:00
parent f6cb6319d6
commit 551263c564

View File

@ -27,14 +27,9 @@ face GitBlame default,magenta
def -params 1.. \ def -params 1.. \
-docstring %sh{printf '%%{Git wrapping helper\navailable commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}'} \ -docstring %sh{printf '%%{Git wrapping helper\navailable commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}'} \
-shell-completion %{ -shell-candidates %{
shift $(expr ${kak_token_to_complete}) [ $kak_token_to_complete -eq 0 ] &&
prefix=$(printf %s "${1}" | cut -c1-${kak_pos_in_token} 2>/dev/null) printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nlog\nshow\nshow-diff\nstatus\nupdate-diff\n"
(
for cmd in add rm blame commit checkout diff hide-blame log show show-diff status update-diff; do
expr "${cmd}" : "^\(${prefix}.*\)$"
done
) | grep -v '^$'
} \ } \
git %{ %sh{ git %{ %sh{
show_git_cmd_output() { show_git_cmd_output() {