Simplify autocmd setup

This commit is contained in:
Marco Hinz 2017-02-20 16:05:55 +01:00
parent bf099a3fe2
commit 88cae56c30
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -10,6 +10,7 @@ endif
let g:loaded_signify = 1 let g:loaded_signify = 1
let g:signify_locked = 0 let g:signify_locked = 0
let s:realtime = get(g:, 'signify_realtime') && has('patch-7.4.1967')
" Init: autocmds {{{1 " Init: autocmds {{{1
@ -19,26 +20,26 @@ augroup signify
autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1 autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1
autocmd QuickFixCmdPost *vimgrep* let g:signify_locked = 0 autocmd QuickFixCmdPost *vimgrep* let g:signify_locked = 0
if get(g:, 'signify_realtime') && has('patch-7.4.1967') autocmd BufWritePost * call sy#start()
autocmd BufEnter,BufWritePost,WinEnter * call sy#start()
autocmd CursorHold,CursorHoldI * nested call s:save() if s:realtime
autocmd FocusGained * SignifyRefresh autocmd BufEnter,WinEnter * call sy#start()
else else
autocmd BufRead,BufWritePost * call sy#start() autocmd BufRead * call sy#start()
endif
if get(g:, 'signify_update_on_bufenter') if get(g:, 'signify_update_on_bufenter')
autocmd BufEnter * nested call s:save() autocmd BufEnter * nested call s:save()
endif endif
if get(g:, 'signify_cursorhold_normal') if s:realtime || get(g:, 'signify_cursorhold_normal')
autocmd CursorHold * nested call s:save() autocmd CursorHold * nested call s:save()
endif endif
if get(g:, 'signify_cursorhold_insert') if s:realtime || get(g:, 'signify_cursorhold_insert')
autocmd CursorHoldI * nested call s:save() autocmd CursorHoldI * nested call s:save()
endif endif
if get(g:, 'signify_update_on_focusgained') && !has('gui_win32') if (s:realtime || get(g:, 'signify_update_on_focusgained')) && !has('gui_win32')
autocmd FocusGained * SignifyRefresh autocmd FocusGained * SignifyRefresh
endif endif
endif
augroup END augroup END
" Init: commands {{{1 " Init: commands {{{1