File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ execute "command! -nargs=* TaskWikiTags :" . g:taskwiki_py . "SplitTa
6666" Commands that operate on tasks in the buffer
6767execute " command! -range TaskWikiInfo :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().info()"
6868execute " command! -range TaskWikiOpen :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().open()"
69+ execute " command! -range TaskWikiNote :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().note()"
6970execute " command! -range TaskWikiEdit :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().edit()"
7071execute " command! -range TaskWikiLink :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().link()"
7172execute " command! -range TaskWikiGrid :<line1>,<line2>" . g: taskwiki_py . " SelectedTasks().grid()"
@@ -121,6 +122,7 @@ if !exists('g:taskwiki_suppress_mappings')
121122 nnoremap <silent> <buffer> <LocalLeader> ha :TaskWikiHistoryAnnual<CR>
122123 nnoremap <silent> <buffer> <LocalLeader> i :TaskWikiInfo<CR>
123124 nnoremap <silent> <buffer> <LocalLeader> o :TaskWikiOpen<CR>
125+ nnoremap <silent> <buffer> <LocalLeader> n :TaskWikiNote<CR>
124126 nnoremap <silent> <buffer> <LocalLeader> l :TaskWikiLink<CR>
125127 nnoremap <silent> <buffer> <LocalLeader> m :TaskWikiMod<CR>
126128 nnoremap <silent> <buffer> <LocalLeader> p :TaskWikiProjects<CR>
Original file line number Diff line number Diff line change 66import six
77import sys
88import vim # pylint: disable=F0401
9+ import subprocess
910
1011# Insert the taskwiki on the python path
1112BASE_DIR = vim .eval ("s:plugin_path" )
@@ -126,12 +127,27 @@ def info(self):
126127 @errors .pretty_exception_handler
127128 def open (self ):
128129 for vimwikitask in self .tasks :
129- if "Notes" in [
130+ for annotation in vimwikitask .task ["annotations" ]:
131+ annotation = annotation ["description" ]
132+ proc = subprocess .Popen (["xdg-open" , annotation ])
133+ try :
134+ proc .wait (0.3 )
135+ except subprocess .TimeoutExpired :
136+ return
137+
138+ print ("No compatible annotation found." )
139+
140+ @errors .pretty_exception_handler
141+ def note (self ):
142+ for vimwikitask in self .tasks :
143+ if "Notes" not in [
130144 a ["description" ] for a in vimwikitask .task ["annotations" ]
131145 ]:
132- note_path = "/home/nikos/.local/share/taskwarrior/notes/"
133- note_path += vimwikitask .task ["uuid" ] + ".md"
134- vim .command ("edit " + note_path )
146+ self .annotate ("Notes" )
147+
148+ note_path = "/home/nikos/.local/share/taskwarrior/notes/"
149+ note_path += vimwikitask .task ["uuid" ] + ".md"
150+ vim .command ("edit " + note_path )
135151
136152 @errors .pretty_exception_handler
137153 def edit (self ):
You can’t perform that action at this time.
0 commit comments