From ab3671906ffcc20e54b8e325fda63e9b75b92420 Mon Sep 17 00:00:00 2001 From: ilkosta Date: Tue, 18 Jun 2013 21:03:58 +0200 Subject: [PATCH] enabled gi autocomplete and parameters separated by spaces --- plugins/gi/gi.load | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/gi/gi.load b/plugins/gi/gi.load index 063ea7d..0fa64ff 100644 --- a/plugins/gi/gi.load +++ b/plugins/gi/gi.load @@ -2,5 +2,19 @@ # function gi - curl http://gitignore.io/api/$argv + #curl http://gitignore.io/api/$argv + set -l params (echo $argv|tr ' ' ',') + curl http://gitignore.io/api/$params end + +# enable the complation by invoking `gi list` +if not set -q -g gi_list + timeout 2 ping -c 1 -q gitignore.io >/dev/null + set gi_available $status + + if test $gi_available + set -g gi_list (gi list| tr ',' ' ' ^/dev/null) + end +end + +complete -c gi -a "$gi_list" \ No newline at end of file