Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a103f1429 | ||
|
|
9f87eec204 | ||
|
|
53ad73ebda | ||
|
|
68a32427ab |
@@ -3,9 +3,11 @@
|
||||
## What is this plugin ?
|
||||
|
||||
This plugin is a fork of [freitass
|
||||
todo.txt](https://github.com/freitass/todo.txt-vim). It add severals functionalities including a [hierarchical sort](#sort), a
|
||||
[complete](#completion) function, some stuff to handle [due dates](#due-dates)
|
||||
and others stuff see [new features](#new-features).
|
||||
todo.txt](https://github.com/freitass/todo.txt-vim). It add severals
|
||||
functionalities including a [hierarchical sort](#sort), a
|
||||
[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.
|
||||
|
||||
@@ -120,6 +122,34 @@ 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
|
||||
|
||||
### Flexible File naming
|
||||
|
||||
This plugin provides a 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
|
||||
|
||||
And obviously the same are recognize 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
|
||||
|
||||
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.
|
||||
|
||||
49
doc/todo.txt
49
doc/todo.txt
@@ -45,9 +45,9 @@ sorted by at the beginning of the file, the rest of the file is not modified.
|
||||
|
||||
`<LocalLeader>X` : Mark all tasks as completed
|
||||
|
||||
`<LocalLeader>D` : Move completed tasks to done.txt
|
||||
`<LocalLeader>D` : Move completed tasks to done file, see |todo-flexibleFileNaming|
|
||||
|
||||
<LocalLeader> is \ by default, so <leader>-s means you type \s
|
||||
`<LocalLeader>` is \ by default, so ̀`<LocaLeader>-s` means you type \s
|
||||
|
||||
===============================================================================
|
||||
CONFIGURATION *todo-configuration*
|
||||
@@ -60,26 +60,35 @@ 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
|
||||
|
||||
We also provide a nice complete function for project and context, to use it
|
||||
add the following lines to your vimrc:
|
||||
|
||||
>
|
||||
" Use TodoComplete as the omni complete for todo files
|
||||
au filetype todo setlocal omnifunc=TodoComplete
|
||||
<
|
||||
|
||||
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*
|
||||
@@ -92,3 +101,33 @@ 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*
|
||||
|
||||
This plugin provides a 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
|
||||
<
|
||||
And obviously the same are recognize 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
|
||||
<
|
||||
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'
|
||||
<
|
||||
|
||||
@@ -3,8 +3,17 @@
|
||||
" Author: David Beniamine <david@beniamine.net>, Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/dbeniamine/todo.txt-vim
|
||||
" Version: 0.7
|
||||
" Version: 0.7.2
|
||||
|
||||
autocmd BufNewFile,BufRead [Tt]odo.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Tt]odo-\d\\\{4\}-\d\\\{2\}-\d\\\{2\}.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Tt]odo-\d\\\{4\}-\d\\\{2\}.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-\d\\\{2\}-[Tt]odo.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-[Tt]odo.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Tt]oday.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Dd]one.txt set filetype=todo
|
||||
|
||||
autocmd BufNewFile,BufRead [Dd]one-\d\\\{4\}-\d\\\{2\}-\d\\\{2\}.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Dd]one-\d\\\{4\}-\d\\\{2\}.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-\d\\\{2\}-[Dd]one.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead \d\\\{4\}-\d\\\{2\}-[Dd]one.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Dd]one-[Tt]oday.txt set filetype=todo
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Author: David Beniamine <David@Beniamine.net>, Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/dbeniamine/todo.txt-vim
|
||||
" Version: 0.7.1
|
||||
" Version: 0.7.2
|
||||
|
||||
" Save context {{{1
|
||||
let s:save_cpo = &cpo
|
||||
@@ -65,7 +65,13 @@ endfunction
|
||||
|
||||
function! TodoTxtRemoveCompleted()
|
||||
" Check if we can write to done.txt before proceeding.
|
||||
let l:target_dir = expand('%:p:h')
|
||||
let l:target_dir = expand('%:p:h')
|
||||
if exists("g:TodoTxtForceDoneName")
|
||||
let l:done=g:TodoTxtForceDoneName
|
||||
else
|
||||
let l:done=substitute(substitute(expand('%:t'),'todo','done',''),'Todo','Done','')
|
||||
fi
|
||||
let l:done_file = l:target_dir.'/'.l:done
|
||||
echo "Writing to ".l:done_file
|
||||
if !filewritable(l:done_file) && !filewritable(l:target_dir)
|
||||
echoerr "Can't write to file 'done.txt'"
|
||||
@@ -79,7 +85,7 @@ endfunction
|
||||
|
||||
function! TodoTxtSort()
|
||||
" vim :sort is usually stable
|
||||
" we sort first on contexts, then on projects and then on priority
|
||||
" we sort first on contexts, then on projects and then on priority
|
||||
if expand('%')=~'done.*.txt'
|
||||
silent! %s/\(x\s*\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g
|
||||
sort n /^x\s*/
|
||||
@@ -326,6 +332,7 @@ fun! TodoComplete(findstart, base)
|
||||
endfor
|
||||
call sort(res)
|
||||
" Here all results are sorted in res, but we need to merge them
|
||||
let ret=[]
|
||||
if res != []
|
||||
let curitem={}
|
||||
let curitem.word=res[0].word
|
||||
@@ -353,6 +360,7 @@ fun! TodoComplete(findstart, base)
|
||||
let curitem.related=[it.related]
|
||||
let curitem.buffers=[it.buffers]
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
return ret
|
||||
endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Author: David Beniamine <david@beniamine.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://github.com/dbeniamine/todo.txt.vim
|
||||
" Version: 0.7
|
||||
" Version: 0.7.2
|
||||
" vim: ts=4 sw=4 :help tw=78 cc=80
|
||||
|
||||
" These two variables are parameters for the successive calls the vim sort
|
||||
@@ -32,7 +32,7 @@ if !hasmapto("<localleader>sp",'n')
|
||||
noremap <localleader>sp :call Todo_txt_HierarchicalSort('+', '',1)<CR>
|
||||
endif
|
||||
if !hasmapto("<localleader>spc",'n')
|
||||
noremap <localleader>spc :call Todo_txt_HierarchicalSort('+', '@',0)<CR>
|
||||
noremap <localleader>spc :call Todo_txt_HierarchicalSort('+', '@',1)<CR>
|
||||
endif
|
||||
|
||||
" This is a Hierarchical sort designed for todo.txt todo lists, however it
|
||||
@@ -63,42 +63,39 @@ function! Todo_txt_HierarchicalSort(symbol, symbolsub, dolastsort)
|
||||
let l:linecount=str2nr(split(v:statusmsg)[7])
|
||||
|
||||
" Get all the groups names
|
||||
let l:groups=GetGroups(a:symbol,0,l:linecount)
|
||||
|
||||
let l:groups=GetGroups(a:symbol,1,l:linecount)
|
||||
" Sort by groups
|
||||
execute 'sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/'
|
||||
for l:g in l:groups
|
||||
let l:pat=a:symbol.l:g.'.*$'
|
||||
normal gg
|
||||
" Find the beginning of the group
|
||||
execute '/'.a:symbol.l:g.'.*$'
|
||||
let l:groupBegin=getpos(".")[1]
|
||||
let l:groupBegin=search(l:pat,'c')
|
||||
" Find the end of the group
|
||||
silent normal N
|
||||
let l:groupEnd=getpos(".")[1]
|
||||
let l:groupEnd=search(l:pat,'b')
|
||||
|
||||
" I'm too lazy to sort one groups of one line
|
||||
" I'm too lazy to sort groups of one line
|
||||
if(l:groupEnd==l:groupBegin)
|
||||
continue
|
||||
endif
|
||||
if a:dolastsort
|
||||
if( a:symbolsub!='')
|
||||
" Sort by subgroups
|
||||
let l:subgroups=GetGroups(a:symbolsub,l:groupBegin,l:groupEnd)
|
||||
" Go before the first line of the group
|
||||
" Sort the group using the second symbol
|
||||
for l:sg in l:subgroups
|
||||
normal gg
|
||||
let l:pat=a:symbol.l:g.'.*'.a:symbolsub.l:sg.'.*$\|'.a:symbolsub.l:sg.'.*'.a:symbol.l:g.'.*$'
|
||||
" Find the beginning of the subgroup
|
||||
execute '/'.a:symbol.l:g.'.*'.a:symbolsub.l:sg.'.*$\|'.a:symbolsub.l:sg.'.*'.a:symbol.l:g.'.*$'
|
||||
let l:subgroupBegin=getpos(".")[1]
|
||||
let l:subgroupBegin=search(l:pat,'c')
|
||||
" Find the end of the subgroup
|
||||
silent normal N
|
||||
let l:subgroupEnd=getpos(".")[1]
|
||||
let l:subgroupEnd=search(l:pat,'b')
|
||||
" Sort by priority
|
||||
if a:dolastsort
|
||||
execute l:subgroupBegin.','.l:subgroupEnd.'sort'.l:sortmodefinal
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
" Sort by priority
|
||||
if a:dolastsort
|
||||
execute l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Author: David Beniamine <David@Beniamine.net>,Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/dbeniamine/todo.txt-vim
|
||||
" Version: 0.7
|
||||
" Version: 0.7.2
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -37,7 +37,7 @@ syntax match TodoPriorityX '^([xX])\s.\+$' contains=TodoKey,TodoD
|
||||
syntax match TodoPriorityY '^([yY])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext
|
||||
syntax match TodoPriorityZ '^([zZ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext
|
||||
syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=NONE
|
||||
syntax match TodoKey '\S*:\S*' contains=TodoDate
|
||||
syntax match TodoKey '\S*\S:\S\S*' contains=TodoDate
|
||||
syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=NONE
|
||||
syntax match TodoContext '\(^\|\W\)@[^[:blank:]]\+' contains=NONE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user