From 8eb00a2d081e9ceb6fa078bf5dac98478b952d04 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 25 Mar 2013 16:12:31 +0100 Subject: [PATCH] new option: configure which VCS to check for --- README.md | 6 ++---- doc/signify.txt | 9 +++++++++ plugin/signify.vim | 12 +++++++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5186025..8de1a10 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,6 @@ Current the following VCS are supported: - cvs - rcs -Note: CVS detection is disabled by default, because it can lead to considerable -delay if the current repo is not a CVS one and the environment variable $CVSROOT -is set nevertheless because a remote connection could be made. - #### quick jumping between changed lines There are mappings for jumping forth and back between changed lines (so-called @@ -165,6 +161,8 @@ For more info: `:h signify-options` __NOTE__: The shown assignments are only examples, not defaults. ```vim +let g:signify_vcs_list = [ 'git', 'hg' ] + let g:signify_mapping_next_hunk = 'gn' let g:signify_mapping_prev_hunk = 'gp' diff --git a/doc/signify.txt b/doc/signify.txt index cb9f0ba..a316beb 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -89,6 +89,15 @@ Put these variables into your vimrc. The shown assignments are only examples, not defaults. + let g:signify_vcs_list = [ 'git', 'hg' ] + +A list of VCS to check for. This can improve buffer loading time since by +default all supported VCS will be checked for. + +NOTE: This only happens once at buffer loading. Afterwards, the VCS will be +remembered anyway. + + let g:signify_mapping_next_hunk = 'gj' let g:signify_mapping_prev_hunk = 'gk' diff --git a/plugin/signify.vim b/plugin/signify.vim index 2e784c9..a936c1a 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -39,6 +39,8 @@ let s:other_signs_line_numbers = {} " overwrite non-signify signs by default let s:sign_overwrite = exists('g:signify_sign_overwrite') ? g:signify_sign_overwrite : 1 +let s:vcs_list = exists('g:signify_vcs_list') ? g:signify_vcs_list : [ 'git', 'hg', 'svn', 'darcs', 'bzr', 'cvs', 'rcs' ] + let s:id_start = 0x100 let s:id_top = s:id_start @@ -204,9 +206,9 @@ function! s:stop(path) abort call remove(s:sy, a:path) endif - aug signify - au! * - aug END + augroup signify + autocmd! * + augroup END endfunction " Functions -> s:sign_get_others() {{{2 @@ -253,7 +255,7 @@ function! s:repo_detect(path) abort echo 'signify: I cannot work without grep and diff!' endif - for type in [ 'git', 'hg', 'svn', 'darcs', 'bzr', 'cvs', 'rcs' ] + for type in s:vcs_list let diff = s:repo_get_diff_{type}(a:path) if !empty(diff) return [ diff, type ] @@ -319,7 +321,7 @@ endfunction " Functions -> s:repo_get_diff_cvs {{{2 function! s:repo_get_diff_cvs(path) abort - if executable('cvs') && exists('g:signify_enable_cvs') && (g:signify_enable_cvs == 1) + if executable('cvs') let diff = system('cvs diff -U0 -- '. a:path .' 2>&1 | grep --color=never "^@@ "') return v:shell_error ? '' : diff endif