commands: Implement the TaskWikiLink command

This commit is contained in:
Tomas Babej 2015-03-20 01:44:56 +01:00
parent e263d24aaa
commit 5e9f187bab
3 changed files with 8 additions and 0 deletions

View file

@ -8,3 +8,4 @@ augroup taskwiki
augroup END augroup END
command! TaskWikiInfo :py CurrentTask().info() command! TaskWikiInfo :py CurrentTask().info()
command! TaskWikiLink :py CurrentTask().link()

View file

@ -58,6 +58,10 @@ class CurrentTask(object):
info = self.tw.execute_command([self.task['uuid'], 'info']) info = self.tw.execute_command([self.task['uuid'], 'info'])
util.show_in_split(info) util.show_in_split(info)
def link(self):
path = util.get_absolute_filepath()
self.task.task.add_annotation("wiki: {0}".format(path))
print("Task \"{0}\" linked.".format(self.task['description']))
if __name__ == '__main__': if __name__ == '__main__':
update_from_tw() update_from_tw()

View file

@ -65,6 +65,9 @@ def parse_tw_arg_string(line):
return output return output
def get_absolute_filepath():
return vim.eval('expand("%:p")')
def get_current_line_number(): def get_current_line_number():
row, column = vim.current.window.cursor row, column = vim.current.window.cursor
return row - 1 return row - 1