blakesweeney / unite-taskwarrior

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

g:unite_taskwarrior_use_taskwiki = 1 #36

Open linuxcaffe opened 9 years ago

linuxcaffe commented 9 years ago

unite-taskwarrior shares the vim/taskwarrior space with two other established projects; taskwiki and vim-taskwarrior, and a user who installs one might install more than one. This "issue" is to discuss ways to make that more seamless and advantageous with taskwiki. (more on vim-taskwarrior elsewhere)

some of these behaviors only make sense if the other projects are installed, so using those features could be made optional with a config;

g:unite_taskwarrior_use_taskwiki=1
g:unite_taskwarrior_use_vim-taskwarrior=1
  1. taskwiki format taskwiki displays tasks in a format based on vimwiki tasks. If Utw can (optionally) render tasks in this format, any tasks printed to a file will become "live" entries, maintained by taskwiki. Also, tasks in this format can be highlighted using taskwiki and vimwiki syntax. I'm not suggesting that utw would then always use taskwiki format, just where advantageous. That format looks like:
    * [ ] Do this important task(DUE DATE)  #UUID_SHORT

as well, utw/taskwiki use the "[ ]" symbol differently, utw with [-] [+] and taskwiki with [X] [D] [S] so some "harmonization" need to take place between the two projects, so all of this info can be displayed in either one. (I have ideas ;-)

  1. wiki action; when a task is selected, a new action is available "wiki" which opens the appropriate wiki-file, based on a simple formula.
  2. On creation of a tasknote, as in the bottom of #10 , inserting a taskwiki-formatted task, as first line of the tasknote, would super-charge it.

There are probably other things that I think would make utw taskwiki-compatible, but I can't think of any :)

linuxcaffe commented 9 years ago

suggestion: start a "taskwiki" branch, were we might try some of this, without exploding the existing functionality

regarding "taskwiki-formatted" (which is inescapably "vimwiki-formatted") one obvious change is the leading "* " before "[ ]".

Interestingly using "- [ ] " or "+ [ ] " or "# [ ] " is valid vimwiki-todo-syntax, but not taskwiki-task-format.

I'm imagining that for starters utw could adopt "* [ ] " for a normal task.

I've put in an RFE at https://github.com/tbabej/taskwiki/issues/79 to use "- [ ]" to indicate recurrent-parent tasks, which could also replace utw's current use of "[+]"

linuxcaffe commented 9 years ago

If I understand correctly, any vimwiki/ taskwiki syntax/behaviors will not affect a utw listing, because it's not a vimwiki-filetype, right? This is good because a unite-tw list has it's own rules. It's only where a utw list is read into a file, or on preview, that the ft:vimwiki rules apply.

.. I'm basically proving how little I know about it :) just hoping that syntax similarities aren't necessarily in conflict.

blakesweeney commented 9 years ago

I like the idea of integrating with other tools. The reason I choose to use unite and the like is that it is a key part of my workflow and using it for managing tasks has a whole host of advantages.

Much of your suggestions are about displaying it seems. Lets start by talking about formatting in general. There are two different kinds of formatting that this does. The first is formatting for display in the unite buffer and the second is formatting for the notes file. They are different things and we can use different styles for each. I format the header lines of my notes to be a markdown style header, while the display in unite is the default formatting (I use tags a lot in my workflow).

Formatting in the unite buffer probably won't help integration with taskwiki as unite buffers have the unite filetype. I also unclear if unite respects external keybindings. Formatting the things in note files however would be a great way to integrate. I know that right now I don't have a very good taskwiki style formatting and that should be easy to change.

Ok on to your specific suggestions:

  1. A flag to make display and note formatting use the same predefinied style is very doable. We just need to define the style and write a function for creating it.
  2. The action to open a wiki file is doable as well, though you'll need to explain how we find it. I'm guessing it is similar to how we find and open notes.
  3. I think this would be covered by 1.

And yes using a distinct branch would be key to this I think.

linuxcaffe commented 9 years ago

Very cool Blake, I think we're on the same page.

1. I like that Unite and taskwiki can have different display formatting, Utw will probably be 
the more configurable of the two, The only place(s) I would want Utw to use the taskwiki format 
is when tasks are read into a buffer, like the top line of a tasknote, or to populate 
a taskwiki page.
2. Opening the appropriate wiki page (in my world, which I hope to share) is;
2.1. if a task has a wiki-back-link (an annotation with "wiki: path/to/file.wiki", a feature of 
taskwiki) then go to that, else,
2.2 if a task has a project, go to $WIKIDIR/project/project-name.project.wiki, else
2.3, if a task has no backlink or project, open $WIKIDIR/index.wiki
3. I agree
blakesweeney commented 9 years ago

So the opening of wiki files if the task has one is easy enough and I can jus do that on dev. The formatting changes are actually a bit of a bigger deal (we already have options and code for that and this will break them) so I'm doing that on a different branch. The branch is feature/formatting. I'm push it now but it may not yet be working. I'll let you know when it is usable.

blakesweeney commented 9 years ago

Well I think I have worked through the major issues for formatting. You should be able to set `unite_taskwarrior_use_taskwiki and it will format tasks in unite and for notes using taskwiki style. For some reason the travis tests are failing. I haven't yet tracked down that issue but things may work for you. Try it out and let me know what you think.

linuxcaffe commented 9 years ago

For starters I;m wild about the tags display, love it!, and the 80col default works fine for me. It actually leaves a nice big blank spot on the right, which gives me an idea; What about a 60/40 -auto-preview -no-spit with the regular (new-and-improved) unite list on the left 60%, and the selected task's info report on the right.

I keep describing the same layout for different things; unite task list -- task on the left -- info preview on the right notes first-line-list on left -- note preview on right annotations -- tasks-with-annotations on left -- annotation preview on right

and here's another idea related to this left/ right -auto-preview nonsense; I notice that a commonly available action is "left" and "right", I wonder if the left/ right arrow keys could be mapped to the action? From a task list the right-arrow could open an auto-preview window (if it wasn't already open) or hop back and forth, selecting, listing and editing. .. just a navigation idea :)

that consistency is a good thing, right?

The taskwiki-format-as-first-line-of-notefile thing is not working for me, I'm still seeing just description-as-first-line,

linuxcaffe commented 9 years ago

I take it back! after setting the config, I get taskwiki-format in list (yuk) and in notefile (yay)

For me I'd almost never prefer taskwiki-format over unite-tw list, (except when in a taskwiki)

blakesweeney commented 9 years ago

So if you only want taskwiki formatting in a note then you can do:

let g:unite_taskwarrior_note_formatter = 'unite#taskwarrior#formatters#taskwiki'

" This is the default, but just to be clear you should not have it on
let g:unite_taskwarrior_use_taskwiki = 0

This will leave the standard formatting in the list view and have taskwiki formatting in the notes files.

As for the previewing stuff, you can bind the autopreview action. For example, in your ftplugin/unite.vim:

nmap <buffer>    <C-J>    <Plug>(unite_toggle_auto_preview)

Will bind <C-J> to toggling autopreview. You can use <LEFT> instead I imagine. This kind of setup is a useful sort of thing that should probably be documented in the wiki, but I think all the functionality exists.

linuxcaffe commented 9 years ago

Ok, so that note_formatter config worked just dandy, and I think that should be default behavior with unite_taskwarrior_use_taskwiki = 1. In other words, "use taskwiki" shouldn't take over the unite-tasklist, but might just affect;

as to arrow-keys toggling previews, I think we can just keep collecting handy snippets in the wiki, and anything that proves itself solid and "must have" we can bake into the defaults.

linuxcaffe commented 9 years ago

that means that if use_taskwiki = 0, the first line of a notefile should be (imho) a unite_tw#format task, not just the description; even more informative!

blakesweeney commented 9 years ago

Ok I've made the change so that this no longer will use a taskwiki formatting when use_taskwiki is set. What other things should this do? Some ideas are:

  1. Make the yank action copy using the taskwiki formatting. I think this will help with your idea of inserting the task into a file.
  2. Make open look up the taskwiki entry as described above. Side note, there is a wiki action which will open the taskwiki file using the system you described above.

As for adding the sorting definitions, I think I can add a sorter that uses taskwiki style sorting definitions. Does taskwiki have a default sorting if no specific one is defined?

linuxcaffe commented 9 years ago
  1. brilliant

2.Here's a key think about taskwiki; it's an enhancement of vimwiki, and that means several relevant configs are vimwiki configs, like the wiki location(s). Thiis means that the "correct" setting (to look up) for the wikiroot location, is (vimwiki.txt) 12.1 Registered Wiki g:vimwiki_list vimwiki-register-wiki . I'm not currently using that, I'm using ~/.task/wiki/ . I think nailing down the "proper" search path here, will take some experimentation.

As for sorting; hell yes! I;m not sure the default taskwiki sort is, I'll dig that up

linuxcaffe commented 9 years ago

Using a very fresh development build, I tried use_taskwiki = 0 and 1, and I noticed that either way, a taskwiki#format task was inserted in a new notefile.

use_taskwiki = 0 should result in a utw#formatted task being inserted as first line of notefile. (and it should logically have a leading "+")

blakesweeney commented 9 years ago

I have:

let g:unite_taskwarrior_use_taskwiki = 1

as a flag to indicate that utw should use taskwiki style formatting and it seems to work. What are your settings?

linuxcaffe commented 9 years ago

I think we agree about the meaning. What I'm saying is that with use_taskwiki = 0, new notefiles still get a taskwiki#fmt task inserted, instead of a utw#fmt task.

blakesweeney commented 9 years ago

Oh, do you have your notes formatter (g:unite_taskwarrior_note_formatter) set to taskwiki format? If you have that set as well it will use that formatting for notes?

linuxcaffe commented 9 years ago

oh, yes I do..

linuxcaffe commented 9 years ago

OK, now, with use_taskwiki = 0, I'm no longer seeing a taskwiki fmt task inserted, I'm seeing just the description, the way it was, good!

.. but could be better :) I was thinking (and expected you to read my mind) was that now we've got a really, nice utw fmt task going, we should insert THAT(utw task) , instead of just description, when use_taskwiki = 0 and opening a new tasknote

AND (new idea) whenever pasting a utw#fmt task, let's steal a nugget from taskwiki, and append a concealed #UUID-SHORT (we'll figure out how to use it later) and that would include the first line of a tasknote (where use_taskwiki = 0).

blakesweeney commented 9 years ago

Ok, I can just change the default for the notes formatting to match the task formatter. Easy enough.

blakesweeney commented 9 years ago

Note formatting should use the new format by default. If it does not let me know. One idea I've had is to remove the truncation for notes only. Anyway, let me know if all is working for you.