save calls concerning filename resolving

This commit is contained in:
Marco Hinz 2013-03-18 01:51:19 +01:00
parent 96f8217904
commit 89ab458cb8

View File

@ -105,11 +105,11 @@ augroup signify
autocmd! autocmd!
if exists('g:signify_cursorhold_normal') && (g:signify_cursorhold_normal == 1) if exists('g:signify_cursorhold_normal') && (g:signify_cursorhold_normal == 1)
autocmd CursorHold * write | call s:start(resolve(expand('<afile>:p'))) autocmd CursorHold * write | call s:start(s:file)
endif endif
if exists('g:signify_cursorhold_insert') && (g:signify_cursorhold_insert == 1) if exists('g:signify_cursorhold_insert') && (g:signify_cursorhold_insert == 1)
autocmd CursorHoldI * write | call s:start(resolve(expand('<afile>:p'))) autocmd CursorHoldI * write | call s:start(s:file)
endif endif
if !has('gui_win32') if !has('gui_win32')
@ -117,7 +117,8 @@ augroup signify
endif endif
autocmd VimEnter,ColorScheme * call s:colors_set() autocmd VimEnter,ColorScheme * call s:colors_set()
autocmd BufEnter,BufWritePost * call s:start(resolve(expand('<afile>:p'))) autocmd BufEnter * let s:file = resolve(expand('<afile>:p'))
autocmd BufEnter,BufWritePost * call s:start(s:file)
augroup END augroup END
com! -nargs=0 -bar SignifyToggle call s:toggle_signify() com! -nargs=0 -bar SignifyToggle call s:toggle_signify()
@ -479,20 +480,18 @@ endfunction
" Functions -> s:toggle_signify() {{{2 " Functions -> s:toggle_signify() {{{2
function! s:toggle_signify() abort function! s:toggle_signify() abort
let path = resolve(expand('%:p')) if empty(s:path)
if empty(path)
echo "signify: I don't sy empty buffers!" echo "signify: I don't sy empty buffers!"
return return
endif endif
if has_key(s:sy, path) if has_key(s:sy, s:path)
if (s:sy[path].active == 1) if (s:sy[s:path].active == 1)
let s:sy[path].active = 0 let s:sy[s:path].active = 0
call s:stop(path) call s:stop(s:path)
else else
let s:sy[path].active = 1 let s:sy[s:path].active = 1
call s:start(path) call s:start(s:path)
endif endif
endif endif
endfunction endfunction
@ -520,57 +519,53 @@ function! s:toggle_line_highlighting() abort
let s:line_highlight = 1 let s:line_highlight = 1
endif endif
call s:start(resolve(expand('%:p'))) call s:start(s:file)
endfunction endfunction
" Functions -> s:jump_to_next_hunk() {{{2 " Functions -> s:jump_to_next_hunk() {{{2
function! s:jump_to_next_hunk(count) function! s:jump_to_next_hunk(count)
let path = resolve(expand('%:p')) if !has_key(s:sy, s:path) || s:sy[s:path].id_jump == -1
if !has_key(s:sy, path) || s:sy[path].id_jump == -1
echo "signify: I cannot detect any changes!" echo "signify: I cannot detect any changes!"
return return
endif endif
if s:sy[path].last_jump_was_next == 0 if s:sy[s:path].last_jump_was_next == 0
let s:sy[path].id_jump += 2 let s:sy[s:path].id_jump += 2
endif endif
let s:sy[path].id_jump += a:count ? (a:count - 1) : 0 let s:sy[s:path].id_jump += a:count ? (a:count - 1) : 0
if s:sy[path].id_jump > s:sy[path].id_top if s:sy[s:path].id_jump > s:sy[s:path].id_top
let s:sy[path].id_jump = s:sy[path].ids[0] let s:sy[s:path].id_jump = s:sy[s:path].ids[0]
endif endif
execute 'sign jump '. s:sy[path].id_jump .' file='. path execute 'sign jump '. s:sy[s:path].id_jump .' file='. s:path
let s:sy[path].id_jump += 1 let s:sy[s:path].id_jump += 1
let s:sy[path].last_jump_was_next = 1 let s:sy[s:path].last_jump_was_next = 1
endfunction endfunction
" Functions -> s:jump_to_prev_hunk() {{{2 " Functions -> s:jump_to_prev_hunk() {{{2
function! s:jump_to_prev_hunk(count) function! s:jump_to_prev_hunk(count)
let path = resolve(expand('%:p')) if !has_key(s:sy, s:path) || s:sy[s:path].id_jump == -1
if !has_key(s:sy, path) || s:sy[path].id_jump == -1
echo "signify: I cannot detect any changes!" echo "signify: I cannot detect any changes!"
return return
endif endif
if s:sy[path].last_jump_was_next == 1 if s:sy[s:path].last_jump_was_next == 1
let s:sy[path].id_jump -= 2 let s:sy[s:path].id_jump -= 2
endif endif
let s:sy[path].id_jump -= a:count ? (a:count - 1) : 0 let s:sy[s:path].id_jump -= a:count ? (a:count - 1) : 0
if s:sy[path].id_jump < s:sy[path].ids[0] if s:sy[s:path].id_jump < s:sy[s:path].ids[0]
let s:sy[path].id_jump = s:sy[path].id_top let s:sy[s:path].id_jump = s:sy[s:path].id_top
endif endif
execute 'sign jump '. s:sy[path].id_jump .' file='. path execute 'sign jump '. s:sy[s:path].id_jump .' file='. s:path
let s:sy[path].id_jump -= 1 let s:sy[s:path].id_jump -= 1
let s:sy[path].last_jump_was_next = 0 let s:sy[s:path].last_jump_was_next = 0
endfunction endfunction
" Functions -> SignifyDebugListActiveBuffers() {{{2 " Functions -> SignifyDebugListActiveBuffers() {{{2