Skip to content

Commit

Permalink
taskwiki: Integrate Tagbar seamleslly if available
Browse files Browse the repository at this point in the history
  • Loading branch information
tbabej committed Apr 2, 2015
1 parent 2842655 commit b294cb0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions taskwiki/taskwiki.py
@@ -1,11 +1,11 @@
from __future__ import print_function
import itertools
import os
import sys
import vim # pylint: disable=F0401

# Start measuring coverage if in testing
if vim.vars.get('taskwiki_measure_coverage'):
import os
import atexit
import coverage
coverage_path = os.path.expanduser('~/taskwiki-coverage/.coverage.{0}'.format(os.getpid()))
Expand All @@ -21,7 +21,8 @@ def save_coverage():
from tasklib.task import TaskWarrior, Task

# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
BASE_DIR = vim.eval("s:plugin_path")
sys.path.insert(0, os.path.join(BASE_DIR, 'taskwiki'))

import cache
import regexp
Expand Down Expand Up @@ -236,6 +237,19 @@ def inspect_viewport(self):
lines = template_formatted.splitlines()
util.show_in_split(lines)

def integrate_tagbar(self):
tagbar_available = vim.eval('exists(":Tagbar")') == '2'
if tagbar_available:
vim.vars['tagbar_type_vimwiki'] = {
'ctagstype': 'default',
'kinds': ['h:header', 'i:inside', 'v:viewport'],
'sro': '&&&',
'kind2scope': {'h':'header', 'v':'viewport'},
'sort': 0,
'ctagsbin': os.path.join(BASE_DIR, 'extra/vwtags.py'),
'ctagsargs': 'default'
}


class Split(object):
command = None
Expand Down Expand Up @@ -363,3 +377,4 @@ class SplitTags(Split):

if __name__ == '__main__':
WholeBuffer.update_from_tw()
Meta().integrate_tagbar()

0 comments on commit b294cb0

Please sign in to comment.