1
0
Fork 0
mirror of synced 2024-11-17 22:45:34 -05:00
ultimate-vim/sources_non_forked/markdown-preview.nvim/autoload/mkdp/autocmd.vim

23 lines
721 B
VimL
Raw Normal View History

2022-05-19 08:12:11 -04:00
" init preview key action
function! mkdp#autocmd#init() abort
execute 'augroup MKDP_REFRESH_INIT' . bufnr('%')
autocmd!
" refresh autocmd
if g:mkdp_refresh_slow
autocmd CursorHold,BufWrite,InsertLeave <buffer> call mkdp#rpc#preview_refresh()
else
autocmd CursorHold,CursorHoldI,CursorMoved,CursorMovedI <buffer> call mkdp#rpc#preview_refresh()
endif
" autoclose autocmd
if g:mkdp_auto_close
autocmd BufHidden <buffer> call mkdp#rpc#preview_close()
endif
" server close autocmd
autocmd VimLeave * call mkdp#rpc#stop_server()
augroup END
endfunction
function! mkdp#autocmd#clear_buf() abort
execute 'autocmd! ' . 'MKDP_REFRESH_INIT' . bufnr('%')
endfunction