New option: g:signify_skip_filename_pattern

Closes #179.
This commit is contained in:
Marco Hinz 2016-03-03 12:50:55 +01:00
parent ca302f7233
commit a02c8793bf
2 changed files with 40 additions and 10 deletions

View File

@ -14,12 +14,7 @@ function! sy#start() abort
let sy_path = resolve(expand('%:p')) let sy_path = resolve(expand('%:p'))
if &diff if s:skip(sy_path)
\ || !filereadable(sy_path)
\ || (exists('g:signify_skip_filetype') && (has_key(g:signify_skip_filetype, &ft)
\ || (has_key(g:signify_skip_filetype, 'help')
\ && &bt == 'help')))
\ || (exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, sy_path))
if exists('b:sy') if exists('b:sy')
call sy#sign#remove_all_signs(bufnr('')) call sy#sign#remove_all_signs(bufnr(''))
unlet! b:sy b:sy_info unlet! b:sy b:sy_info
@ -147,3 +142,31 @@ endfunction
function! sy#buffer_is_active() function! sy#buffer_is_active()
return exists('b:sy') && b:sy.active return exists('b:sy') && b:sy.active
endfunction endfunction
function! s:skip(path)
if &diff || !filereadable(a:path)
return 1
endif
if exists('g:signify_skip_filetype')
if has_key(g:signify_skip_filetype, &filetype)
return 1
elseif has_key(g:signify_skip_filetype, 'help') && (&buftype == 'help')
return 1
endif
endif
if exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, a:path)
return 1
endif
if exists('g:signify_skip_filename_pattern')
for pattern in g:signify_skip_filename_pattern
if a:path =~ pattern
return 1
endif
endfor
endif
return 0
endfunction

View File

@ -94,6 +94,7 @@ All available options:~
|g:signify_disable_by_default| |g:signify_disable_by_default|
|g:signify_skip_filetype| |g:signify_skip_filetype|
|g:signify_skip_filename| |g:signify_skip_filename|
|g:signify_skip_filename_pattern|
|g:signify_update_on_bufenter| |g:signify_update_on_bufenter|
|g:signify_update_on_focusgained| |g:signify_update_on_focusgained|
|g:signify_line_highlight| |g:signify_line_highlight|
@ -200,17 +201,23 @@ This loads Sy, but it won't look for changes. You can toggle it anytime via
:SignifyToggle. :SignifyToggle.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:signify_skip_filetype* *g:signify_skip_filename_pattern*
*g:signify_skip_filename* *g:signify_skip_filename*
*g:signify_skip_filetype*
> >
let g:signify_skip_filetype = { 'vim': 1, 'c': 1 } let g:signify_skip_filetype = { 'vim': 1, 'c': 1 }
let g:signify_skip_filename = { '/home/user/.vimrc': 1 } let g:signify_skip_filename = { '/home/user/.vimrc': 1 }
< <
Don't activate the plugin for these filetypes and/or filenames. Don't activate the plugin for these filetypes and/or filenames. Filenames have
to be absolute paths.
NOTE: Filenames have to be absolute paths. These options must be |Dict|s for faster lookup.
>
let g:signify_skip_filename_pattern = [ 'foo.*bar', 'tmp' ]
<
Don't activate the plugin for filenames matching these patterns.
Default: Both are empty. Default: <none>
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:signify_update_on_bufenter* *g:signify_update_on_bufenter*