diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 849c024..13db4d3 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -6,11 +6,11 @@ endif " Check presence of the python support if has("python") - let s:py='py ' - let s:pyfile='pyfile ' + let g:taskwiki_py='py ' + let g:taskwiki_pyfile='pyfile ' elseif has("python3") - let s:py='py3 ' - let s:pyfile='py3file ' + let g:taskwiki_py='py3 ' + let g:taskwiki_pyfile='py3file ' else echoerr "Taskwiki requires Vim compiled with the Python support." finish @@ -26,11 +26,11 @@ let s:plugin_path = escape(expand(':p:h:h'), '\') " Run the measure parts first, if desired if exists("g:taskwiki_measure_coverage") - execute s:pyfile . s:plugin_path . '/taskwiki/coverage.py'" + execute g:taskwiki_pyfile . s:plugin_path . '/taskwiki/coverage.py'" endif " Execute the main body of taskwiki source -execute s:pyfile . s:plugin_path . '/taskwiki/main.py' +execute g:taskwiki_pyfile . s:plugin_path . '/taskwiki/main.py' augroup taskwiki autocmd! @@ -42,54 +42,54 @@ augroup taskwiki execute "autocmd BufWinEnter *.".expand('%:e')." silent! loadview" execute "autocmd BufWinEnter *.".expand('%:e')." silent! doautocmd SessionLoadPost *.".expand('%:e') endif - execute "autocmd BufEnter *.".expand('%:e')." :" . s:py . "cache.reset()" + execute "autocmd BufEnter *.".expand('%:e')." :" . g:taskwiki_py . "cache.reset()" augroup END " Global update commands -execute "command! -nargs=* TaskWikiBufferSave :" . s:py . "WholeBuffer.update_to_tw()" -execute "command! -nargs=* TaskWikiBufferLoad :" . s:py . "WholeBuffer.update_from_tw()" +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 :" . s:py . "SplitProjects().execute()" -execute "command! -nargs=* TaskWikiProjectsSummary :" . s:py . "SplitSummary().execute()" -execute "command! -nargs=* TaskWikiBurndownDaily :" . s:py . "SplitBurndownDaily().execute()" -execute "command! -nargs=* TaskWikiBurndownMonthly :" . s:py . "SplitBurndownMonthly().execute()" -execute "command! -nargs=* TaskWikiBurndownWeekly :" . s:py . "SplitBurndownWeekly().execute()" -execute "command! -nargs=* TaskWikiCalendar :" . s:py . "SplitCalendar().execute()" -execute "command! -nargs=* TaskWikiGhistoryAnnual :" . s:py . "SplitGhistoryAnnual().execute()" -execute "command! -nargs=* TaskWikiGhistoryMonthly :" . s:py . "SplitGhistoryMonthly().execute()" -execute "command! -nargs=* TaskWikiHistoryAnnual :" . s:py . "SplitHistoryAnnual().execute()" -execute "command! -nargs=* TaskWikiHistoryMonthly :" . s:py . "SplitHistoryMonthly().execute()" -execute "command! -nargs=* TaskWikiStats :" . s:py . "SplitStats().execute()" -execute "command! -nargs=* TaskWikiTags :" . s:py . "SplitTags().execute()" +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 :," . s:py . "SelectedTasks().info()" -execute "command! -range TaskWikiEdit :," . s:py . "SelectedTasks().edit()" -execute "command! -range TaskWikiLink :," . s:py . "SelectedTasks().link()" -execute "command! -range TaskWikiGrid :," . s:py . "SelectedTasks().grid()" -execute "command! -range TaskWikiDelete :," . s:py . "SelectedTasks().delete()" -execute "command! -range TaskWikiStart :," . s:py . "SelectedTasks().start()" -execute "command! -range TaskWikiStop :," . s:py . "SelectedTasks().stop()" -execute "command! -range TaskWikiDone :," . s:py . "SelectedTasks().done()" +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 -nargs=* TaskWikiSort :," . s:py . "SelectedTasks().sort()" -execute "command! -range -nargs=* TaskWikiMod :," . s:py . "SelectedTasks().modify()" -execute "command! -range -nargs=* TaskWikiAnnotate :," . s:py . "SelectedTasks().annotate()" +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 :," . s:py . "ChooseSplitProjects('global').execute()" -execute "command! -range TaskWikiChooseTag :," . s:py . "ChooseSplitTags('global').execute()" +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 :" . s:py . "Meta().inspect_viewport()" +execute "command! TaskWikiInspect :" . g:taskwiki_py . "Meta().inspect_viewport()" " Disable as VimwikiFollowLink if !hasmapto('VimwikiFollowLink') nmap NoVimwikiFollowLink VimwikiFollowLink endif -execute "nmap :" . s:py . "Mappings.task_info_or_vimwiki_follow_link()" +execute "nmap :" . g:taskwiki_py . "Mappings.task_info_or_vimwiki_follow_link()" " Leader-related mappings. Mostly t + nmap ta :TaskWikiAnnotate diff --git a/taskwiki/main.py b/taskwiki/main.py index 33aed42..6e4bdfe 100644 --- a/taskwiki/main.py +++ b/taskwiki/main.py @@ -392,7 +392,7 @@ class CallbackSplitMixin(object): # Remap to calling the callback and wiping the buffer vim.command( "nnoremap :" - + vim.vars['s:py'].decode() + + + vim.vars['taskwiki_py'].decode() + "callback = pickle.loads(" "vim.current.buffer.vars['taskwiki_callback']); " "callback.callback(); " diff --git a/taskwiki/util.py b/taskwiki/util.py index fcf535b..d384c0f 100644 --- a/taskwiki/util.py +++ b/taskwiki/util.py @@ -294,7 +294,7 @@ def show_in_split(lines, size=None, position="belowright", vertical=False, # Remove cursorline in original window if it was this split which set it if cursorline_activated_in_window is not None: vim.command("au BufLeave,BufDelete,BufWipeout " - + vim.vars['s:py'].decode() + + + vim.vars['taskwiki_py'].decode() + " vim.windows[{0}].options['cursorline']=False" .format(cursorline_activated_in_window))