Added VimtexReload - easier vimtex development
This commit is contained in:
parent
ab5ed0ff13
commit
ce6f423e7a
@ -146,6 +146,32 @@ function! vimtex#wordcount(detailed) " {{{1
|
||||
highlight link TexcountValue Constant
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
" {{{1 function! vimtex#reload()
|
||||
let s:file = expand('<sfile>')
|
||||
|
||||
if !exists('s:reloading_script')
|
||||
function! vimtex#reload()
|
||||
let s:reloading_script = 1
|
||||
|
||||
let l:scripts = [s:file]
|
||||
\ + map(copy(s:modules),
|
||||
\ 'fnamemodify(s:file, '':h'') . ''/vimtex/'' . v:val . ''.vim''')
|
||||
|
||||
for l:file in l:scripts
|
||||
execute 'source' l:file
|
||||
endfor
|
||||
|
||||
let s:initialized = 0
|
||||
call vimtex#init()
|
||||
|
||||
call vimtex#echo#formatted([
|
||||
\ 'vimtex: ', ['VimtexWarning', 'reloaded']])
|
||||
|
||||
unlet s:reloading_script
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" }}}1
|
||||
|
||||
|
||||
@ -255,10 +281,12 @@ function! s:init_buffer() " {{{1
|
||||
" Define commands
|
||||
command! -buffer -bang VimtexInfo call vimtex#info(<q-bang> == "!")
|
||||
command! -buffer -bang VimtexWordCount call vimtex#wordcount(<q-bang> == "!")
|
||||
command! -buffer VimtexReload call vimtex#reload()
|
||||
|
||||
" Define mappings
|
||||
nnoremap <buffer> <plug>(vimtex-info) :call vimtex#info(0)<cr>
|
||||
nnoremap <buffer> <plug>(vimtex-info-full) :call vimtex#info(1)<cr>
|
||||
nnoremap <buffer> <plug>(vimtex-info) :VimtexInfo<cr>
|
||||
nnoremap <buffer> <plug>(vimtex-info-full) :VimtexInfo!<cr>
|
||||
nnoremap <buffer> <plug>(vimtex-reload) :VimtexReload<cr>
|
||||
|
||||
"
|
||||
" Attach autocommands
|
||||
@ -285,6 +313,7 @@ function! s:init_mappings() " {{{1
|
||||
|
||||
call s:map('n', '<localleader>li', '<plug>(vimtex-info)')
|
||||
call s:map('n', '<localleader>lI', '<plug>(vimtex-info-full)')
|
||||
call s:map('n', '<localleader>lx', '<plug>(vimtex-reload)')
|
||||
|
||||
call s:map('n', 'dse', '<plug>(vimtex-delete-env)')
|
||||
call s:map('n', 'dsc', '<plug>(vimtex-delete-cmd)')
|
||||
|
@ -82,9 +82,11 @@ function! vimtex#fold#init_buffer() " {{{1
|
||||
|
||||
function! s:fold_manual_refresh()
|
||||
call vimtex#fold#refresh('zx')
|
||||
if exists('b:fold_manual_augroup')
|
||||
execute 'autocmd!' b:fold_manual_augroup
|
||||
execute 'augroup!' b:fold_manual_augroup
|
||||
unlet b:fold_manual_augroup
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
endfunction
|
||||
|
@ -290,6 +290,7 @@ This feature is explained in more detail later, see |vimtex-imaps|.
|
||||
<localleader>lG |<plug>(vimtex-status-all)| `n`
|
||||
<localleader>lc |<plug>(vimtex-clean)| `n`
|
||||
<localleader>lC |<plug>(vimtex-clean-full)| `n`
|
||||
<localleader>lx |<plug>(vimtex-reload)| `n`
|
||||
dse |<plug>(vimtex-delete-env)| `n`
|
||||
dsc |<plug>(vimtex-delete-cmd)| `n`
|
||||
cse |<plug>(vimtex-change-env)| `n`
|
||||
@ -995,6 +996,11 @@ Commands~
|
||||
*<plug>(vimtex-reverse-search)*
|
||||
:VimtexRSearch Do reverse search (only available for MuPDF viewer).
|
||||
|
||||
*VimtexReload*
|
||||
*<plug>(vimtex-reload)*
|
||||
:VimtexReload Reload |vimtex| scripts. This is primarely useful
|
||||
when developing and debugging |vimtex| itself.
|
||||
|
||||
*VimtexWordCount*
|
||||
:VimtexWordCount Shows the number of words in the current project.
|
||||
The count is created with `texcount` through a call
|
||||
|
Loading…
Reference in New Issue
Block a user