" Check VIM version if version < 704 echoerr "Taskwiki requires at least Vim 7.4. Please upgrade your environment." finish endif " Python version detection. if has("nvim") let g:taskwiki_py='py3 ' let g:taskwiki_pyfile='py3file ' elseif has("python3") && ! exists("g:taskwiki_use_python2") let g:taskwiki_py='py3 ' let g:taskwiki_pyfile='py3file ' elseif has("python") let g:taskwiki_py='py ' let g:taskwiki_pyfile='pyfile ' else echoerr "Taskwiki requires Vim compiled with the Python support." finish endif " Disable taskwiki if taskwiki_disable variable set if exists("g:taskwiki_disable") finish endif " Determine the plugin path let s:plugin_path = escape(expand(':p:h:h:h'), '\') " Execute the main body of taskwiki source execute g:taskwiki_pyfile . s:plugin_path . '/taskwiki/main.py' augroup taskwiki autocmd! " Update to TW upon saving execute "autocmd BufWrite *.".expand('%:e')." TaskWikiBufferSave" " Save and load the view to preserve folding, if desired if !exists('g:taskwiki_dont_preserve_folds') execute "autocmd BufWinLeave *.".expand('%:e')." mkview" execute "autocmd BufWinEnter *.".expand('%:e')." silent! loadview" execute "autocmd BufWinEnter *.".expand('%:e')." silent! doautocmd SessionLoadPost *.".expand('%:e') endif execute "autocmd BufEnter *.".expand('%:e')." :" . g:taskwiki_py . "cache.load_current().reset()" augroup END " Global update commands execute "command! -nargs=* TaskWikiBufferSave :" . g:taskwiki_py . "WholeBuffer.update_to_tw()" execute "command! -nargs=* TaskWikiBufferLoad :" . g:taskwiki_py . "WholeBuffer.update_from_tw()" " Split reports commands execute "command! -nargs=* TaskWikiProjects :" . g:taskwiki_py . "SplitProjects().execute()" execute "command! -nargs=* TaskWikiProjectsSummary :" . g:taskwiki_py . "SplitSummary().execute()" execute "command! -nargs=* TaskWikiBurndownDaily :" . g:taskwiki_py . "SplitBurndownDaily().execute()" execute "command! -nargs=* TaskWikiBurndownMonthly :" . g:taskwiki_py . "SplitBurndownMonthly().execute()" execute "command! -nargs=* TaskWikiBurndownWeekly :" . g:taskwiki_py . "SplitBurndownWeekly().execute()" execute "command! -nargs=* TaskWikiCalendar :" . g:taskwiki_py . "SplitCalendar().execute()" execute "command! -nargs=* TaskWikiGhistoryAnnual :" . g:taskwiki_py . "SplitGhistoryAnnual().execute()" execute "command! -nargs=* TaskWikiGhistoryMonthly :" . g:taskwiki_py . "SplitGhistoryMonthly().execute()" execute "command! -nargs=* TaskWikiHistoryAnnual :" . g:taskwiki_py . "SplitHistoryAnnual().execute()" execute "command! -nargs=* TaskWikiHistoryMonthly :" . g:taskwiki_py . "SplitHistoryMonthly().execute()" execute "command! -nargs=* TaskWikiStats :" . g:taskwiki_py . "SplitStats().execute()" execute "command! -nargs=* TaskWikiTags :" . g:taskwiki_py . "SplitTags().execute()" " Commands that operate on tasks in the buffer execute "command! -range TaskWikiInfo :," . g:taskwiki_py . "SelectedTasks().info()" execute "command! -range TaskWikiEdit :," . g:taskwiki_py . "SelectedTasks().edit()" execute "command! -range TaskWikiLink :," . g:taskwiki_py . "SelectedTasks().link()" execute "command! -range TaskWikiGrid :," . g:taskwiki_py . "SelectedTasks().grid()" execute "command! -range TaskWikiDelete :," . g:taskwiki_py . "SelectedTasks().delete()" execute "command! -range TaskWikiStart :," . g:taskwiki_py . "SelectedTasks().start()" execute "command! -range TaskWikiStop :," . g:taskwiki_py . "SelectedTasks().stop()" execute "command! -range TaskWikiDone :," . g:taskwiki_py . "SelectedTasks().done()" execute "command! -range TaskWikiRedo :," . g:taskwiki_py . "SelectedTasks().redo()" execute "command! -range -nargs=* TaskWikiSort :," . g:taskwiki_py . "SelectedTasks().sort()" execute "command! -range -nargs=* TaskWikiMod :," . g:taskwiki_py . "SelectedTasks().modify()" execute "command! -range -nargs=* TaskWikiAnnotate :," . g:taskwiki_py . "SelectedTasks().annotate()" " Interactive commands execute "command! -range TaskWikiChooseProject :," . g:taskwiki_py . "ChooseSplitProjects('global').execute()" execute "command! -range TaskWikiChooseTag :," . g:taskwiki_py . "ChooseSplitTags('global').execute()" " Meta commands execute "command! TaskWikiInspect :" . g:taskwiki_py . "Meta().inspect_viewport()" " Disable as VimwikiFollowLink if !hasmapto('VimwikiFollowLink') nmap NoVimwikiFollowLink VimwikiFollowLink endif execute "nnoremap :" . g:taskwiki_py . "Mappings.task_info_or_vimwiki_follow_link()" " Leader-related mappings. Mostly t + nmap ta :TaskWikiAnnotate nmap tbd :TaskWikiBurndownDaily nmap tbw :TaskWikiBurndownWeekly nmap tbm :TaskWikiBurndownMonthly nmap tcp :TaskWikiChooseProject nmap tct :TaskWikiChooseTag nmap tC :TaskWikiCalendar nmap td :TaskWikiDone nmap tD :TaskWikiDelete nmap te :TaskWikiEdit nmap tg :TaskWikiGrid nmap tGm :TaskWikiGhistoryMonthly nmap tGa :TaskWikiGhistoryAnnual nmap thm :TaskWikiHistoryMonthly nmap tha :TaskWikiHistoryAnnual nmap ti :TaskWikiInfo nmap tl :TaskWikiLink nmap tm :TaskWikiMod nmap tp :TaskWikiProjects nmap ts :TaskWikiProjectsSummary nmap tS :TaskWikiStats nmap tt :TaskWikiTags nmap t. :TaskWikiRedo nmap t+ :TaskWikiStart nmap t- :TaskWikiStop " Mappings for visual mode. vmap ta :TaskWikiAnnotate vmap tcp :TaskWikiChooseProject vmap tct :TaskWikiChooseTag vmap td :TaskWikiDone vmap tD :TaskWikiDelete vmap te :TaskWikiEdit vmap tg :TaskWikiGrid vmap ti :TaskWikiInfo vmap tl :TaskWikiLink vmap tm :TaskWikiMod vmap t. :TaskWikiRedo vmap t+ :TaskWikiStart vmap t- :TaskWikiStop