summaryrefslogtreecommitdiff
path: root/README.markdown
blob: 0e9f593a514ee71f951f05e63f7d3e5799bd8c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# Todo.txt-vim

        #####                                                #     #
          #    ####  #####   ####     ##### #    # #####     #     # # #    #
          #   #    # #    # #    #      #    #  #    #       #     # # ##  ##
          #   #    # #    # #    #      #     ##     #   ### #     # # # ## #
          #   #    # #    # #    #      #     ##     #        #   #  # #    #
          #   #    # #    # #    # ##   #    #  #    #         # #   # #    #
          #    ####  #####   ####  ##   #   #    #   #          #    # #    #

                        Efficient Todo.txt management in vim

## Table of Contents

1. [Release notes](#release-notes)
2. [Introduction](#introduction)
    1. [Todo.txt rules](#todo.txt-rules)
    2. [Why this Fork ?](#Why-this-fork)
    3. [Installation](#installation)
3. [TodoTxt Files](#todotxt-files)
4. [Completion](#completion)
5. [Hierarchical Sort](#hierarchical-sort)
6. [Recurrence](#recurrence)
7. [Mappings](#mappings)
    1. [Sort](#sort)
    2. [Priorities](#priorities)
    3. [Dates](#dates)
    4. [Done](#done)

## Release notes

+   V0.8.1 Incorporates yet another Fretep work : highlighting for tasks due today.

+   v0.8 Incorporates Fretep's work on overdue dates (PR#13 and PR#16) which
removes python dependency, allow to control the cursor position after a sort by
todo (see (sort)[#sort] and/or issue #15) and fixes bug when sorting a file
containing only lines with due:date (issue #14).

+   v0.7.6 Incorporates [Sietse's work](https://github.com/sietse/todo.txt-vim/commit/57d45200c8b033d31c9191ee0eb0711c801cdb1d) to make cancel and mark as done mapping repeatable using [vim-repeat](https://github.com/tpope/vim-repeat).
+   v0.7.5 Incorporates [Fievel's work](https://github.com/fievel/todo.txt-vim/commit/0863e1434e9a89ace06c4856b6cb32ba9906e3de) to make overduedates work on python3.
+   v0.7.4 includes the overduedate support from Guilherme Victal (see pull

    [request #45 on freitass version](https://github.com/freitass/todo.txt-vim/pull/45)),
    it highlight dates in overdue tasks as an Error. It depends on a
    Python library, however, and as such will only be able to work if your version
    of Vim was compiled with the `+python` option (as most common versions do).
 
    If your Vim installation does **not** have Python support, this plugin **will work just fine** but this feature will be disabled.


+   Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to update your vimrc (see [completion](#completion)).

## Introduction

Todo.txt-vim is a plugin to manage todo.txt files it was initially designed by
[Freitass](https://github.com/freitass/todo.txt-vim) then forked and improved
by David Beniamine.

### Todo.txt rules

Todo.txt is a standard human readable todo notes file defined [here](http://todotxt.com):

"The todo.txt format is a simple set of
[rules](https://github.com/todotxt/todotxt/)
that make todo.txt both human and machine-readable. The format supports
priorities, creation and completion dates, projects and contexts. That's
all you need to be productive. See an example Todo.txt file":

    (A) Call Mom @Phone +Family
    (A) Schedule annual checkup +Health
    (B) Outline chapter 5 +Novel @Computer
    (C) Add cover sheets @Office +TPSReports
    Plan backyard herb garden @Home
    Pick up milk @GroceryStore
    Research self-publishing services +Novel @Computer
    x Download Todo.txt mobile app @Phone

### Why this fork ?

This plugin is a fork of [freitass
todo.txt-vim](https://github.com/freitass/todo.txt-vim). It add several cool
functionalities including:

+ [Hierarchical sort](#hierarchical-sort)
+ [A completion function](#completion)
+ [A proper handling of due dates](#dates)
+ [A Flexible file naming](#todotxt-files).
+ Syntax Highlight for couples key:value.
+ `<LocalLeader>x` is a toggle which allow you to unmark a task as done.
+ `<LocalLeader>C` Toggle Mark a task cancelled
+ If the current buffer is a done.txt file, the basic sort sorts on
  completion date.
+ ...

### Installation

Todo.txt-vim is a filetype plugin, make sure that your vimrc contains :

```vim
syntax on
filetype plugin on
```

#### Vizardry

If you have [Vizardry](https://github.com/dbeniamine/vizardry) installed,
you can run from vim:

    :Invoke -u dbeniamine todo.txt-vim

#### Pathogen install

    git clone https://github.com/dbeniamine/todo.txt-vim.git ~/.vim/bundle/todo.txt-vim

Then from vim: `:Helptags` to update the doc

#### Quick install

        git clone https://github.com/dbeniamine/todo.txt-vim.git
        cd todo.txt-vim
        cp -r ./* ~/.vim


If you want the help installed, run `:helptags ~/.vim/doc` inside vim after
having copied the files.  Then you will be able to get the commands help with:
`:h todo.txt`

## TodoTxt Files

This plugin provides flexible file naming for todo.txt, all the following
names are recognized as todo:

    YYYY-MM-[Tt]odo.txt
    YYYY-MM-DD[Tt]odo.txt
    [Tt]odo-YYYY-MM.txt
    [Tt]odo-YYYY-MM-DD.txt
    [Tt]odo.txt
    [Tt]oday.txt
    .todo/*.txt
    $TODO_DIR/*.txt
    $TODO_FILE

Similarly, the following are recognized as done:

    YYYY-MM-[Dd]one.txt
    YYYY-MM-DD[Dd]one.txt
    [Dd]one-YYYY-MM.txt
    [Dd]one-YYYY-MM-DD.txt
    [Dd]one.txt
    [Dd]one-[Tt]oday.txt
    $DONE_FILE

Where `$TODO_DIR`, `$TODO_FILE`, and `$DONE_FILE` are optional environment variables
that correspond to those used by [todo.txt-cli](https://github.com/todotxt/todo.txt-cli/)

Moreover, `<LocalLeader>D` moves the task under the cursor to the done.txt
file corresponding to the current todo.txt, aka if you are editing
2015-07-07-todo.txt, the done file will be 2015-07-07-done.txt. If you don't
like this behavior, you can set the default done.txt name:

    let g:TodoTxtForceDoneName='done.txt'

## Completion

This plugin provides a nice complete function for project and context, to use
it add the following lines to your vimrc:

    " Use todo#Complete as the omni complete function for todo files
    au filetype todo setlocal omnifunc=todo#Complete

You can also start automatically the completion when entering '+' or '@' by
adding the next lines to your vimrc:

    " Auto complete projects
    au filetype todo imap <buffer> + +<C-X><C-O>

    " Auto complete contexts
    au filetype todo imap <buffer> @ @<C-X><C-O>


The `todo#Complete` function is designed to complete projects (starting by `+`)
and context (starting by `@`). If you use it on a regular word, it will do a
normal keyword completion (on all buffers).

If you try to complete a project, it will propose all projects in all open
buffers and for each of them, it will show their context and the name of the
buffers in which they appears in the preview window. It does the same thing
for context except that it gives in the preview the list of projects existing
in each existing contexts.

If you don't want the preview window to open when performing completion, add the
following lines to your vimrc:

    au filetype todo setlocal completeopt-=preview

If you would like the preview window to open even if there is only one match for
a completion, then add the following lines to your vimrc:

    au filetype todo setlocal completeopt+=menuone


## Hierarchical sort

This fork provides a hierarchical sorting function designed to do by project
and/or by context sorts and a priority sort.

+ `<LocalLeader>sc` : Sort the file by context then by priority
+ `<LocalLeader>scp` : Sort the file by context, project then by priority
+ `<LocalLeader>sp` : Sort the file by project then by priority
+ `<LocalLeader>spc` : Sort the file by project, context then by priority

The user can give argument for the two calls to vim sort function by changing
the following variables:

    g:Todo_txt_first_level_sort_mode
    g:Todo_txt_second_level_sort_mode

Defaults values are:


    g:Todo_txt_first_level_sort_mode="i"
    g:Todo_txt_second_level_sort_mode="i"


For more information on the available flags see `help :sort`

## Recurrence

By adding a `rec:` tag to your task, when you complete (`<LocalLeader>x`) or
postpone (`<LocalLeader>p`) the task, a new recurrence will be created due after
the specified amount of time.

The format is:
    `rec:[+][count][d|w|m|y]`

Where:
    d = days, w = weeks, m = months, y = years
    The optional `+` specifies strict recurrence (see below)

Examples:
    *   `rec:2w` - Recurs two weeks after the task is completed.
    *   `rec:3d` - Recurs three days after the task is completed.
    *   `rec:+1w` - Recurs one week from the due date (strict)

This is a non-standard but widely adopted keyword.

## Mappings

By default todo-txt.vim sets all the mappings described in this section. To
prevent this behavior, add the following line to your vimrc

   let g:Todo_txt_do_not_map=1



`<LocalLeader>` is \  by default, so ̀`<LocaLeader>-s` means you type \s

### Sort

+ `<LocalLeader>s` : Sort the file by priority
+ `<LocalLeader>s+` : Sort the file on `+Projects`
+ `<LocalLeader>s@` : Sort the file on `@Contexts`
+ `<LocalLeader>sc` : Sort the file by context then by priority
+ `<LocalLeader>scp` : Sort the file by context, project then by priority
+ `<LocalLeader>sp` : Sort the file by project then by priority
+ `<LocalLeader>spc` : Sort the file by project, context then by priority
+ `<LocalLeader>sd` : Sort the file on due dates. Entries with a due date appear
sorted by at the beginning of the file, completed tasks are moved to the bottom and
the rest of the file is not modified.

When you sort by due dates, at the end of the sort, your cursor will be placed
at the top of the file. This behavior can be set with the following global
variable :

    let g:TodoTxtSortDueDateCursorPos = "top"

Possible values are :

+ `top` (default): The first line of the buffer, i.e. your most outstanding task
+ `lastdue`: The last task with a due:date set
+ `notoverdue`: The first task that is not overdue (requires #13)
+ `bottom`: The last line of the buffer

### Priorities

+ `<LocalLeader>j` : Lower the priority of the current line
+ `<LocalLeader>k` : Increase the priority of the current line
+ `<LocalLeader>a` : Add the priority (A) to the current line
+ `<LocalLeader>b` : Add the priority (B) to the current line
+ `<LocalLeader>c` : Add the priority (C) to the current line

### Dates

+ `<LocalLeader>d` : Insert the current date
+ `<LocalLeader>p` : Postpone the due date (accepts a count)
+ `<LocalLeader>P` : Decrement the due date (accepts a count)
+ `date<tab>`  : (Insert mode) Insert the current date
+ `due:`  : (Insert mode) Insert `due:` followed by the current date
+ `DUE:`  : (Insert mode) Insert `DUE:` followed by the current date

If you would like the creation date (today) prefixed on new lines, add the
following to your vimrc:

    let g:Todo_txt_prefix_creation_date=1

With insert mode maps on, typing `date<Tab>` or `due:` can feel like glitches
This is because vim wait for mappings before inserting the words to the buffer.
To prevent the glitches, abbreviations can be used instead of mappings.
To turn it on, add the following to your vimrc:

    let g:TodoTxtUseAbbrevInsertMode=1

Abbreviations uses word separator to expand the abbreviations, thus `<Tab>`
is unavailable on abbreviations. Turning abbreviations mode will change
`date<Tab>` mapping into `date:`. The resulting abbreviations would be: 

+    `date:`  : (Insert mode) Insert the current date
+    `due:`  : (Insert mode) Insert `due:` followed by the current date
+    `DUE:`  : (Insert mode) Insert `DUE:` followed by the current date


### Done


+ `<LocalLeader>x` : Toggle mark task as done (inserts or remove current
+ date as completion date)
+ `<LocalLeader>C` : Toggle mark task cancelled
+ `<LocalLeader>X` : Mark all tasks as completed
+ `<LocalLeader>D` : Move completed tasks to done file, see [TodoTxt
Files](#todotxt-files)

When you mark an item with a priority as done, it is assigned a priority tag
like `pri:A` so that the priority can be restored if the item is toggled back
to undone. If you don't want the tags showing up in your done file, you can
disable this behavior by setting the following global variable:

    let g:TodoTxtStripDoneItemPriority=1

### Format

+ `<LocalLeader>ff` : Try to fix todo.txt format

## Fold

Todo.txt files can be folded by projects or context (see `:help fold`). By
default they are foldable by context. To use project fold add the following to
your vimrc:

    let g:Todo_fold_char='+'

Note that the fold method by default changes to match the sort order regardless
of what Todo_fold_char is set to.  If you prefer to keep the fold method
constant even after changing the sort method set the variable below as follows:

    let g:Todo_update_fold_on_sort=0