motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 29153d5ba1ebccca8ac9e9e61db58f3e0fabfca5 (tree)
parent 8d4b85ed09bb6711635670196682e97c657fb7be
Author: Tim Pope <code@tpope.net>
Date:   Mon, 20 Jan 2020 06:29:13 -0500

Provide git config --get-all wrapper

Diffstat:
Mplugin/fugitive.vim | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -103,6 +103,24 @@ function! FugitiveConfig(...) abort endif endfunction +" Retrieve a Git configuration value. An optional second argument provides +" the Git dir as with FugitiveFind(). Pass a blank string to limit to the +" global config. +function! FugitiveConfigGet(name, ...) abort + return call('FugitiveConfig', [a:name] + a:000) +endfunction + +" Like FugitiveConfigGet(), but return a list of all values. +function! FugitiveConfigGetAll(name, ...) abort + if a:0 && type(a:1) ==# type({}) + let config = a:1 + else + let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1)) + endif + let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g') + return copy(get(config, name, [])) +endfunction + function! FugitiveRemoteUrl(...) abort return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1)) endfunction