6 Commits

Author SHA1 Message Date
David Beniamine
41a75a8f50 FIX issue #2
FIX: hasmapto was use wrongly, there is now a setting to forbid todo-txt.vim to set
mappings.
FIX: There was a bug and MarkAllAsDone
2015-10-25 01:57:29 -02:00
David Beniamine
f3a3bdbefb link fix 2015-09-22 17:37:27 +02:00
David Beniamine
3089527c71 Documentation re written
Cleaner documentation
2015-09-22 16:59:36 +02:00
David Beniamine
7fdf0427a8 use <localleader>C for cancel as c is used for priority 2015-09-22 15:46:09 +02:00
David Beniamine
644b6d6628 Cancel tasks with <localleader>c 2015-09-16 17:02:42 +02:00
David Beniamine
d3b011b718 Vizardry install 2015-09-16 16:22:37 +02:00
4 changed files with 432 additions and 316 deletions

View File

@@ -1,90 +1,136 @@
# Readme # Todo.txt-vim
**Note:** Since v0.7.3, `TodoComplete` is `todo#Complete`, you might need to ##### # #
update your vimrc. # #### ##### #### ##### # # ##### # # # # #
# # # # # # # # # # # # # # ## ##
# # # # # # # # ## # ### # # # # ## #
# # # # # # # # ## # # # # # #
# # # # # # # ## # # # # # # # # #
# #### ##### #### ## # # # # # # # #
## What is this plugin ? 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. [Mappings](#mappings)
1. [Sort](#sort)
2. [Priorities](#priorities)
3. [Dates](#dates)
4. [Done](#done)
## Release notes
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/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format)
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 +FamilyNovel @Computer
(C) Add cover sheets @ComputerOffice +FamilyTPSReports
Plan backyard herb garden @ComputerHome
Pick up milk @ComputerGroceryStore
Research self-publishing services +FamilyNovel @ComputerComputer
x Download Todo.txt mobile app @ComputerPhone
### Why this fork ?
This plugin is a fork of [freitass This plugin is a fork of [freitass
todo.txt](https://github.com/freitass/todo.txt-vim). It add severals todo.txt-vim](https://github.com/freitass/todo.txt-vim). It add severals cool
functionalities including a [hierarchical sort](#sort), a functionalities including:
[complete](#completion) function, some stuff to handle [due
dates](#due-dates), a more [flexible file naming](#flexible-file-naming), and
others stuff see [new features](#new-features).
Freitass announced on october 30th 2014 that he is not going to merge his version. + [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.
+ ...
## Install ### Installation
### Quick install #### Vizardry
git clone https://github.com/dbeniamine/todo.txt-vim.git If you have [Vizardry](https://github.com/dbeniamine/vizardry) installed,
cd todo.txt-vim you can run from vim:
cp -r ./* ~/.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 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: having copied the files. Then you will be able to get the commands help with:
`:h todo.txt` `:h todo.txt`
### Pathogen install ## TodoTxt Files
git clone https://github.com/dbeniamine/todo.txt-vim.git ~/.vim/bundle/todo.txt-vim This plugin provides a Flexible file naming for todo.txt, all the following
names are recognized as todo:
Then from vim: `:Helptags` to update the doc 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
## Features included in Freitass version And obviously the same are recognize as done:
This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. It also defines a few mappings, to help with editing these files: 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
`<LocalLeader>s` : Sort the file 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 while be 2015-07-07-done.txt. If you don't
like this behavior, you can set the default done.txt name:
`<LocalLeader>s+` : Sort the file on +Projects let g:TodoTxtForceDoneName='done.txt'
`<LocalLeader>s@` : Sort the file on @Contexts ## Completion
`<LocalLeader>j` : Lower the priority of the current line This plugin provides a nice complete function for project and context, to use
it add the following lines to your vimrc:
`<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
`<LocalLeader>d` : Insert the current date
`date<tab>` : (Insert mode) Insert the current date
`<LocalLeader>x` : Toggle mark task as done (inserts current date as completion date)
`<LocalLeader>X` : Mark all tasks as completed
`<leader>-D` : Move completed tasks to done.txt
## New features
### 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 call to vim sort function by changing
the following variables in its vimrc:
see :help sort
let g:Todo_txt_first_level_sort_mode="! i"
let g:Todo_txt_second_level_sort_mode="i"
### Completion
We also provide 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 " Use todo#complete as the omni complete function for todo files
au filetype todo setlocal omnifunc=todo#complete au filetype todo setlocal omnifunc=todo#complete
@@ -98,66 +144,87 @@ adding the next lines to your vimrc:
" Auto complete contexts " Auto complete contexts
au filetype todo imap <buffer> @ @<C-X><C-O> 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 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). normal keyword completion (on all buffers).
If you try to complete a project, it will propose all projects in all open 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 and for each of them, it will show their context and the name of the
buffers in which they appears in the preview window. buffers in which they appears in the preview window. It does the same thing
TodoCompelte does the same thing for context except that it gives in the for context except that it gives in the preview the list of projects existing
preview the list of projects existing in each existing contexts. in each existing contexts.
### Due dates ## Hierarchical sort
I've integrated the [work from This fork provides a hierarchical sorting function designed to do by project
durcheinandr](https://github.com/durcheinandr/todo.txt-vim/) concerning due and/or by context sorts and a priority sort.
dates + some little improvements:
Accorrding to the todo.txt rules, one can define due dates using `due:date` or `<LocalLeader>sc` : Sort the file by context then by priority
`DUE:date` or any other `key:value` combination. This plugins handle dates at `<LocalLeader>scp` : Sort the file by context, project then by priority
the format `YYYY-MM-DD` and the key `due` can be spell using any combination `<LocalLeader>sp` : Sort the file by project then by priority
of lower and upper case letters. The following mappings are provided: `<LocalLeader>spc` : Sort the file by project, context then by priority
`<leader>-sd` : Sort the file by due-date. Entries with a due date appears 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`
## Mappings
By default todo-txt.vim set all the mappings secribed 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>s@` : Sort the file on due dates
+ `<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
+ `<leader>-sd` : Sort the file by due-date. Entries with a due date appears
sorted by at the beginning of the file, the rest of the file is not modified. sorted by at the beginning of the file, the rest of the file is not modified.
`due:` : (Insert mode) Insert `due:` followed by the current date ### Priorities
`DUE:` : (Insert mode) Insert `DUE:` followed by the current date + `<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
### Flexible File naming ### Dates
This plugin provides a Flexible file naming for todo.txt, all the following + `<LocalLeader>d` : Insert the current date
names are recognized as todo: + `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
YYYY-MM-[Tt]odo.txt ### Done
YYYY-MM-DD[Tt]odo.txt
[Tt]odo-YYYY-MM.txt
[Tt]odo-YYYY-MM-DD.txt
[Tt]odo.txt
[Tt]oday.txt
And obviously the same are recognize as done:
YYYY-MM-[Dd]one.txt + `<LocalLeader>x` : Toggle mark task as done (inserts or remove current
YYYY-MM-DD[Dd]one.txt + date as completion date)
[Dd]one-YYYY-MM.txt + `<LocalLeader>C` : Toggle mark task cancelled
[Dd]one-YYYY-MM-DD.txt + `<LocalLeader>X` : Mark all tasks as completed
[Dd]one.txt + `<LocalLeader>D` : Move completed tasks to done file, see [TodoTxt
[Dd]one-[Tt]oday.txt Files](#todotxt-files)
Moreover, remove complete tasks `<LocalLeader>D` moves the task to the
done.txt file corresponding to the current todo.txt, aka if you are editing
2015-07-07-todo.txt, the done file while 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'
### Others
`<LocalLeader>x` is a toggle which allow you to unmark a task as done.
Syntax highlighting for couples key:value
If the current buffer is a done.txt file, the basic sort sorts on completion
date.

View File

@@ -58,25 +58,33 @@ function! todo#PrependDate()
normal! 0"=strftime("%Y-%m-%d ") normal! 0"=strftime("%Y-%m-%d ")
P P
endfunction endfunction
function! todo#ToggleMarkAsDone(status) function! todo#ToggleMarkAsDone(status)
if (getline(".") =~ 'x\s*\d\{4\}') if (getline(".") =~ 'x\s*\d\{4\}')
:call todo#UnMarkAsDone(a:status) :call todo#UnMarkAsDone(a:status)
else else
:call todo#MarkAsDone(a:status) :call todo#MarkAsDone(a:status)
endif endif
endfunction endfunction
function! todo#UnMarkAsDone() function! todo#UnMarkAsDone(status)
if a:status==''
let pat=''
else
let pat=' '.a:status
endif
exec ':s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}'.pat.'\s*//g' exec ':s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}'.pat.'\s*//g'
endfunction endfunction
function! todo#MarkAsDone(status)
if a:status!=''
exec 'normal! I'.a:status.' '
endif endif
call todo#PrependDate() call todo#PrependDate()
normal! Ix normal! Ix
endfunction endfunction
function! todo#MarkAllAsDone() function! todo#MarkAllAsDone()
:g!/^x /:call todo#MarkAsDone('') :g!/^x /:call todo#MarkAsDone('')
endfunction endfunction

View File

@@ -1,112 +1,111 @@
*todo.txt* *Todo.txt-vim*
Note: Since v0.7.3, `TodoComplete` is `todo#Complete`, you might need to ##### # #
update your vimrc. # #### ##### #### ##### # # ##### # # # # #
# # # # # # # # # # # # # # ## ##
# # # # # # # # ## # ### # # # # ## #
# # # # # # # # ## # # # # # #
# # # # # # # ## # # # # # # # # #
# #### ##### #### ## # # # # # # # #
============================================================================== Efficient Todo.txt management in vim
COMMANDS *todo-commands*
`<LocalLeader>s` : Sort the file by priority
`<LocalLeader>s+` : Sort the file on +Projects
`<LocalLeader>s@` : Sort the file on @Contexts
`<LocalLeader>s@` : Sort the file on due dates
`<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
`<leader>-sd` : Sort the file by due-date. Entries with a due date appears
sorted by at the beginning of the file, the rest of the file is not modified.
`<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
`<LocalLeader>d` : Insert the current date
`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
`<LocalLeader>x` : Toggle mark task as done (inserts or remove current date as
completion date)
`<LocalLeader>X` : Mark all tasks as completed
`<LocalLeader>D` : Move completed tasks to done file, see |todo-flexibleFileNaming|
`<LocalLeader>` is \ by default, so ̀`<LocaLeader>-s` means you type \s
=============================================================================== ===============================================================================
CONFIGURATION *todo-configuration* Table of Contents *TodoTxt-Contents* ~
The user can give argument for the two calls to vim sort function by changing 1. Release notes.................................|TodoTxt-ReleaseNotes|
the following variables: 2. Introduction..................................|TodoTxt-Introduction|
2.1 Todo.txt rules...........................|TodoTxt-Rules|
g:Todo_txt_first_level_sort_mode 2.2 Why this Fork............................|TodoTxt-Fork|
g:Todo_txt_second_level_sort_mode 2.3 Installation.............................|TodoTxt-Installation|
3. TodoTxt Files.................................|TodoTxt-Files|
Defaults values are: 4. Completion....................................|TodoTxt-Completion|
5. Hierarchical Sort.............................|TodoTxt-HierarchicalSort|
> 6. Mappings......................................|TodoTxt-Mappings|
g:Todo_txt_first_level_sort_mode="i" 6.1 Sort.....................................|TodoTxt-Sort|
g:Todo_txt_second_level_sort_mode="i" 6.2 Priorities...............................|TodoTxt-Priorities|
< 6.3 Dates....................................|TodoTxt-Dates|
6.4 Done.txt.................................|TodoTxt-Done|
For more information on the available flags see help :sort
We also provide a nice complete function for project and context, to use it
add the following lines to your vimrc:
>
" Use todo#Completete as the omni complete 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>
<
To force completed task to be moved to a file independently from the current
file name, add the following to your vimrc:
>
let g:TodoTxtForceDoneName='done.txt'
<
For more explanations, see |todo-flexibleFileNaming|
=============================================================================== ===============================================================================
COMPLETION *todo-complete* 1. Release notes *TodoTxt-ReleaseNotes* ~
The `todo#Complete`te function is designed to complete projects (starting by '+') Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to
and context (starting by '@'). If you use it on a regular word, it will do a update your vimrc (see |TodoTxt-Completion|).
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.
TodoCompelte does the same thing for context except that it gives in the
preview the list of projects existing in each existing contexts.
=============================================================================== ===============================================================================
FLEXIBLE FILE NAMING *todo-flexibleFileNaming* 2. Introduction *TodoTxt-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.
2.1 Todo.txt rules *TodoTxt-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/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format)
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 +FamilyNovel @Computer
(C) Add cover sheets @ComputerOffice +FamilyTPSReports
Plan backyard herb garden @ComputerHome
Pick up milk @ComputerGroceryStore
Research self-publishing services +FamilyNovel @ComputerComputer
x Download Todo.txt mobile app @ComputerPhone
<
2.2 Why this fork ? *TodoTxt-Fork*
This plugin is a fork of freitass todo.txt-vim
(https://github.com/freitass/todo.txt-vim). It add severals cool
functionalities including:
+ Hierarchical sort: |TodoTxt-Sort| and |TodoTxt-HierarchicalSort|.
+ A completion function: |TodoTxt-Completion|.
+ A proper handling of due dates: |TodoTxt-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.
+ ...
2.3 Installation *TodoTxt-Installation*
+ 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`
===============================================================================
3. TodoTxt Files *TodoTxt-Files* ~
This plugin provides a Flexible file naming for todo.txt, all the following This plugin provides a Flexible file naming for todo.txt, all the following
names are recognized as todo: names are recognized as todo:
@@ -127,10 +126,130 @@ And obviously the same are recognize as done:
[Dd]one.txt [Dd]one.txt
[Dd]one-[Tt]oday.txt [Dd]one-[Tt]oday.txt
< <
Moreover, remove complete tasks `<LocalLeader>D` moves the task to the Moreover, `<LocalLeader>D` moves the task under the cursor to the done.txt
done.txt file corresponding to the current todo.txt, aka if you are editing file corresponding to the current todo.txt, aka if you are editing
2015-07-07-todo.txt, the done file while be 2015-07-07-done.txt. If you don't 2015-07-07-todo.txt, the done file while be 2015-07-07-done.txt. If you don't
like this behavior, you can set the default done.txt name: like this behavior, you can set the default done.txt name:
> >
let g:TodoTxtForceDoneName='done.txt' let g:TodoTxtForceDoneName='done.txt'
< <
===============================================================================
4. Completion *TodoTxt-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.
===============================================================================
5. Hierarchical sort *TodoTxt-HierarchicalSort* ~
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 |:sort|
===============================================================================
6. Mappings *TodoTxt-Mappings* ~
By default todo-txt.vim set all the mappings secribed in this section. To
prevent this behavior, add the following line to your vimrc
>
let g:Todo_txt_do_not_map=1
<
6.1 Sort *TodoTxt-Sort*
`<LocalLeader>s` : Sort the file by priority
`<LocalLeader>s+` : Sort the file on +Projects
`<LocalLeader>s@` : Sort the file on @Contexts
`<LocalLeader>s@` : Sort the file on due dates
`<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
`<leader>-sd` : Sort the file by due-date. Entries with a due date appears
sorted by at the beginning of the file, the rest of the file is not modified.
6.2 Priorities *TodoTxt-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
6.3 Dates *TodoTxt-Dates*
`<LocalLeader>d` : Insert the current date
`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
6.4 Done *TodoTxt-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|
`<LocalLeader>` is \ by default, so ̀`<LocaLeader>-s` means you type \s

View File

@@ -19,128 +19,50 @@ setlocal wrapmargin=0
" Mappings {{{1 " Mappings {{{1
if !exists("g:Todo_txt_do_not_map")
" Sort todo by (first) context " Sort todo by (first) context
if !hasmapto("<localleader>sc",'n')
noremap <silent><localleader>sc :call todo#HierarchicalSort('@', '', 1)<CR> noremap <silent><localleader>sc :call todo#HierarchicalSort('@', '', 1)<CR>
endif
if !hasmapto("<localleader>scp",'n')
noremap <silent><localleader>scp :call todo#HierarchicalSort('@', '+', 1)<CR>
endif
" Sort todo by (first) project
if !hasmapto("<localleader>sp",'n')
noremap <silent><localleader>sp :call todo#HierarchicalSort('+', '',1)<CR>
endif
if !hasmapto("<localleader>spc",'n')
noremap <silent><localleader>spc :call todo#HierarchicalSort('+', '@',1)<CR>
endif
noremap <silent><localleader>scp :call todo#HierarchicalSort('@', '+', 1)<CR>
" Sort todo by (first) project
noremap <silent><localleader>sp :call todo#HierarchicalSort('+', '',1)<CR>
noremap <silent><localleader>spc :call todo#HierarchicalSort('+', '@',1)<CR>
" Sort tasks {{{2 " Sort tasks {{{2
if !hasmapto("<localleader>s",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>s :call todo#Sort()<CR> nnoremap <script> <silent> <buffer> <LocalLeader>s :call todo#Sort()<CR>
endif
if !hasmapto("<LocalLeader>s@",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>s@ :sort /.\{-}\ze@/ <CR> nnoremap <script> <silent> <buffer> <LocalLeader>s@ :sort /.\{-}\ze@/ <CR>
endif
if !hasmapto("<LocalLeader>s+",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>s+ :sort /.\{-}\ze+/ <CR> nnoremap <script> <silent> <buffer> <LocalLeader>s+ :sort /.\{-}\ze+/ <CR>
endif " Priorities {{{2
noremap <script> <silent> <buffer> <LocalLeader>j :call todo#PrioritizeIncrease()<CR>
noremap <script> <silent> <buffer> <LocalLeader>k :call todo#PrioritizeDecrease()<CR>
if !hasmapto("<LocalLeader>j",'n') noremap <script> <silent> <buffer> <LocalLeader>a :call todo#PrioritizeAdd('A')<CR>
nnoremap <script> <silent> <buffer> <LocalLeader>j :call todo#PrioritizeIncrease()<CR> noremap <script> <silent> <buffer> <LocalLeader>b :call todo#PrioritizeAdd('B')<CR>
endif noremap <script> <silent> <buffer> <LocalLeader>c :call todo#PrioritizeAdd('C')<CR>
if !hasmapto("<LocalLeader>j",'v')
vnoremap <script> <silent> <buffer> <LocalLeader>j :call todo#PrioritizeIncrease()<CR>
endif
if !hasmapto("<LocalLeader>k",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>k :call todo#PrioritizeDecrease()<CR>
endif
if !hasmapto("<LocalLeader>k",'v')
vnoremap <script> <silent> <buffer> <LocalLeader>k :call todo#PrioritizeDecrease()<CR>
endif
if !hasmapto("<LocalLeader>a",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>a :call todo#PrioritizeAdd('A')<CR>
endif
if !hasmapto("<LocalLeader>a",'i')
inoremap <script> <silent> <buffer> <LocalLeader>a <ESC>:call todo#PrioritizeAdd('A')<CR>i
endif
if !hasmapto("<LocalLeader>a",'v')
vnoremap <script> <silent> <buffer> <LocalLeader>a :call todo#PrioritizeAdd('A')<CR>
endif
if !hasmapto("<LocalLeader>b",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>b :call todo#PrioritizeAdd('B')<CR>
endif
if !hasmapto("<LocalLeader>b",'i')
inoremap <script> <silent> <buffer> <LocalLeader>b <ESC>:call todo#PrioritizeAdd('B')<CR>i
endif
if !hasmapto("<LocalLeader>b",'v')
vnoremap <script> <silent> <buffer> <LocalLeader>b :call todo#PrioritizeAdd('B')<CR>
endif
if !hasmapto("<LocalLeader>c",'n')
nnoremap <script> <silent> <buffer> <LocalLeader>c :call todo#PrioritizeAdd('C')<CR>
endif
if !hasmapto("<LocalLeader>c",'i')
inoremap <script> <silent> <buffer> <LocalLeader>c <ESC>:call todo#PrioritizeAdd('C')<CR>i
endif
if !hasmapto("<LocalLeader>c",'v')
vnoremap <script> <silent> <buffer> <LocalLeader>c :call todo#PrioritizeAdd('C')<CR>
endif
" Insert date {{{2 " Insert date {{{2
if !hasmapto("date<Tab>",'i')
inoremap <script> <silent> <buffer> date<Tab> <C-R>=strftime("%Y-%m-%d")<CR> inoremap <script> <silent> <buffer> date<Tab> <C-R>=strftime("%Y-%m-%d")<CR>
endif
if !hasmapto("due:",'i')
inoremap <script> <silent> <buffer> due: due:<C-R>=strftime("%Y-%m-%d")<CR> inoremap <script> <silent> <buffer> due: due:<C-R>=strftime("%Y-%m-%d")<CR>
endif
if !hasmapto("DUE:",'i')
inoremap <script> <silent> <buffer> DUE: DUE:<C-R>=strftime("%Y-%m-%d")<CR> inoremap <script> <silent> <buffer> DUE: DUE:<C-R>=strftime("%Y-%m-%d")<CR>
endif
if !hasmapto("<localleader>d",'n') noremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR>
nnoremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR>
endif
if !hasmapto("<localleader>d",'v')
vnoremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR>
endif
" Mark done {{{2 " Mark done {{{2
if !hasmapto("<localleader>x",'n') noremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR>
nnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone()<CR>
endif " Mark done {{{2
noremap <script> <silent> <buffer> <localleader>C :call todo#ToggleMarkAsDone('Cancelled')<CR>
if !hasmapto("<localleader>x",'v')
vnoremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone()<CR>
endif
" Mark all done {{{2 " Mark all done {{{2
if !hasmapto("<localleader>X",'n') noremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR>
nnoremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR>
endif
" Remove completed {{{2 " Remove completed {{{2
if !hasmapto("<localleader>D",'n')
nnoremap <script> <silent> <buffer> <localleader>D :call todo#RemoveCompleted()<CR> nnoremap <script> <silent> <buffer> <localleader>D :call todo#RemoveCompleted()<CR>
endif
" Sort by due: date {{{2 " Sort by due: date {{{2
if !hasmapto("<localleader>sd".'n')
nnoremap <script> <silent> <buffer> <localleader>sd :call todo#SortDue()<CR> nnoremap <script> <silent> <buffer> <localleader>sd :call todo#SortDue()<CR>
endif endif