def set_proper_colors(self): tw_color_counterparts = { 'TaskWikiTaskActive': 'color.active', 'TaskWikiTaskCompleted': 'color.completed', 'TaskWikiTaskDeleted': 'color.deleted', } taskwiki_native_colors = { 'TaskWikiTaskActive': 'Type', 'TaskWikiTaskCompleted': 'Comment', 'TaskWikiTaskDeleted': 'Error', 'TaskWikiTaskPriority': 'Error', } # If tw support is enabled, try to find definition in TW first if vim.vars.get('taskwiki_source_tw_colors'): tw = cache.get_relevant_tw() for syntax in tw_color_counterparts.keys(): tw_def = tw.config.get(tw_color_counterparts[syntax]) if tw_def: vim_def = util.convert_colorstring_for_vim(tw_def) vim.command('hi def {0} {1}'.format(syntax, vim_def)) # Define taskwiki (native) color. This can be overriden by user # by using :hi <group name> <color> command. for syntax in taskwiki_native_colors.keys(): vim.command('hi def link {0} {1}' .format(syntax, taskwiki_native_colors[syntax]))
def __init__(self): self.tw = cache.get_relevant_tw() # Reset cache, otherwise old line content may be used cache.reset() # Load the current tasks range_tasks = [cache[i] for i in util.selected_line_numbers()] self.tasks = [t for t in range_tasks if t is not None] if not self.tasks: print("No tasks selected.")
def __init__(self, args): self.args = [] self.tw_extra_args = util.tw_modstring_to_args(args) self.split_name = self.split_name or self.command self.tw = cache.get_relevant_tw()
def __init__(self, args): self.args = self._process_args(args) self.split_name = self.split_name or self.command self.tw = cache.get_relevant_tw()