mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
commands: Implement the TaskWikiLink command
This commit is contained in:
parent
e263d24aaa
commit
5e9f187bab
3 changed files with 8 additions and 0 deletions
|
@ -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()
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue