parent
a149ad9510
commit
8cef26186e
@ -7,24 +7,28 @@ let g:id_top = 0x100
|
|||||||
let g:sy_cache = {}
|
let g:sy_cache = {}
|
||||||
|
|
||||||
" Function: #start {{{1
|
" Function: #start {{{1
|
||||||
function! sy#start(path) abort
|
function! sy#start() abort
|
||||||
if g:signify_locked
|
if g:signify_locked
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('b:sy_path')
|
||||||
|
let b:sy_path = resolve(expand('%:p'))
|
||||||
|
endif
|
||||||
|
|
||||||
if &diff
|
if &diff
|
||||||
\ || !filereadable(a:path)
|
\ || !filereadable(b:sy_path)
|
||||||
\ || (exists('g:signify_skip_filetype') && (has_key(g:signify_skip_filetype, &ft)
|
\ || (exists('g:signify_skip_filetype') && (has_key(g:signify_skip_filetype, &ft)
|
||||||
\ || (has_key(g:signify_skip_filetype, 'help')
|
\ || (has_key(g:signify_skip_filetype, 'help')
|
||||||
\ && &bt == 'help')))
|
\ && &bt == 'help')))
|
||||||
\ || (exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, a:path))
|
\ || (exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, b:sy_path))
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" new buffer.. add to list of registered files
|
" new buffer.. add to list of registered files
|
||||||
if !exists('b:sy') || b:sy.path != a:path
|
if !exists('b:sy') || b:sy.path != b:sy_path
|
||||||
let b:sy = {
|
let b:sy = {
|
||||||
\ 'path' : a:path,
|
\ 'path' : b:sy_path,
|
||||||
\ 'buffer': bufnr(''),
|
\ 'buffer': bufnr(''),
|
||||||
\ 'active': 0,
|
\ 'active': 0,
|
||||||
\ 'type' : 'unknown',
|
\ 'type' : 'unknown',
|
||||||
@ -111,6 +115,6 @@ function! sy#toggle() abort
|
|||||||
let b:sy.stats = [-1, -1, -1]
|
let b:sy.stats = [-1, -1, -1]
|
||||||
else
|
else
|
||||||
let b:sy.active = 1
|
let b:sy.active = 1
|
||||||
call sy#start(b:sy.path)
|
call sy#start()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -73,5 +73,5 @@ function! sy#highlight#line_toggle() abort
|
|||||||
call sy#highlight#line_enable()
|
call sy#highlight#line_enable()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call sy#start(b:sy.path)
|
call sy#start()
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -16,7 +16,7 @@ augroup signify
|
|||||||
|
|
||||||
autocmd VimEnter * call sy#highlight#setup()
|
autocmd VimEnter * call sy#highlight#setup()
|
||||||
autocmd BufRead,BufEnter,SessionLoadPost * let b:sy_path = resolve(expand('<afile>:p'))
|
autocmd BufRead,BufEnter,SessionLoadPost * let b:sy_path = resolve(expand('<afile>:p'))
|
||||||
autocmd BufRead,BufWritePost * call sy#start(b:sy_path)
|
autocmd BufRead,BufWritePost * call sy#start()
|
||||||
autocmd BufDelete * call sy#stop()
|
autocmd BufDelete * call sy#stop()
|
||||||
|
|
||||||
autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1
|
autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1
|
||||||
@ -35,7 +35,7 @@ augroup signify
|
|||||||
if get(g:, 'signify_update_on_focusgained') && !has('gui_win32')
|
if get(g:, 'signify_update_on_focusgained') && !has('gui_win32')
|
||||||
autocmd FocusGained *
|
autocmd FocusGained *
|
||||||
\ if exists('b:sy') |
|
\ if exists('b:sy') |
|
||||||
\ call sy#start(b:sy.path) |
|
\ call sy#start() |
|
||||||
\ endif
|
\ endif
|
||||||
endif
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
|
Loading…
Reference in New Issue
Block a user