commit b4b6de16a29c9b1886d4bfb3542e18a489bb6f1b Author: Buddy Sandidge Date: Wed Feb 19 21:50:03 2014 -0800 Squashed 'vim/bundle/taskpaper/' content from commit 2df291f7f git-subtree-dir: vim/bundle/taskpaper git-subtree-split: 2df291f7f40ef049d0a60151c66f11fa21b01e1c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9f1fe34 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +taskpaper.tar.gz: + tar zcvf taskpaper.tar.gz autoload/ doc/ ftplugin/ ftdetect/ syntax/ + +deploy: + rsync --exclude '*.sw?' -av autoload doc ftdetect ftplugin syntax $(HOME)/.vim diff --git a/README b/README new file mode 100644 index 0000000..e0e9386 --- /dev/null +++ b/README @@ -0,0 +1,302 @@ +taskpaper.txt For Vim version 6.0 Last change: 2012 March 13 + +David O'Callaghan + +13th March 2012 + +Introduction +============= + +*Latest version from https://github.com/davidoc/taskpaper.vim* + +From the TaskPaper website (): + +"TaskPaper is a simple to-do list application that helps you stay +organized. Unlike competing applications, TaskPaper is based on plain text +files which offer you paper-like simplicity and ease of use." + +TaskPaper is a to-do list application for Mac OS X based on the "Getting +Things Done" approach of David Allen (). It supports +the GTD notions of projects, tasks and contexts. + +This package contains a syntax file and a file-type plugin for the simple +format used by the TaskPaper application. It is intended for Mac users who +want to edit their TaskPaper lists in Vim from time to time (for example, in +a SSH session, or on a non-Mac system) and for anyone who is looking for a +simple to-do list format. + +Installation +============= + +It should be safe to simply unpack the package into your .vim directory. +It contains the following files: + + autoload/taskpaper.vim + doc/example.taskpaper + doc/taskpaper.txt + doc/taskpaper_licence.txt + ftdetect/taskpaper.vim + ftplugin/taskpaper.vim + syntax/taskpaper.vim + +To access this help file from within Vim you must first update your help +tags: + + :helptags ~/.vim/doc + +The path may need to be modified depending on where you install to. Once +you have done this you can access the help with this command: + + :help taskpaper + +Syntax +======= + +The syntax file highlights project headings and task contexts (tags), and +"greys out" completed tasks. The exact style of the displayed file depends +on your Vim colour scheme. + +A project heading is a piece of text ending in a colon. + +A task is a line beginning with a hyphen '-' and can have zero or more +context tags. + +A context tag has the form "@tag". + +Other text is considered as a "note" and is displayed as a Vim comment. + +File-type Plugin +================= + +The file-type plugin tries to make editing TaskPaper files in Vim more +comfortable. + +Vim can complete context names after the '@' using the keyword completion +commands (e.g. Ctrl-X Ctrl-N). + +The plugin defines some new mappings: + + \td Mark task as done + \tx Mark task as cancelled + \tt Mark task as today + \tD Archive @done items + \tX Show tasks marked as cancelled + \tT Show tasks marked as today + \t/ Search for items including keyword + \ts Search for items including tag + \tp Fold all projects + \t. Fold all notes + \tP Focus on the current project + \tj Go to next project + \tk Go to previous project + \tg Go to specified project + \tm Move task to specified project + +Note: if `` has been changed (e.g. `:let mapleader=",,"`) +then its value should be used instead of `\` in the mappings. + +Marking a task as done will add the "@done" context tag to the end of the +task, and it will be greyed out by the syntax file. + +To show all tasks with a particular context tag, type `\ts` and a tag name to +search. If you use the `\ts` command over the desired context tag, the tag +name is set as default value. This will fold all the irrelevant tasks leaving +only the tasks in the current context visible. + +To fold all top-level projects leaving only the headings visible use the `\tp` +command. Standard fold commands can be used to open (`zo`) and close (`zc`) +individual projects. + +To show all projects and tasks use the `zR` command. This disables folding so +that the entire file is expanded. + +To go to next or previous project use the `\tj` command or `\tk` command. To +go to a project you specify use the `\tg` command. You can complete project +names with on prompt. + +Configuration +============== + +The plugin supports a number of configuration variables, which can be set in +your .vimrc file. + +To change the default date format string used when marking a task complete, +define the `task_paper_date_format` variable. The format matches your system's +`strftime()` function. + +For example, to include the date and time in ISO8601 format: + + let g:task_paper_date_format = "%Y-%m-%dT%H:%M:%S%z" + +To change the default archive project name, define the +`task_paper_archive_project` variable. The default value is "Archive". + + let g:task_paper_archive_project = "Archive" + +By default, when you move a task, the cursor will follow that task to its new +location. To make the cursor stay in it's current location, change the +`task_paper_follow_move` variable. + + let g:task_paper_follow_move = 0 + +If you want to hide done tasks when searching you can change the +`task_paper_search_hide_done` variable. + + let g:task_paper_search_hide_done = 1 + +To set a custom style (colour, bold, etc.) for tags task_paper_styles variable, +which is a dictionary. + + let g:task_paper_styles={'wait': 'ctermfg=Blue guifg=Blue', 'FAIL': +'ctermbg=Red guibg=Red'} + +See |highlight-args| for a full description of the syntax. + + +File-type Detection +==================== + +This package also contains a script to automatically use the TaskPaper file +type for all files with the ".taskpaper" extension. + +Customize +========== + +You can create your own shortcut for tagging. To define your own shortcut, +write settings in ~/.vim/ftplugin/taskpaper.vim or ~/.vimrc. If you use the +.vimrc file, define settings like: + + function! s:taskpaper_setup() + " Your settings + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + endfunction + + augroup vimrc-taskpaper + autocmd! + autocmd FileType taskpaper call s:taskpaper_setup() + augroup END + +To add a tag without argument: + + nnoremap tn + \ :call taskpaper#add_tag('next', '') + +To delete a tag: + + nnoremap tN + \ :call taskpaper#delete_tag('next', '') + +To toggle a tag: + + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + +To add a tag with an argument: + + nnoremap tq + \ :call taskpaper#add_tag('priority') + +You can specify the priority value on prompt. + +To delete the priority tag with any argument: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '') + +To delete only the level 1 of priority tag: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '1') + +To toggle a tag with an argument: + + nnoremap tq + \ :call taskpaper#toggle_tag('priority') + +To update a tag (not delete if the tag exists): + + nnoremap tq + \ :call taskpaper#update_tag('priority') + +Licence +======== + +Copyright (C) 2007--2012 by David O'Callaghan + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Acknowledgements +================= + +The initial version of the ToggleDone() function was based on SwitchBox() +from the VimOutliner Checkboxes script written by Noel Henson (available +from ). + +Context folding expression was based on a snippet from Vim Tip 282 +(). + +Thanks are due to a number of contributors who have supplied suggestions +or patches to improve TaskPaper.vim: + + * Alexander Wodniok + - hint to allow this file to be used as a help file + * Ben Armstron + - various fixes that make the scripts more robust + - fix to show only complete tag matches + - include `_` in contexts + * Huahai Yang + - fixed handling of indented tasks + * Steve Audette + - suggested change to folding + * Andreas Kühntopf + - display non-tasks as comments + * Julien Blanchard (https://github.com/julienXX) + - added ToggleCancelled + * Robert James Kaes (https://github.com/rjkaes) + - added task_paper_date_format + * Adriano Castro (https://github.com/adrianocastro) + - use tabs not spaces (noexpandtab) + * Morgan Sutherland (https://github.com/msutherl) + - Use rather than + - Start new task after + * Matt Sacks (https://github.com/mattsa) + - Optional (date) syntax for @done tasks + - Add Tag command for add/removing tag + - Fix lagging space after removing a tag + - Better syntax + * Anyakichi (https://github.com/anyakichi) + - Add useful functions for users to define his own mappings easily + - Add, delete, toggle, and update tags + - Go previous or next project + - Move projects, tasks and notes to another project + - Search for keywords or tags with regexp + - More compatible with HogBaySoftware's TaskPaper + - Tag to projects and notes not only tasks + - Shortcut to @today tag + - Archiving done support + - Multi-level folding of projects work perfectly + - Add a new feature to fold only notes + + + +Contact +======== + +The author of these Vim scripts is David O'Callaghan +. + +For all information regarding the TaskPaper application itself please visit +. diff --git a/autoload/taskpaper.vim b/autoload/taskpaper.vim new file mode 100644 index 0000000..d9b7a93 --- /dev/null +++ b/autoload/taskpaper.vim @@ -0,0 +1,561 @@ +" plugin to handle the TaskPaper to-do list format +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-03-07 + +let s:save_cpo = &cpo +set cpo&vim + +function! s:add_delete_tag(tag, value, add) + let cur_line = getline(".") + + let tag = " @" . a:tag + if a:value != '' + let tag .= "(" . a:value . ")" + endif + + " Add tag + if a:add + let new_line = cur_line . tag + call setline(".", new_line) + return 1 + endif + + " Delete tag + if cur_line =~# '\V' . tag + if a:value != '' + let new_line = substitute(cur_line, '\V' . tag, "", "g") + else + let new_line = substitute(cur_line, '\V' . tag . '\v(\([^)]*\))?', + \ "", "g") + endif + + call setline(".", new_line) + return 1 + endif + return 0 +endfunction + +function! taskpaper#add_tag(tag, ...) + let value = a:0 > 0 ? a:1 : input('Value: ') + return s:add_delete_tag(a:tag, value, 1) +endfunction + +function! taskpaper#delete_tag(tag, ...) + let value = a:0 > 0 ? a:1 : '' + return s:add_delete_tag(a:tag, value, 0) +endfunction + +function! taskpaper#swap_tag(oldtag, newtag) + call taskpaper#delete_tag(a:oldtag) + call taskpaper#add_tag(a:newtag, '') +endfunction + +function! taskpaper#swap_tags(oldtags, newtags) + for oldtag in a:oldtags + call taskpaper#delete_tag(oldtag) + endfor + for newtag in a:newtags + call taskpaper#add_tag(newtag, '') + endfor +endfunction + +function! taskpaper#toggle_tag(tag, ...) + if !taskpaper#delete_tag(a:tag, '') + let args = a:0 > 0 ? [a:tag, a:1] : [a:tag] + call call("taskpaper#add_tag", args) + endif +endfunction + +function! taskpaper#has_tag(tag) + let cur_line = getline(".") + let m = matchstr(cur_line, '@'.a:tag) + if m != '' + return 1 + else + return 0 +endfunction + +function! taskpaper#cycle_tags(...) + let tags_index = 0 + let tag_list = a:000 + let tag_added = 0 + for tag_name in tag_list + let tags_index = tags_index + 1 + if tags_index == len(tag_list) + let tags_index = 0 + endif + let has_tag = taskpaper#has_tag(tag_name) + if has_tag == 1 + let tag_added = 1 + call taskpaper#delete_tag(tag_name) + let new_tag = tag_list[tags_index] + if new_tag != '' + call taskpaper#add_tag(new_tag, '') + endif + break + endif + endfor + if tag_added == 0 + call taskpaper#add_tag(tag_list[0], '') + endif +endfunction + +function! taskpaper#update_tag(tag, ...) + call taskpaper#delete_tag(a:tag, '') + let args = a:0 > 0 ? [a:tag, a:1] : [a:tag] + call call("taskpaper#add_tag", args) +endfunction + +function! taskpaper#date() + return strftime(g:task_paper_date_format, localtime()) +endfunction + +function! taskpaper#complete_project(lead, cmdline, pos) + let lnum = 1 + let list = [] + let stack = [''] + let depth = 0 + + while lnum <= line('$') + let line = getline(lnum) + let ml = matchlist(line, '\v\C^\t*(.+):(\s+\@[^ \t(]+(\([^)]*\))?)*$') + + if !empty(ml) + let d = len(matchstr(line, '^\t*')) + + while d < depth + call remove(stack, -1) + let depth -= 1 + endwhile + + while d > depth + call add(stack, '') + let depth += 1 + endwhile + + let stack[d] = ml[1] + + let candidate = join(stack, ':') + if candidate =~ '^' . a:lead + call add(list, join(stack, ':')) + endif + endif + + let lnum += 1 + endwhile + + return list +endfunction + +function! taskpaper#go_to_project() + let res = input('Project: ', '', 'customlist,taskpaper#complete_project') + + if res != '' + call taskpaper#search_project(split(res, ':')) + endif +endfunction + +function! taskpaper#next_project() + return search('^\t*\zs.\+:\(\s\+@[^\s(]\+\(([^)]*)\)\?\)*$', 'w') +endfunction + +function! taskpaper#previous_project() + return search('^\t*\zs.\+:\(\s\+@[^\s(]\+\(([^)]*)\)\?\)*$', 'bw') +endfunction + +function! s:search_project(project, depth, begin, end) + call cursor(a:begin, 1) + return search('\v^\t{' . a:depth . '}\V' . a:project . ':', 'c', a:end) +endfunction + +function! taskpaper#search_project(projects) + if empty(a:projects) + return 0 + endif + + let save_pos = getpos('.') + + let begin = 1 + let end = line('$') + let depth = 0 + + for project in a:projects + if !s:search_project(project, depth, begin, end) + call setpos('.', save_pos) + return 0 + endif + + let begin = line('.') + let end = taskpaper#search_end_of_item(begin) + let depth += 1 + endfor + + call cursor(begin, 1) + normal! ^ + + return begin +endfunction + +function! taskpaper#search_end_of_item(...) + let lnum = a:0 > 0 ? a:1 : line('.') + let flags = a:0 > 1 ? a:2 : '' + + let depth = len(matchstr(getline(lnum), '^\t*')) + + let end = lnum + let lnum += 1 + while lnum <= line('$') + let line = getline(lnum) + + if line =~ '^\s*$' + " Do nothing + elseif depth < len(matchstr(line, '^\t*')) + let end = lnum + else + break + endif + + let lnum += 1 + endwhile + + if flags !~# 'n' + call cursor(end, 0) + normal! ^ + endif + + return end +endfunction + +function! taskpaper#delete(...) + let start = a:0 > 0 ? a:1 : line('.') + let reg = a:0 > 1 ? a:2 : '"' + let kill_indent = a:0 > 2 ? a:3 : 0 + + let reg_save = '' + if kill_indent && reg =~# '\u' + let reg = tolower(reg) + let reg_save = getreg(reg) + endif + + let save_fen = &l:foldenable + setlocal nofoldenable + + let depth = len(matchstr(getline(start), '^\t*')) + + let end = taskpaper#search_end_of_item(start) + silent execute start . ',' . end . 'delete ' . reg + + let &l:foldenable = save_fen + + if kill_indent + let pat = '\(^\|\n\)\t\{' . depth . '\}' + let content = substitute(getreg(reg), pat, '\1', 'g') + if reg_save != '' + let content = reg_save . content + endif + call setreg(reg, content) + endif + + return end - start + 1 +endfunction + +function! taskpaper#put(...) + let projects = a:0 > 0 ? a:1 : [] + let reg = a:0 > 1 ? a:2 : '"' + let indent = a:0 > 2 ? a:3 : 0 + + let save_fen = &l:foldenable + setlocal nofoldenable + + if !empty(projects) && !taskpaper#search_project(projects) + let &l:foldenable = save_fen + return 0 + endif + + if indent > 0 + let project_depth = len(matchstr(getline('.'), '^\t*')) + let tabs = repeat("\t", project_depth + indent) + else + let tabs = '' + endif + + execute 'put' reg + silent execute "'[,']" . 's/^\ze./' . tabs + + let &l:foldenable = save_fen + + return line("']") - line("'[") + 1 +endfunction + +function! taskpaper#move(projects, ...) + let lnum = a:0 > 0 ? a:1 : line('.') + + let save_fen = &l:foldenable + setlocal nofoldenable + + if !taskpaper#search_project(a:projects) + let &l:foldenable = save_fen + return 0 + endif + + let reg = 'a' + let save_reg = [getreg(reg), getregtype(reg)] + + let nlines = taskpaper#delete(lnum, reg, 1) + call taskpaper#put(a:projects, reg, 1) + + let &l:foldenable = save_fen + call setreg(reg, save_reg[0], save_reg[1]) + if g:task_paper_follow_move == 0 + execute lnum + endif + return nlines +endfunction + +function! taskpaper#move_to_project() + let res = input('Project: ', '', 'customlist,taskpaper#complete_project') + call taskpaper#move(split(res, ':')) +endfunction + +function! taskpaper#update_project() + let indent = matchstr(getline("."), '^\t*') + let depth = len(indent) + + let projects = [] + + for linenr in range(line('.'), 1, -1) + let line = getline(linenr) + let ml = matchlist(line, '\v^\t{0,' . depth . '}([^\t:]+):') + if empty(ml) + continue + endif + + let project = ml[1] + if project != "" + call add(projects, project) + + let indent = matchstr(line, '^\t*') + let depth = len(indent) - 1 + + if depth < 0 + break + endif + endif + endfor + + call taskpaper#update_tag('project', join(reverse(projects), ' / ')) +endfunction + +function! taskpaper#archive_done() + let archive_start = search('^' . g:task_paper_archive_project . ':', 'cw') + if archive_start == 0 + call append('$', g:task_paper_archive_project . ':') + let archive_start = line('$') + let archive_end = 0 + else + let archive_end = search('^\S\+:', 'W') + endif + + let save_fen = &l:foldenable + let save_reg = [getreg('a'), getregtype('a')] + setlocal nofoldenable + call setreg('a', '') + + call cursor(1, 1) + let deleted = 0 + + while 1 + let lnum = search('@done', 'W', archive_start - deleted) + if lnum == 0 + break + endif + + call taskpaper#update_project() + let deleted += taskpaper#delete(lnum, 'A', 1) + endwhile + + if archive_end != 0 + call cursor(archive_end, 1) + + while 1 + let lnum = search('@done', 'W') + if lnum == 0 + break + endif + + call taskpaper#update_project() + let deleted += taskpaper#delete(lnum, 'A', 1) + endwhile + endif + + if deleted != 0 + call taskpaper#put([g:task_paper_archive_project], 'a', 1) + else + echo 'No done items.' + endif + + let &l:foldenable = save_fen + call setreg('a', save_reg[0], save_reg[1]) + + return deleted +endfunction + +function! taskpaper#fold(lnum, pat, ipat) + let line = getline(a:lnum) + let level = foldlevel(a:lnum) + + if line =~? a:pat && (a:ipat == '' || line !~? a:ipat) + return 0 + elseif synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return 1 + elseif level != -1 + return level + endif + + let depth = len(matchstr(getline(a:lnum), '^\t*')) + + for lnum in range(a:lnum + 1, line('$')) + let line = getline(lnum) + + if depth >= len(matchstr(line, '^\t*')) + break + endif + + if line =~? a:pat && (a:ipat == '' || line !~? a:ipat) + return 0 + endif + endfor + return 1 +endfunction + +function! taskpaper#search(...) + let pat = a:0 > 0 ? a:1 : input('Search: ') + let ipat = a:0 > 1 ? a:2 : '' + if pat == '' + return + endif + + setlocal foldexpr=taskpaper#fold(v:lnum,pat,ipat) + setlocal foldminlines=0 foldtext='' + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#fold_except_range(lnum, begin, end) + if a:lnum > a:end + return 1 + elseif a:lnum >= a:begin + return 0 + elseif synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return 1 + elseif level != -1 + return level + endif + + if a:end <= taskpaper#search_end_of_item(a:lnum, 'n') + return 0 + endif + + return 1 +endfunction + +function! taskpaper#focus_project() + let pos = getpos('.') + + normal! $ + let begin = taskpaper#previous_project() + if begin == 0 + call setpos('.', pos) + return + endif + + let end = taskpaper#search_end_of_item(begin, 'n') + + " Go to the top level project + while taskpaper#previous_project() + if getline('.') =~ '^[^\t]' + break + endif + endwhile + + setlocal foldexpr=taskpaper#fold_except_range(v:lnum,begin,end) + setlocal foldminlines=0 foldtext='' + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#search_tag(...) + if a:0 > 0 + let tag = a:1 + else + let cword = expand('') + let tag = input('Tag: ', cword =~ '@\k\+' ? cword[1:] : '') + endif + + if tag != '' + let ipat = (g:task_paper_search_hide_done == 1)?'\<@done\>':'' + call taskpaper#search('\<@' . tag . '\>', ipat) + endif +endfunction + +function! taskpaper#_fold_projects(lnum) + if synIDattr(synID(a:lnum, 1, 1), "name") != 'taskpaperProject' + return '=' + endif + + let line = getline(a:lnum) + let depth = len(matchstr(line, '^\t*')) + return '>' . (depth + 1) +endfunction + +function! taskpaper#fold_projects() + setlocal foldexpr=taskpaper#_fold_projects(v:lnum) + setlocal foldminlines=0 foldtext=foldtext() + setlocal foldmethod=expr foldlevel=0 foldenable +endfunction + +function! taskpaper#newline() + let lnum = line('.') + let line = getline('.') + + if lnum == 1 || line !~ '^\s*$' || + \ synIDattr(synID(lnum - 1, 1, 1), "name") != 'taskpaperProject' + return '' + endif + + let pline = getline(lnum - 1) + let depth = len(matchstr(pline, '^\t*')) + call setline(lnum, repeat("\t", depth + 1) . '- ') + + return "\" +endfunction + + +function! taskpaper#tag_style(...) + if a:0 > 0 + let tag_name = a:1 + endif + + if a:0 > 1 + let tag_style = a:2 + let tag_style_name = 'taskpaperAutoStyle_' . tag_name + execute 'syn match' tag_style_name '/\s\zs@'.tag_name.'\(([^)]*)\)\?/' + execute 'hi' tag_style_name tag_style + if version < 508 + execute 'hi link' tag_style_name tag_style_name + else + execute 'hi def link' tag_style_name tag_style_name + endif + else + echo "No style specified." + return '' + endif +endfunction + +function! taskpaper#tag_style_dict(tsd) + for tag_name in keys(a:tsd) + call taskpaper#tag_style(tag_name,a:tsd[tag_name]) + endfor +endfunction + +let &cpo = s:save_cpo diff --git a/doc/example.taskpaper b/doc/example.taskpaper new file mode 100644 index 0000000..c72b188 --- /dev/null +++ b/doc/example.taskpaper @@ -0,0 +1,10 @@ +Example Project: + - Start example project file @computer @done + - Brainstorm project with colleagues @work + - Email Joan about project @email + Sub Project: + - Sub task + +Next Project: + - Draft ideas for next project @anywhere + - Email Bob to arrange meeting @email diff --git a/doc/taskpaper.txt b/doc/taskpaper.txt new file mode 100644 index 0000000..8993019 --- /dev/null +++ b/doc/taskpaper.txt @@ -0,0 +1,310 @@ +*taskpaper.txt* For Vim version 6.0 Last change: 2012 March 13 + +David O'Callaghan + +13th March 2012 + +Introduction +============= +*taskpaper* + +*Latest version from https://github.com/davidoc/taskpaper.vim* + +From the TaskPaper website (): + +"TaskPaper is a simple to-do list application that helps you stay +organized. Unlike competing applications, TaskPaper is based on plain text +files which offer you paper-like simplicity and ease of use." + +TaskPaper is a to-do list application for Mac OS X based on the "Getting +Things Done" approach of David Allen (). It supports +the GTD notions of projects, tasks and contexts. + +This package contains a syntax file and a file-type plugin for the simple +format used by the TaskPaper application. It is intended for Mac users who +want to edit their TaskPaper lists in Vim from time to time (for example, in +a SSH session, or on a non-Mac system) and for anyone who is looking for a +simple to-do list format. + +Installation +============= +*taskpaper-install* + +It should be safe to simply unpack the package into your .vim directory. +It contains the following files: + + autoload/taskpaper.vim + doc/example.taskpaper + doc/taskpaper.txt + doc/taskpaper_licence.txt + ftdetect/taskpaper.vim + ftplugin/taskpaper.vim + syntax/taskpaper.vim + +To access this help file from within Vim you must first update your help +tags: + + :helptags ~/.vim/doc + +The path may need to be modified depending on where you install to. Once +you have done this you can access the help with this command: + + :help taskpaper + +Syntax +======= +*taskpaper-syntax* + +The syntax file highlights project headings and task contexts (tags), and +"greys out" completed tasks. The exact style of the displayed file depends +on your Vim colour scheme. + +A project heading is a piece of text ending in a colon. + +A task is a line beginning with a hyphen '-' and can have zero or more +context tags. + +A context tag has the form "@tag". + +Other text is considered as a "note" and is displayed as a Vim comment. + +File-type Plugin +================= +*taskpaper-plugin* + +The file-type plugin tries to make editing TaskPaper files in Vim more +comfortable. + +Vim can complete context names after the '@' using the keyword completion +commands (e.g. Ctrl-X Ctrl-N). + +*taskpaper-mappings* +The plugin defines some new mappings: + + \td Mark task as done + \tx Mark task as cancelled + \tt Mark task as today + \tD Archive @done items + \tX Show tasks marked as cancelled + \tT Show tasks marked as today + \t/ Search for items including keyword + \ts Search for items including tag + \tp Fold all projects + \t. Fold all notes + \tP Focus on the current project + \tj Go to next project + \tk Go to previous project + \tg Go to specified project + \tm Move task to specified project + +Note: if `` has been changed (e.g. `:let mapleader=",,"`) +then its value should be used instead of `\` in the mappings. + +Marking a task as done will add the "@done" context tag to the end of the +task, and it will be greyed out by the syntax file. + +To show all tasks with a particular context tag, type `\ts` and a tag name to +search. If you use the `\ts` command over the desired context tag, the tag +name is set as default value. This will fold all the irrelevant tasks leaving +only the tasks in the current context visible. + +To fold all top-level projects leaving only the headings visible use the `\tp` +command. Standard fold commands can be used to open (`zo`) and close (`zc`) +individual projects. + +To show all projects and tasks use the `zR` command. This disables folding so +that the entire file is expanded. + +To go to next or previous project use the `\tj` command or `\tk` command. To +go to a project you specify use the `\tg` command. You can complete project +names with on prompt. + +Configuration +============== +*taskpaper-config* + +The plugin supports a number of configuration variables, which can be set in +your .vimrc file. + +To change the default date format string used when marking a task complete, +define the `task_paper_date_format` variable. The format matches your system's +`strftime()` function. + +For example, to include the date and time in ISO8601 format: + + let g:task_paper_date_format = "%Y-%m-%dT%H:%M:%S%z" + +To change the default archive project name, define the +`task_paper_archive_project` variable. The default value is "Archive". + + let g:task_paper_archive_project = "Archive" + +By default, when you move a task, the cursor will follow that task to its new +location. To make the cursor stay in it's current location, change the +`task_paper_follow_move` variable. + + let g:task_paper_follow_move = 0 + +If you want to hide done tasks when searching you can change the +`task_paper_search_hide_done` variable. + + let g:task_paper_search_hide_done = 1 + +To set a custom style (colour, bold, etc.) for tags task_paper_styles variable, +which is a dictionary. + + let g:task_paper_styles={'wait': 'ctermfg=Blue guifg=Blue', 'FAIL': +'ctermbg=Red guibg=Red'} + +See |highlight-args| for a full description of the syntax. + + +File-type Detection +==================== + +This package also contains a script to automatically use the TaskPaper file +type for all files with the ".taskpaper" extension. + +Customize +========== +*taskpaper-customize* + +You can create your own shortcut for tagging. To define your own shortcut, +write settings in ~/.vim/ftplugin/taskpaper.vim or ~/.vimrc. If you use the +.vimrc file, define settings like: + + function! s:taskpaper_setup() + " Your settings + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + endfunction + + augroup vimrc-taskpaper + autocmd! + autocmd FileType taskpaper call s:taskpaper_setup() + augroup END + +To add a tag without argument: + + nnoremap tn + \ :call taskpaper#add_tag('next', '') + +To delete a tag: + + nnoremap tN + \ :call taskpaper#delete_tag('next', '') + +To toggle a tag: + + nnoremap tn + \ :call taskpaper#toggle_tag('next', '') + +To add a tag with an argument: + + nnoremap tq + \ :call taskpaper#add_tag('priority') + +You can specify the priority value on prompt. + +To delete the priority tag with any argument: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '') + +To delete only the level 1 of priority tag: + + nnoremap tQ + \ :call taskpaper#delete_tag('priority', '1') + +To toggle a tag with an argument: + + nnoremap tq + \ :call taskpaper#toggle_tag('priority') + +To update a tag (not delete if the tag exists): + + nnoremap tq + \ :call taskpaper#update_tag('priority') + +Licence +======== +*taskpaper-licence* + +Copyright (C) 2007--2012 by David O'Callaghan + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Acknowledgements +================= + +The initial version of the ToggleDone() function was based on SwitchBox() +from the VimOutliner Checkboxes script written by Noel Henson (available +from ). + +Context folding expression was based on a snippet from Vim Tip 282 +(). + +Thanks are due to a number of contributors who have supplied suggestions +or patches to improve TaskPaper.vim: + + * Alexander Wodniok + - hint to allow this file to be used as a help file + * Ben Armstron + - various fixes that make the scripts more robust + - fix to show only complete tag matches + - include `_` in contexts + * Huahai Yang + - fixed handling of indented tasks + * Steve Audette + - suggested change to folding + * Andreas Kühntopf + - display non-tasks as comments + * Julien Blanchard (https://github.com/julienXX) + - added ToggleCancelled + * Robert James Kaes (https://github.com/rjkaes) + - added task_paper_date_format + * Adriano Castro (https://github.com/adrianocastro) + - use tabs not spaces (noexpandtab) + * Morgan Sutherland (https://github.com/msutherl) + - Use rather than + - Start new task after + * Matt Sacks (https://github.com/mattsa) + - Optional (date) syntax for @done tasks + - Add Tag command for add/removing tag + - Fix lagging space after removing a tag + - Better syntax + * Anyakichi (https://github.com/anyakichi) + - Add useful functions for users to define his own mappings easily + - Add, delete, toggle, and update tags + - Go previous or next project + - Move projects, tasks and notes to another project + - Search for keywords or tags with regexp + - More compatible with HogBaySoftware's TaskPaper + - Tag to projects and notes not only tasks + - Shortcut to @today tag + - Archiving done support + - Multi-level folding of projects work perfectly + - Add a new feature to fold only notes + + + +Contact +======== + +The author of these Vim scripts is David O'Callaghan +. + +For all information regarding the TaskPaper application itself please visit +. diff --git a/doc/taskpaper_hacking.txt b/doc/taskpaper_hacking.txt new file mode 100644 index 0000000..706fb4a --- /dev/null +++ b/doc/taskpaper_hacking.txt @@ -0,0 +1,8 @@ +Version Control +---------------- + +github (http://github.com) is used for version control. The main +repository is at . + +To start working on the source code you should create an account on github, +fork taskpaper.vim and checkout your fork. diff --git a/doc/taskpaper_licence.txt b/doc/taskpaper_licence.txt new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/doc/taskpaper_licence.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/ftdetect/taskpaper.vim b/ftdetect/taskpaper.vim new file mode 100644 index 0000000..56f88fb --- /dev/null +++ b/ftdetect/taskpaper.vim @@ -0,0 +1,9 @@ +" Vim filetype detection file +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2011-03-28 +" +augroup taskpaper + au! BufRead,BufNewFile *.taskpaper setfiletype taskpaper +augroup END diff --git a/ftplugin/taskpaper.vim b/ftplugin/taskpaper.vim new file mode 100644 index 0000000..ea66fcb --- /dev/null +++ b/ftplugin/taskpaper.vim @@ -0,0 +1,117 @@ +" plugin to handle the TaskPaper to-do list format +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-02-20 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +" Define a default date format +if !exists('g:task_paper_date_format') + let g:task_paper_date_format = "%Y-%m-%d" +endif + +" Define a default archive project name +if !exists('g:task_paper_archive_project') + let g:task_paper_archive_project = "Archive" +endif + +" When moving a task, should the cursor follow or stay in the same place +" (default: follow) +if !exists('g:task_paper_follow_move') + let g:task_paper_follow_move = 1 +endif + +" Hide @done tasks when searching tags +if !exists('g:task_paper_search_hide_done') + let g:task_paper_search_hide_done = 0 +endif + +" Add '@' to keyword character set so that we can complete contexts as keywords +setlocal iskeyword+=@-@ + +" Tab character has special meaning on TaskPaper +setlocal noexpandtab + +" Change 'comments' and 'formatoptions' to continue to write a task item +setlocal comments=b:- +setlocal fo-=c fo+=rol + +" Set 'autoindent' to maintain indent level +setlocal autoindent + +" Set up mappings +if !exists("no_plugin_maps") && !exists("no_taskpaper_maps") + nnoremap TaskPaperFoldProjects + \ :call taskpaper#fold_projects() + nnoremap TaskPaperFoldNotes + \ :call taskpaper#search('\v^(\s*\|\t+-\s+.*\|.+:)$') + nnoremap TaskPaperFocusProject + \ :call taskpaper#focus_project() + + nnoremap TaskPaperSearchKeyword + \ :call taskpaper#search() + nnoremap TaskPaperSearchTag + \ :call taskpaper#search_tag() + + nnoremap TaskPaperGoToProject + \ :call taskpaper#go_to_project() + nnoremap TaskPaperNextProject + \ :call taskpaper#next_project() + nnoremap TaskPaperPreviousProject + \ :call taskpaper#previous_project() + + nnoremap TaskPaperArchiveDone + \ :call taskpaper#archive_done() + nnoremap TaskPaperShowToday + \ :call taskpaper#search_tag('today') + nnoremap TaskPaperShowCancelled + \ :call taskpaper#search_tag('cancelled') + nnoremap TaskPaperToggleCancelled + \ :call taskpaper#toggle_tag('cancelled', taskpaper#date()) + nnoremap TaskPaperToggleDone + \ :call taskpaper#toggle_tag('done', taskpaper#date()) + nnoremap TaskPaperToggleToday + \ :call taskpaper#toggle_tag('today', '') + nnoremap TaskPaperMoveToProject + \ :call taskpaper#move_to_project() + + nnoremap TaskPaperNewline + \ o=taskpaper#newline() + inoremap TaskPaperNewline + \ =taskpaper#newline() + + nmap tp TaskPaperFoldProjects + nmap t. TaskPaperFoldNotes + nmap tP TaskPaperFocusProject + + nmap t/ TaskPaperSearchKeyword + nmap ts TaskPaperSearchTag + + nmap tg TaskPaperGoToProject + nmap tj TaskPaperNextProject + nmap tk TaskPaperPreviousProject + + nmap tD TaskPaperArchiveDone + nmap tT TaskPaperShowToday + nmap tX TaskPaperShowCancelled + nmap td TaskPaperToggleDone + nmap tt TaskPaperToggleToday + nmap tx TaskPaperToggleCancelled + nmap tm TaskPaperMoveToProject + + if mapcheck("o", "n") == '' + nmap o TaskPaperNewline + endif + if mapcheck("\", "i") == '' + imap TaskPaperNewline + endif +endif + +let &cpo = s:save_cpo diff --git a/syntax/taskpaper.vim b/syntax/taskpaper.vim new file mode 100644 index 0000000..6be06d1 --- /dev/null +++ b/syntax/taskpaper.vim @@ -0,0 +1,48 @@ +" Vim syntax file +" Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper) +" Maintainer: David O'Callaghan +" URL: https://github.com/davidoc/taskpaper.vim +" Last Change: 2012-03-07 + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +if version < 508 + command! -nargs=+ HiLink hi link +else + command! -nargs=+ HiLink hi def link +endif + +" Define tag styles +if !exists('g:task_paper_styles') + let g:task_paper_styles = {'FAIL': 'guibg=Red guifg=White'} +endif + +syn case ignore + +syn match taskpaperComment /^.*$/ contains=taskpaperContext +syn match taskpaperProject /^.\+:\(\s\+@[^ \t(]\+\(([^)]*)\)\?\)*$/ contains=taskpaperContext +syn match taskpaperListItem /^\t*-\s\+/ +syn match taskpaperContext /\s\zs@[^ \t(]\+\(([^)]*)\)\?/ +syn match taskpaperDone /^.*\s@done\(\(\s\|([^)]*)\).*\)\?$/ +syn match taskpaperCancelled /^.*\s@cancelled\(\(\s\|([^)]*)\).*\)\?$/ + +syn sync fromstart + +"highlighting for Taskpaper groups +HiLink taskpaperListItem Identifier +HiLink taskpaperContext Identifier +HiLink taskpaperProject Title +HiLink taskpaperDone NonText +HiLink taskpaperCancelled NonText +HiLink taskpaperComment Comment + +call taskpaper#tag_style_dict(g:task_paper_styles) + +let b:current_syntax = "taskpaper" + +delcommand HiLink +" vim: ts=8 diff --git a/todo.taskpaper b/todo.taskpaper new file mode 100644 index 0000000..2527f4e --- /dev/null +++ b/todo.taskpaper @@ -0,0 +1,6 @@ +Release: + Tasks to be completed before next release + - Note compatibility with ToDoPaper + - stylesheets for tags (e.g. "fail" produces red bg) @done(2012-03-13) + - include patch for notes. @done +