Update the TOC *before* the file is written, not after
otherwise, Vim behaves strange
This commit is contained in:
parent
d8853c5a34
commit
bc0f310889
@ -627,19 +627,19 @@ nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
|||||||
" KEYBINDINGS }}}
|
" KEYBINDINGS }}}
|
||||||
|
|
||||||
" AUTOCOMMANDS {{{
|
" AUTOCOMMANDS {{{
|
||||||
function! s:toc_html()
|
if VimwikiGet('auto_export')
|
||||||
if VimwikiGet('auto_toc')
|
" Automatically generate HTML on page write.
|
||||||
call vimwiki#base#table_of_contents(0)
|
|
||||||
endif
|
|
||||||
if VimwikiGet('auto_export')
|
|
||||||
call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
|
||||||
\ expand('%'))
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if VimwikiGet('auto_export') || VimwikiGet('auto_toc')
|
|
||||||
augroup vimwiki
|
augroup vimwiki
|
||||||
au BufWritePost <buffer> call s:toc_html()
|
au BufWritePost <buffer>
|
||||||
|
\ call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||||
|
\ expand('%'))
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
if VimwikiGet('auto_toc')
|
||||||
|
" Automatically update the TOC *before* the file is written
|
||||||
|
augroup vimwiki
|
||||||
|
au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
" AUTOCOMMANDS }}}
|
" AUTOCOMMANDS }}}
|
||||||
|
Loading…
Reference in New Issue
Block a user