summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-08-30 01:01:18 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-08-30 01:01:18 +0100
commit551263c564f88b40d0ae730160671bfc4e9cd0ff (patch)
treee195b70125c8106e8250fedccb1bd3e99de8c1f9
parentf6cb6319d6090230190177e50133fc91a8aab299 (diff)
Use shell-candidates for :git command completion
-rw-r--r--rc/extra/git-tools.kak11
1 files changed, 3 insertions, 8 deletions
diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak
index 58405767..216e74b7 100644
--- a/rc/extra/git-tools.kak
+++ b/rc/extra/git-tools.kak
@@ -27,14 +27,9 @@ face GitBlame default,magenta
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}'} \
- -shell-completion %{
- shift $(expr ${kak_token_to_complete})
- prefix=$(printf %s "${1}" | cut -c1-${kak_pos_in_token} 2>/dev/null)
- (
- 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 '^$'
+ -shell-candidates %{
+ [ $kak_token_to_complete -eq 0 ] &&
+ printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nlog\nshow\nshow-diff\nstatus\nupdate-diff\n"
} \
git %{ %sh{
show_git_cmd_output() {