blakesweeney / unite-taskwarrior

A unite.vim interface to taskwarrior
6 stars 2 forks source link

syntax hilighting #18

Open linuxcaffe opened 9 years ago

linuxcaffe commented 9 years ago

How about a splash of color?

Using [ ] or [+] or [?] for status-colors, and using prefixes or indentation to color tags and projects, could make the list more pleasing to look at, easier to read.

Taskwiki uses https://github.com/powerman/vim-plugin-AnsiEsc to pull task-native colors, maube unite-tw could do something like that?

blakesweeney commented 9 years ago

This is on my todo list for sure. There is some stuff with annotations, dependencies and context that I want to work through first. I'm not very familiar with syntax highlighting in vim so I'll have to look into it. If it's easy I'll do it soon (as it would make things much easier to read) otherwise it will have to wait.

linuxcaffe commented 9 years ago

I'm certainly no vim syntax expert, but I have seen 2 excellent examples of vim-syntax for task, and that's vim-taskwarrior and taskwiki. They both do it differently, but between them there are fine examples, and both developers are available for comment.

linuxcaffe commented 9 years ago

AND, it's a nice-to-have feature, but not critical, so it takes as long as it takes ;-)

blakesweeney commented 9 years ago

Thanks for the advice!

linuxcaffe commented 9 years ago

vim-taskwarrior does it well by simply mapping field to syntax-element, taskwiki goes one step further, and can use active taskwarrior-theme colors, for charts and some fields, with the help of https://github.com/powerman/vim-plugin-AnsiEsc

linuxcaffe commented 9 years ago

I just discovered taskwarrior/cmd minimal (or any other report) and wow! awesome! I think this is one of the places where taskwiki uses the AnsiEsc plugin. (although taskwiki can't currently display reports other than "charts")

linuxcaffe commented 9 years ago

I only see color codes for the list header, it might be better to eliminate those codes, if AnsiEsc is not present.

linuxcaffe commented 9 years ago

There are 3 sub-groups of color that Utw might encounter;

  1. color-codes that come with charts or reports (strip out or use AnsiEsc)
  2. condition mapped to defined colors from task theme (like +OVERDUE)
  3. per-field coloring, mapped to syntax-highlight-groups (like vim-taskwarrior)

wrt # 1, easiest? wrt # 2, hardest! wrt # 3, here are some ideas for mapping fields to highlight element;

blakesweeney commented 9 years ago

The fact that color shows up when using taskwarrior/cmd is a happy accident actually. I probably would've stripped it out if I noticed it. When I was thinking of colors I was thinking of 3. Though maybe the first is pretty easy to do.

linuxcaffe commented 9 years ago

(making notes and thinking out loud)

Sources of color/ highlighting in relation to tasklists (not previews);

  1. taskwarrior color codes --> AnsiEsc These codes are mostly seen in taskwarrior report's and charts, and not typically seen in utw#fmt tasklists. They are mostly whole-line-based. Taskwiki can highlight based on the [X], [D], [R] symbols, and sources colors from .taskrc (task _get:rc.color.completed). To see the available color rules run 'task show color.' .I imagine that because these color are applied to the whole line, then if combined with other color sources, tw_colors would be applied first, as the background.
  2. vim-taskwarrior (somehow msgically) maps task-attributes to vim-syntax-names, some colorthemes work better than others. These could (should) be applied to projects, tags, description, annotations and any other attribute field, based on screen positioning (?) This may be one case where the heavy-lifting is done by vim-tw, field colorization dependent on use_vim-tw = 1, or the function could be re-implemented.. sharing configuration means that going back and forth between utw and vim-tw will have great continuity, in whatever colorscheme,
  3. use_taskwiki also means use vimwiki, and applying vimwiki syntax hilighting to the unite tasklist could really spice it up with wiki goodness, Taskwiki itself doesn't offer any other hilighting beyond vimwiki and AnsiEsc. Taskwiki also has a taskwiki_source_tw_colors function.
blakesweeney commented 9 years ago

Some of this may be doable before 1.1 but I don't want to hold off on a release candidate.