Use buffer specific autocmds

This commit is contained in:
Karl Yngve Lervåg 2016-02-07 21:26:03 +01:00
parent 9c3d0fbcd4
commit ec7d682280

View File

@ -15,15 +15,6 @@ endfunction
function! vimtex#motion#init_script() " {{{1
if !g:vimtex_motion_enabled | return | endif
" Highlight matching delimiters ($, (), ...)
if g:vimtex_motion_matchparen
augroup vimtex_motion
autocmd!
autocmd! CursorMoved *.tex call s:highlight_matching_pair()
autocmd! CursorMovedI *.tex call s:highlight_matching_pair()
augroup END
endif
"
" Define patterns used by motion.vim
"
@ -56,6 +47,15 @@ endfunction
function! vimtex#motion#init_buffer() " {{{1
if !g:vimtex_motion_enabled | return | endif
" Highlight matching delimiters ($, (), ...)
if g:vimtex_motion_matchparen
augroup vimtex_motion
autocmd!
autocmd! CursorMoved <buffer> call s:highlight_matching_pair()
autocmd! CursorMovedI <buffer> call s:highlight_matching_pair()
augroup END
endif
" Utility map to avoid conflict with "normal" command
nnoremap <buffer> <sid>(v) v
nnoremap <buffer> <sid>(V) V