From 54971621de7918fd847709e0a159a0fb6e1f49a1 Mon Sep 17 00:00:00 2001 From: kpbaks Date: Sun, 13 Apr 2025 14:28:08 +0200 Subject: [PATCH] completions/git: show url as description for remote completion --- CHANGELOG.rst | 1 + share/completions/git.fish | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7195123e0..4ebe84abf 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -62,6 +62,7 @@ New or improved bindings Completions ^^^^^^^^^^^ +- ``git`` completions now show the remote url as a description when completing remotes. Improved terminal support ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/share/completions/git.fish b/share/completions/git.fish index 09303dabf..1f514f9ac 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -96,7 +96,9 @@ function __fish_git_refs end function __fish_git_remotes - __fish_git remote 2>/dev/null + # Example of output parsed: + # "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git" + __fish_git config --get-regexp 'remote\.[a-z]+\.url' | string replace -rf 'remote\.(.*)\.url (.*)' '$1\t$2' end function __fish_git_files