tomtom / ttodo_vim

Edit, view, filter, and sort todo.txt files
http://www.vim.org/scripts/script.php?script_id=5262
GNU General Public License v3.0
15 stars 1 forks source link
todo todotxt vim vim-plugin

This plugin provides the |:Ttodo| command that allow easy editing, viewing, and filtering of todo.txt files (see http://todotxt.com) via |tlib#input#List()|. The plugin supports:

- syntax highlighting for todo.txt files
- search across multiple todo.txt files (see |:Ttodo|)
- filter tasks with specific tags, lists etc. (see |:Ttodo|)
- subtasks (outlines of complex tasks)
- hide tasks until a threshold date
- recurring tasks.

Examples: >

" Show all tasks; default map (|g:ttodo_nmap|): <Leader>1
:Ttodo

" Show important tasks; default map (|g:ttodo_nmap_important|): <Leader>!
:Ttodo!

" Show tasks that are due in the next two weeks
:Ttodo --due=2w

" Show tasks with priorities A to C
:Ttodo --pri=A-C

" Show tasks matching @Test
:Ttodo @Test

" By default, |:Ttodo| scans the todo.txt files in |g:ttodo#dirs|. Users 
" can also scan loaded buffers.
" Show tasks in the current buffer
:Ttodo --bufname=%

" Command-line options can be collected in preference sets (see 
" |g:ttodo#prefs|)
:Ttodo --pref=work

Global maps:

<Leader>1 ............ Show tasks (:Ttodo)
<Leader>! ............ Show important tasks (:Ttodo --pref=important)

If filetype is ttodo, the following buffer-local keymaps are enabled:

<cr> ................. Add a new task;
                       if |g:ttodo#ftplugin#add_at_eof| is true, add the 
                       task at the end of file
<c-cr> ............... Add a new task; copy any list, tags, and notes from 
                       the current task;
                       if |g:ttodo#ftplugin#add_at_eof| is true, add the 
                       task at the end of file
<s-cr> ............... Add a new subtask
<LocalLeader>tx ...... Mark the current task as "done"
<LocalLeader>td ...... Mark the current task as due in N days
<LocalLeader>tw ...... Mark the current task as due in N weeks
<LocalLeader>tm ...... Mark the current task as due in N months
<LocalLeader>ty ...... Set the current task's priority
<LocalLeader>ta ...... Archive completed tasks
<LocalLeader>tb ...... View, filter tasks in the current buffer
<LocalLeader>t* ...... View tasks in the current buffer that match the word 
                       under the cursor
<LocalLeader>tn ...... Add a note (the filename uses the first @list tag)
<LocalLeader>ti ...... Add a hopefully unique ID (an Adler32 hash)
<LocalLeader>tD ...... Add a dependency

If filetype is ttodo, the following buffer-local commands are enabled:

|:Ttodoarchive| ...... Archive completed tasks in the current buffer
|:Ttodobuffer| ....... Show tasks in the current buffer only
|:Ttodonote| ......... Add a new note to the task at the cursor
|:Ttodosort| ......... Sort the tasks in the current buffer

As a ftplugin, ttodo supports the following syntax/extensions to todo.txt (see also https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format):

(A) DATE TASK ........ A priority as upper case letter (at the beginning of the 
                       line)
DATE TASK ............ An open task
x DATE DATE TASK ..... A completed task (with completion date)
  indented tasks ..... A indented task is a subtask of the parent task; unless 
                       `has_subtasks` is true, |:Ttodo| will only show tasks 
                       with no open subtasks; this is similar to how the 
                       outline addon handles subtasks (see also 
                       https://github.com/samuelsnyder/outline-todo.txt)

                                                *ttodo-tags*

A TASK may contain the following tags: ttodo-@next @list ............ a "list" tag NOTE: The is a special list @next that marks important task that should really be tackled next. +keyword ......... a "keyword" tag h:1 .............. hidden task due:YYYY-MM-DD ... due dates NOTE: If a task is member of the @next list, filters by due dates will be ignored rec:+Nx .......... When marking a task a "done", add a new task with a due date in N d(ays), w(eeks), m(onths), y(ears); with the leading '+' use the original due date; else use the completion date; this is similar to how the Simpletask Android app handles rec tags t:YYYY-MM-DD ..... Hide the tasks until the given date t:-Nd ............ Hide the tasks until N days before the due date id:ID ............ Define a tasks ID string (an ID should consist of alphanumeric characters only) dep:IDs .......... Depends on task with ID (if the other task is not completed yet, mark the current task as pending); IDs is a comma-separated list of IDs parent:ID ........ In outlines: the current task is the child of task with ID ttodo-file-options $TTODO$ OPTION:VALUE .. If a line matches $TTODO$ it is assumed to contain a file-local option. Search the help file for OPTION: to see which options are available. Users will typically want to hide such lines using h:1

If you set |g:ttodo_enable_ftdetect| to 0, you can use the |:Ttodo| command in conjunction with other syntax files/ftplugins such as:

- https://github.com/freitass/todo.txt-vim
    - todo-txt.vim : Vim plugin for Todo.txt 
      https://github.com/dbeniamine/todo.txt-vim or
      http://www.vim.org/scripts/script.php?script_id=5134
- https://github.com/mivok/vimtodo or
  http://www.vim.org/scripts/script.php?script_id=3264
- https://github.com/davidoc/todo.txt-vim
    - My fork: https://github.com/tomtom/todo.txt-vim-1
- https://github.com/dsiroky/vim-todotxt
- ...

Related work:


Install~

To install the vimball, edit the vba file and type: >

:so %

See :help vimball for details.

To install from github, please use

  1. git + a plugin loader like enable_vim, pathogen, vim-unbundle etc.
  2. a plugin manager like VAM, Vundle, NeoBundle, vim-plug etc.

The tlib_vim plugin is required: https://github.com/tomtom/tlib_vim

Optional enhancement:

Also available via git: http://github.com/tomtom/ttodo_vim

Setup~

Please set |g:ttodo#dirs| in |vimrc| before using |:Ttodo|.

Dependencies: tlib (>= 1.26) :: http://github.com/tomtom/tlib_vim

License: GPLv3 or later