davidoc / taskpaper.vim

This package contains a syntax file and a file-type plugin for the simple format used by the TaskPaper application.
http://www.vim.org/scripts/script.php?script_id=2027
330 stars 70 forks source link

taskpaper.txt For Vim version 6.0 Last change: 2012 March 13

David O'Callaghan david.ocallaghan@cs.tcd.ie

13th March 2012

Introduction

Latest version from https://github.com/davidoc/taskpaper.vim

From the TaskPaper website (http://hogbaysoftware.com/projects/taskpaper):

"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 (http://www.davidco.com/). 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 <Leader> 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 <buffer> <silent> <Leader>tn
\    :<C-u>call taskpaper#toggle_tag('next', '')<CR>
endfunction

augroup vimrc-taskpaper
autocmd!
autocmd FileType taskpaper call s:taskpaper_setup()
augroup END

To add a tag without argument:

nnoremap <buffer> <silent> <Leader>tn
\    :<C-u>call taskpaper#add_tag('next', '')<CR>

To delete a tag:

nnoremap <buffer> <silent> <Leader>tN
\    :<C-u>call taskpaper#delete_tag('next', '')<CR>

To toggle a tag:

nnoremap <buffer> <silent> <Leader>tn
\    :<C-u>call taskpaper#toggle_tag('next', '')<CR>

To add a tag with an argument:

nnoremap <buffer> <silent> <Leader>tq
\    :<C-u>call taskpaper#add_tag('priority')<CR>

You can specify the priority value on prompt.

To delete the priority tag with any argument:

nnoremap <buffer> <silent> <Leader>tQ
\    :<C-u>call taskpaper#delete_tag('priority', '')<CR>

To delete only the level 1 of priority tag:

nnoremap <buffer> <silent> <Leader>tQ
\    :<C-u>call taskpaper#delete_tag('priority', '1')<CR>

To toggle a tag with an argument:

nnoremap <buffer> <silent> <Leader>tq
\    :<C-u>call taskpaper#toggle_tag('priority')<CR>

To update a tag (not delete if the tag exists):

nnoremap <buffer> <silent> <Leader>tq
\    :<C-u>call taskpaper#update_tag('priority')<CR>

Licence

Copyright (C) 2007--2012 by David O'Callaghan david.ocallaghan@cs.tcd.ie

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 http://www.vimoutliner.org).

Context folding expression was based on a snippet from Vim Tip 282 (http://vim.sourceforge.net/tips/tip.php?tip_id=282).

Thanks are due to a number of contributors who have supplied suggestions or patches to improve TaskPaper.vim:

Contact

The author of these Vim scripts is David O'Callaghan david.ocallaghan@cs.tcd.ie.

For all information regarding the TaskPaper application itself please visit http://hogbaysoftware.com/projects/taskpaper/.