Skip to content

Commit f22f682

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 09c4ba4 commit f22f682

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,9 +2158,14 @@ _git_config ()
21582158
__gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur_"
21592159
return
21602160
;;
2161+
*.*)
2162+
__git_compute_config_vars
2163+
__gitcomp "$__git_config_vars"
2164+
;;
2165+
*)
2166+
__git_compute_config_vars
2167+
__gitcomp "$(echo "$__git_config_vars" | sed 's/\.[^ ]*/./g')"
21612168
esac
2162-
__git_compute_config_vars
2163-
__gitcomp "$__git_config_vars"
21642169
}
21652170

21662171
_git_remote ()

0 commit comments

Comments
 (0)