completion: complete general config vars in two steps

There are 581 config variables as of now when you do "git config
<tab>" which can fill up a few screens and is not very helpful when
you have to look through columns of text to find what you want.

This patch instead shows you only first level when you do

    git config <tab>

There are 78 items, which use up 8 rows in my screen. Compared to
screens of text, it's pretty good. Once you have chosen you first
level, e.g. color:

    git config color.<tab>

will show you all color.*

This is not a new idea. branch.* and remote.* completion already does
this for second and third levels. For those variables, you'll need to
<tab> three times to get full variable name.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2018-05-27 20:28:00 +02:00 коммит произвёл Junio C Hamano
Родитель 09c4ba410b
Коммит f22f682695
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -2158,9 +2158,14 @@ _git_config ()
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
return
;;
*.*)
__git_compute_config_vars
__gitcomp "$__git_config_vars"
;;
*)
__git_compute_config_vars
__gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
esac
__git_compute_config_vars
__gitcomp "$__git_config_vars"
}
_git_remote ()