mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-20 01:03:06 +02:00
taskwiki: Add ChoosSplitTags command
This commit is contained in:
parent
4630c371ec
commit
dfaef302f1
2 changed files with 19 additions and 0 deletions
|
@ -40,6 +40,7 @@ command! -range -nargs=* TaskWikiAnnotate :<line1>,<line2>py SelectedTasks().ann
|
|||
|
||||
" Interactive commands
|
||||
command! -range TaskWikiChooseProject :<line1>,<line2>py ChooseSplitProjects("global").execute()
|
||||
command! -range TaskWikiChooseTag :<line1>,<line2>py ChooseSplitTags("global").execute()
|
||||
|
||||
" Meta commands
|
||||
command! TaskWikiInspect :py Meta().inspect_viewport()
|
||||
|
@ -57,6 +58,7 @@ nmap <silent><buffer> <Leader>tbd :TaskWikiBurndownDaily<CR>
|
|||
nmap <silent><buffer> <Leader>tbw :TaskWikiBurndownWeekly<CR>
|
||||
nmap <silent><buffer> <Leader>tbm :TaskWikiBurndownMonthly<CR>
|
||||
nmap <silent><buffer> <Leader>tcp :TaskWikiChooseProject<CR>
|
||||
nmap <silent><buffer> <Leader>tct :TaskWikiChooseTag<CR>
|
||||
nmap <silent><buffer> <Leader>tC :TaskWikiCalendar<CR>
|
||||
nmap <silent><buffer> <Leader>td :TaskWikiDone<CR>
|
||||
nmap <silent><buffer> <Leader>tD :TaskWikiDelete<CR>
|
||||
|
|
|
@ -479,6 +479,23 @@ class SplitTags(Split):
|
|||
vertical = True
|
||||
|
||||
|
||||
class ChooseSplitTags(CallbackSplitMixin, SplitTags):
|
||||
split_cursorline = True
|
||||
|
||||
def get_selected_tag(self):
|
||||
tag_re = re.compile(r'^(?P<name>[^\s]+)\s+[0-9]+$')
|
||||
match = tag_re.match(vim.current.line)
|
||||
|
||||
if match:
|
||||
return match.group('name')
|
||||
else:
|
||||
raise util.TaskWikiException("No tag selected.")
|
||||
|
||||
def callback(self):
|
||||
tag = self.get_selected_tag()
|
||||
self.selected.modify("+{0}".format(tag))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
WholeBuffer.update_from_tw()
|
||||
Meta().integrate_tagbar()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue