From ee3a26d849da85cdea31d8ef9a81138c156357b9 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 27 Dec 2021 14:23:57 +0100 Subject: [PATCH] completions/git: fix completions for "git config" We don't provide completions on "git config " because we require "fish_is_nth_token 3". Confusingly, fish_is_nth_token only counts tokens *before* the cursor, so 2 is the right number here. While at it, fix a typo and delete an unused completion entry (it ran conditional on __fish_is_first_arg, which is always false for a git subcommand). --- share/completions/git.fish | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index a9fe99d63..9a58efdb4 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2076,9 +2076,8 @@ complete -F -c git -n '__fish_git_using_command config' -s f -l file -d 'Read co complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config from blob' -r # If no argument is specified, it's as if --get was used -# Use -k with `__fish_git_config_keys` so that user defined valeus are shown first -complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 3' -kfa '(__fish_git_config_keys)' -complete -f -c git -n '__fish_git_using_command config; and __fish_is_first_arg' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)' +# Use -k with `__fish_git_config_keys` so that user defined values are shown first +complete -c git -n '__fish_git_using_command config; and fish_is_nth_token 2' -kfa '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values matching key' -ka '(__fish_git_config_keys)' complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value specific for the section url' -r