ftplugin: Only load the python plugin once

This makes opening wiki pages significantly faster and also prevents
clearing the entire cache every time.
This commit is contained in:
Tomas Janousek 2020-06-07 22:49:08 +02:00 committed by Tomas Babej
parent b722c29f9e
commit f3fe7aca21
3 changed files with 30 additions and 7 deletions

View file

@ -21,11 +21,17 @@ if exists("g:taskwiki_disable")
finish
endif
" Determine the plugin path
let s:plugin_path = escape(expand('<sfile>:p:h:h:h'), '\')
if !exists("g:did_python_taskwiki")
" Determine the plugin path
let s:plugin_path = escape(expand('<sfile>:p:h:h:h'), '\')
" Execute the main body of taskwiki source
execute g:taskwiki_pyfile . s:plugin_path . '/taskwiki/main.py'
" Execute the main body of taskwiki source
execute g:taskwiki_pyfile . s:plugin_path . '/taskwiki/main.py'
let g:did_python_taskwiki = 1
endif
execute g:taskwiki_py . "WholeBuffer.update_from_tw()"
augroup taskwiki
autocmd! * <buffer>