Make sure b:sy_path is always set

References #136.
This commit is contained in:
Marco Hinz 2014-10-04 19:48:10 +02:00
parent a149ad9510
commit 8cef26186e
3 changed files with 13 additions and 9 deletions

View File

@ -7,24 +7,28 @@ let g:id_top = 0x100
let g:sy_cache = {}
" Function: #start {{{1
function! sy#start(path) abort
function! sy#start() abort
if g:signify_locked
return
endif
if !exists('b:sy_path')
let b:sy_path = resolve(expand('%:p'))
endif
if &diff
\ || !filereadable(a:path)
\ || !filereadable(b: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, a:path))
\ || (exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, b:sy_path))
return
endif
" 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 = {
\ 'path' : a:path,
\ 'path' : b:sy_path,
\ 'buffer': bufnr(''),
\ 'active': 0,
\ 'type' : 'unknown',
@ -111,6 +115,6 @@ function! sy#toggle() abort
let b:sy.stats = [-1, -1, -1]
else
let b:sy.active = 1
call sy#start(b:sy.path)
call sy#start()
endif
endfunction

View File

@ -73,5 +73,5 @@ function! sy#highlight#line_toggle() abort
call sy#highlight#line_enable()
endif
call sy#start(b:sy.path)
call sy#start()
endfunction

View File

@ -16,7 +16,7 @@ augroup signify
autocmd VimEnter * call sy#highlight#setup()
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 QuickFixCmdPre *vimgrep* let g:signify_locked = 1
@ -35,7 +35,7 @@ augroup signify
if get(g:, 'signify_update_on_focusgained') && !has('gui_win32')
autocmd FocusGained *
\ if exists('b:sy') |
\ call sy#start(b:sy.path) |
\ call sy#start() |
\ endif
endif
augroup END