commit ab9c51af18fb9780cd01ebc357eb62bbcfa41171 Author: Tomas Babej Date: Thu Dec 4 23:58:17 2014 +0100 Initial commit diff --git a/autoload/vimwiki_pytasks.py b/autoload/vimwiki_pytasks.py new file mode 100644 index 0000000..4bb24bf --- /dev/null +++ b/autoload/vimwiki_pytasks.py @@ -0,0 +1,52 @@ +import vim +import re +from tasklib import task + +""" +How this plugin works: + + 1.) On startup, it reads all the tasks and syncs info TW -> Vimwiki file. Task is identified by their + uuid. + 2.) When saving, the opposite sync is performed (Vimwiki -> TW direction). + a) if task is marked as subtask by indentation, the dependency is created between +""" + +INCOMPLETE_TASK_REGEXP = ( + "\v\* \[[^X]\].*" # any amount of whitespace followed by uncompleted square + # Any of the following: + "(\(\d{4}-\d\d-\d\d( \d\d:\d\d)?\)" # Timestamp + "|#TW\s*$" # Task indicator (insert this to have the task added) + "|#[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})" # Task UUID +) + +TASK_REGEXP = '#TW' + +tw = task.TaskWarrior() + +class Random(object): + attr = 'Ta dpc' + +r = Random() + +def get_task(uuid): + return tw.tasks.get(uuid=uuid) + +def load_tasks(): + valid_tasks = [line for line in vim.current.buffer if re.search(TASK_REGEXP, line)] + + for line in valid_tasks: + vim.command('echom "%s"' % line) + + r.attr = 'Whoohoooo' + +def RandomExample(): + vim.command('echom "volame daco"') + vim.command('echom "%s"' % r.attr) + +def RandomExample3(): + r.attr = r.attr + 'XO' + vim.command('echom "Random example 3"') + +if __name__ == '__main__': + load_tasks() + diff --git a/autoload/vimwiki_pytasks.vim b/autoload/vimwiki_pytasks.vim new file mode 100644 index 0000000..4181201 --- /dev/null +++ b/autoload/vimwiki_pytasks.vim @@ -0,0 +1,11 @@ +function! vimwiki_pytasks#RandomExample() + python RandomExample() +endfunction + +function! vimwiki_pytasks#RandomExample3() + python RandomExample3() +endfunction + +function! vimwiki_pytasks#RandomExample2() + echom "This is random example 2" +endfunction diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim new file mode 100644 index 0000000..1c596b7 --- /dev/null +++ b/ftplugin/vimwiki.vim @@ -0,0 +1,3 @@ +let s:plugin_path = escape(expand(':p:h'), '\') + +exe 'pyfile ' . s:plugin_path . '/../autoload/vimwiki_pytasks.py'