vim/plugin/autocmds.vim
Kenneth Benzie (Benie) 9c64158445 Replace vim-gitgutter with vim-signify
vim-gitgutter is buggy. vim-signify might be better, it does allow
configuration of which events trigger a sign column update and this
patch takes advantage of that. Firstly, the `CursorHold` and
`CursorHoldI` events are disabled and replaced with `InsertLeave` and
`TextChanged` events. This makes the sign column updates immediate, and
since vim-signify is asynchronous it's faster too.
2021-01-26 23:45:49 +00:00

32 lines
1.2 KiB
VimL

augroup benieAugroup
autocmd!
if $TMUX !=# ''
" [Un]set tmux window option to detect when to change pane.
call tmux#setNavigationFlag()
au FocusGained * silent call tmux#setNavigationFlag()
au VimLeave * silent call tmux#unsetNavigationFlag()
endif
" Reopening a file at last curson position
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\ | exe "normal! g'\"" | endif
" Highlight conflict markers in any filetype
au FileType * call matchadd('Todo', '^\(<<<<<<<\s.*\||||||||\|=======\|>>>>>>>\s.*\)$')
" Update `Last change: <date>` on write & go back previous cursor position
au FileType help au BufWritePre <buffer>
\ 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e|norm!``
" Read template into buffer then send line 1 to the black hold register
au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _
" Attempt to expand snippet named `_template` if it exists
au BufNewFile * silent! call snippet#template()
" Do the same when filetype changes to help
au FileType help silent! call snippet#template()
" Augment vim-signify by modifying it's autocmds
au User SignifyAutocmds call do#signify()
augroup END