From 2545fa5967ec324ed386844e33791a5350e41091 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Sat, 12 Jun 2010 12:26:30 -0500 Subject: [PATCH] Reset autocmds on re-loading. --- plugin/delimitMate.vim | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index e7c186c..95ff187 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -93,19 +93,24 @@ command! DelimitMateTest call s:TestMappingsDo() " Switch On/Off: command! DelimitMateSwitch call s:DelimitMateSwitch() +"}}} -" Run on file type events. -"autocmd VimEnter * autocmd FileType * call DelimitMateDo() -autocmd FileType * call DelimitMateDo() +" Autocommands: {{{ -" Run on new buffers. -autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") | call DelimitMateDo() | endif +augroup delimitMate + au! + " Run on file type change. + "autocmd VimEnter * autocmd FileType * call DelimitMateDo() + autocmd FileType * call DelimitMateDo() -" Flush the char buffer: -autocmd InsertEnter * call delimitMate#FlushBuffer() -autocmd BufEnter * if mode() == 'i' | call delimitMate#FlushBuffer() | endif + " Run on new buffers. + autocmd BufNewFile,BufRead,BufEnter * if !exists("b:loaded_delimitMate") | call DelimitMateDo() | endif -"function! s:GetSynRegion () | echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') | endfunction + " Flush the char buffer: + autocmd InsertEnter * call delimitMate#FlushBuffer() + autocmd BufEnter * if mode() == 'i' | call delimitMate#FlushBuffer() | endif + +augroup END "}}}