Delete autocommands when Bootstrap failed

When bootstrapping fails to setup `g:_uspy` (e.g. without Python),
the functions used in the autocommands are not being defined.

Since it makes no sense to have autocommands defined for UltiSnips in this
case, this patch deletes them (via a new augroup 'UltiSnips').
This commit is contained in:
Daniel Hahler 2014-04-09 19:04:30 +02:00
parent 2ad6ad4493
commit c57c717e33
2 changed files with 11 additions and 4 deletions

View File

@ -16,6 +16,10 @@ endfunction
call UltiSnips#bootstrap#Bootstrap()
if !exists("g:_uspy")
" Delete the autocommands defined in plugin/UltiSnips.vim.
augroup UltiSnips
au!
augroup END
finish
end

View File

@ -57,10 +57,13 @@ function! UltiSnips_Anon(...)
return call(function('UltiSnips#Anon'), a:000)
endfunction
au CursorMovedI * call UltiSnips#CursorMoved()
au CursorMoved * call UltiSnips#CursorMoved()
au BufLeave * call UltiSnips#LeavingBuffer()
au InsertLeave * call UltiSnips#LeavingInsertMode()
augroup UltiSnips
au!
au CursorMovedI * call UltiSnips#CursorMoved()
au CursorMoved * call UltiSnips#CursorMoved()
au BufLeave * call UltiSnips#LeavingBuffer()
au InsertLeave * call UltiSnips#LeavingInsertMode()
augroup END
call UltiSnips#map_keys#MapKeys()