From 3133fce524b2bce7ef5d1a5b2460235e22e1619b Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Wed, 11 Sep 2013 21:13:51 +0000 Subject: [PATCH] Improve detection performance (#67) --- autoload/sy/repo.vim | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index 43b7a6b..12853f7 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -18,9 +18,23 @@ endif let s:diffoptions = get(g:, 'signify_diffoptions', {}) +let s:vcs_list = get(g:, 'signify_vcs_list', []) +if empty(s:vcs_list) + if executable('git') | call add(s:vcs_list, 'git') | endif + if executable('hg') | call add(s:vcs_list, 'hg') | endif + if executable('svn') | call add(s:vcs_list, 'svn') | endif + if executable('darcs') | call add(s:vcs_list, 'darcs') | endif + if executable('bzr') | call add(s:vcs_list, 'bzr') | endif + if executable('fossil') | call add(s:vcs_list, 'fossil') | endif + if executable('cvs') | call add(s:vcs_list, 'cvs') | endif + if executable('rcsdiff') | call add(s:vcs_list, 'rcs') | endif + if executable('accurev') | call add(s:vcs_list, 'accurev') | endif + if executable('p4') | call add(s:vcs_list, 'perforce') | endif +endif + " Function: #detect {{{1 function! sy#repo#detect(path) abort - for type in get(g:, 'signify_vcs_list', [ 'git', 'hg', 'svn', 'darcs', 'bzr', 'fossil', 'cvs', 'rcs', 'accurev', 'perforce' ]) + for type in s:vcs_list let diff = sy#repo#get_diff_{type}(a:path) if !empty(diff) return [ diff, type ]