85 Commits

Author SHA1 Message Date
David Beniamine
5287e928fc Integrating sietse's work, version 0.7.6 2017-09-10 11:52:41 +02:00
Sietse Brouwer
57d45200c8 Enable vim-repeat for Done and Cancel 2017-08-08 11:09:22 +02:00
Rene Vergara
484c12771e Improve todo#PrependDate to follow format
Add logic to place the completion date after the priority, if it exists,
when completing a task.
2017-04-05 11:15:59 -05:00
David Beniamine
f77215ca80 Fix issue #11
Complete function assumed that a line started with x <date> or a
priority which is not necessarily true, thus some lines where ignored
from completion.
2017-03-30 18:57:18 +02:00
David Beniamine
849a7d5f61 Better way to put done at the end
+ Limit side effects
+ Sort done entries at the end
+ Work fine also without done entries
2016-11-25 11:26:44 +01:00
David Beniamine
0e2b110903 Merge remote-tracking branch 'dkarwowski/master' 2016-11-25 10:33:30 +01:00
David Beniamine
aad48b0231 Merge pull request #10 from victal/master
Fix overduedate regex breaking in November
2016-11-04 14:02:50 +01:00
Guilherme Victal
81e64682d0 Fix overduedate regex breaking in November 2016-11-04 09:46:42 -02:00
David Karwowski
303ab65237 priorities at top, x at bottom 2016-09-28 12:31:37 -04:00
David Beniamine
c2eb67f1a6 Version 0.7.5
No major changes, yet the merge with Fievel's work impacts considerably
the git tree thus a minor version update.
2016-09-05 15:46:52 +02:00
David Beniamine
85c215b4cc Use python3 if available
This commit incorporates [fievel's work](0863e1434e) to use python3 if possible.

I have not personally test vim+python3 but overdue dates still works with
python2.
2016-09-05 15:36:31 +02:00
David Beniamine
3e3251f8b5 Fievel work for python3 support 2016-09-05 15:26:03 +02:00
Florent Fievez
0863e1434e Vim distributed on recent linux distribution is now linked with
python3. Ensure compatibility with it.
2016-08-09 14:57:43 +02:00
David Beniamine
ca8ae307d3 removed error message if no python support 2016-05-20 19:46:48 +02:00
David Beniamine
95d97151c5 Remove unused files from freitass 2016-05-14 12:22:11 +02:00
David Beniamine
1cdb39032f Doc updated 2016-05-14 12:15:22 +02:00
David Beniamine
f3c5e7b892 Included Guilherme Victal works on overduedate
See https://github.com/freitass/todo.txt-vim/pull/45
2016-05-14 12:03:55 +02:00
Leandro Freitas
1e3a5e58ae Merge pull request #47 from colinsullivan/complete_all_grey
When tasks are completed, make the entire line grey.
2016-03-09 10:22:42 -03:00
Colin Sullivan
89570cbaef When tasks are completed, make the entire line grey. 2016-03-08 09:37:44 -08:00
David Beniamine
a21fd1198c Fix missing items in completion
FIX: This commit fix dbeniamine/todo.txt-vim#7 some the last completion item
was not added to the completion list
CHG: This commit also provide a small refactor of todo#Complete
2016-02-09 22:31:00 +01:00
David Beniamine
7515fde8ae Fix bad todo#Complete name
see issue#7
2016-02-09 20:53:58 +01:00
Leandro Freitas
4548961329 Merge pull request #46 from rleon/fix-trailing-space
Fix wrong prefix for completed tasks
2016-01-28 14:33:29 -02:00
Leon Romanovsky
8dd24d0b68 Fix wrong prefix for completed tasks
The commit a612ebe ('Remove trailing whitespaces') removed the
whitespace which was after 'x' markup. It caused to mark the
completed task without space and didn't allow to remove it
automatically.

Before this change:
xCOMPLETION_DATE ....
After this change:
x COMPLETION_DATE ...

Fixes: a612ebe ('Remove trailing whitespaces')
Signed-off-by: Leon Romanovsky <leon@leon.nu>
2016-01-28 16:17:37 +02:00
Leandro Freitas
e2a02d4f30 Fix link to issue 2016-01-27 14:25:17 -02:00
Leandro Freitas
595fc0b49e Reinserted some of the trailing spaces
They were important for markdown formatting after all.
2016-01-27 14:24:22 -02:00
Leandro Freitas
a612ebeaf1 Remove trailing whitespaces 2016-01-27 14:09:17 -02:00
Leandro Freitas
17a2345675 Ignore .pyc files 2016-01-27 14:09:00 -02:00
Leandro Freitas
e13eb4bb9c Merge pull request #45 from victal/master
Syntax Highlight for overdue dates
2016-01-27 14:01:46 -02:00
Guilherme Victal
d769f12710 Embed dateregex instead of using a submodule 2016-01-27 11:01:57 -02:00
Guilherme Victal
2535cf2ece Remove dateregex submodule 2016-01-27 10:53:13 -02:00
Guilherme Victal
eb7f7cb8f4 Add plugin manager notice 2016-01-26 21:02:22 -02:00
Guilherme Victal
87a6c371dd Add Overdue Date group to (Z) tasks syntax match 2016-01-26 20:56:48 -02:00
Guilherme Victal
29a6ea4b1d Add description and license info 2016-01-26 10:29:37 -02:00
Guilherme Victal
03501dfe42 Remove test on syntax file 2016-01-26 09:32:10 -02:00
victal
fc0b4c3272 Update README with +python warning 2016-01-25 10:02:02 -02:00
Guilherme Victal
b87c7dd98d Correct .gitmodules file 2016-01-24 17:23:50 -02:00
Guilherme Victal
7232106f45 Move python scripts to syntax/ 2016-01-24 17:22:24 -02:00
Guilherme Victal
6e1bcc0e1a Overdue date syntax highlight 2016-01-24 16:57:01 -02:00
Guilherme Victal
03f5575363 Add syntax highlight for overdue dates 2016-01-22 22:09:20 -02:00
David Beniamine
2e2d39daee Merge branch 'patch-1' of https://github.com/ultrablue/todo.txt-vim 2015-12-18 10:31:42 +01:00
David Beniamine
a03d01e58e Get linescount in a more conventional way
This should solve issue #5 see
https://github.com/dbeniamine/todo.txt-vim/issues/5
2015-12-18 10:17:26 +01:00
David Beniamine
81c2772905 Add debug info in hierarchical sort
ADD: Debug info needed for solving issue #5
FIX: Incomplete group detection in hierarchical sort (should not impact
    issue #5)
2015-12-17 23:23:10 +01:00
David Beniamine
b6d5dc6bb9 Fix issue #6 : typo in the documentation
See https://github.com/dbeniamine/todo.txt-vim/issues/6
2015-12-17 10:56:11 +01:00
David Beniamine
f9a007ac58 Merge branch 'citec-fix_getcurpos_missing' 2015-12-08 10:52:05 +01:00
David Beniamine
45bfb325ae FIX getcurpos incompatibility with old versions
It seems that getcurpos() (used on PrioritizeAdd) appeared on vim 7.4.313
therefore using it was causing troubles to some users ...
2015-12-08 10:51:21 +01:00
David Beniamine
081d9d2e3a Merge branch 'fix_getcurpos_missing' of https://github.com/citec/todo.txt-vim into citec-fix_getcurpos_missing 2015-12-08 10:41:53 +01:00
Greg
4d819f888b Update README.markdown
It looks like there's a typo on line 136; the function appears to be todo#Complete, not todo#complete.
2015-12-02 16:49:23 -07:00
Leandro Freitas
b3d9e18b08 Merge pull request #43 from JonathanReeve/due-date
add ability to sort on due dates
2015-10-25 17:35:39 -02:00
Jonathan Reeve
a98711da91 add documentation for new feature 2015-10-25 14:54:25 -04:00
Jonathan Reeve
0a917143c5 sort by due date 2015-10-25 14:49:23 -04:00
Jaime Alberto Sanchez Hidalgo
cc281c47eb FIX getcurpos invalid expression 2015-10-20 08:43:13 -02:00
Leandro Freitas
c13a277e2a Merge branch 'master' of https://github.com/freitass/todo.txt-vim 2015-08-03 14:22:57 -03:00
Leandro Freitas
421916b25d Fixes #42 2015-08-03 14:22:30 -03:00
Leandro Freitas
8da977113b Fixes 42 2015-08-03 14:21:49 -03:00
Leandro Freitas
2a04312e8d Merge pull request #40 from siddharthist/master
Clarified which files are considered todo.txt
2015-05-21 14:01:41 -03:00
siddharthist
85b2e86b73 Clarified which files are considered todo.txt 2015-05-21 10:39:33 -05:00
Leandro Freitas
1e465dd931 Fixes #39: Completion date replaces creation date. 2015-05-20 17:13:27 -03:00
Leandro Freitas
79e4d352a2 Renamed function to reflect its implementation 2015-05-20 17:12:46 -03:00
Leandro Freitas
ddbcdd823f fixup! Fixes #37. Inserting date on new tasks 2015-05-18 19:03:57 -03:00
Leandro Freitas
77cfafb9f0 Fixes #37. Inserting date on new tasks 2015-05-14 14:55:31 -03:00
Leandro Freitas
fbc45c5c8c Fixed README formatting 2015-05-06 16:59:44 -03:00
Leandro Freitas
6c5a37e6c6 Improved README 2015-05-06 16:50:08 -03:00
Leandro Freitas
25a63d5ecd Improved documentation 2015-05-06 16:39:14 -03:00
Leandro Freitas
04210abd70 Fixes #37. Replacing existing priority 2015-05-06 10:00:35 -03:00
Leandro Freitas
649f962211 Fixes #37. Replacing existing date 2015-05-06 09:47:04 -03:00
Leandro Freitas
b1ed8608d1 Fixes 'date' test 2015-05-05 09:52:28 -03:00
Leandro Freitas
f30ac979a1 Fixes 'mark as done' test 2015-05-05 09:50:50 -03:00
Leandro Freitas
40faa56012 Fixes #9 2015-05-05 09:37:02 -03:00
Leandro Freitas
51c821b5da Inserted date do note. 2015-04-22 10:31:31 -03:00
Leandro Freitas
6c073cdb42 Added note on mappings change. 2015-04-22 09:11:26 -03:00
Leandro Freitas
e508140f90 When sorting on date, tasks with no date go to the end. 2015-04-17 11:31:40 -03:00
Leandro Freitas
d0080e66f9 Testing functions only (not mappings). 2015-04-17 09:04:30 -03:00
Leandro Freitas
e071156b8d Fixes #16 2015-04-17 08:38:08 -03:00
Leandro Freitas
1f8b706d8e Fixes #28 2015-04-16 23:10:49 -03:00
Leandro Freitas
0e3c5cb2b6 Major refactoring 2015-04-16 22:56:09 -03:00
Leandro Freitas
32188000f9 Added documentation for sorting on dates. 2015-04-16 21:31:41 -03:00
Leandro Freitas
1cc11c56ad Sorting tasks by date. 2015-04-16 20:47:53 -03:00
Leandro Freitas
639fcd85a2 Implemented sorting on visual selection. 2015-04-16 20:25:58 -03:00
Leandro Freitas
b8a5bd64ca Testing date functions 2015-04-12 11:42:29 -03:00
Leandro Freitas
95ed508741 Added test cases for sorting and marking as done. 2015-04-11 11:28:33 -03:00
Leandro Freitas
05b5be07d2 Hopefully fixes #30 2015-04-11 11:25:28 -03:00
Leandro Freitas
08fcb4ccdb Merge branch 'master' of https://github.com/freitass/todo.txt-vim 2015-04-07 22:29:32 -03:00
Leandro Freitas
e817f5eca8 Merge pull request #32 from naught101/prefixed_files
Allow prefixed files like blah.todo.txt. Fixes #29
2015-04-07 22:28:37 -03:00
Leandro Freitas
2d83ed8dc2 Fixes #30 2015-04-07 21:49:51 -03:00
naught101
52e1527e9b allow prefixed files like blah.todo.txt 2015-04-07 22:55:42 +10:00
12 changed files with 500 additions and 66 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
*.swp *.swp
doc/tags doc/tags
*.pyc

View File

@@ -28,8 +28,19 @@
## Release notes ## Release notes
Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to + 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).
update your vimrc (see [completion](#completion)). + 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 ## Introduction
@@ -132,8 +143,8 @@ like this behavior, you can set the default done.txt name:
This plugin provides a nice complete function for project and context, to use This plugin provides a nice complete function for project and context, to use
it add the following lines to your vimrc: 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
You can also start automatically the completion when entering '+' or '@' by You can also start automatically the completion when entering '+' or '@' by
adding the next lines to your vimrc: adding the next lines to your vimrc:
@@ -145,7 +156,7 @@ adding the next lines to your vimrc:
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 `+`) 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 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).
@@ -196,7 +207,7 @@ prevent this behavior, add the following line to your vimrc
+ `<LocalLeader>s` : Sort the file by priority + `<LocalLeader>s` : Sort the file by priority
+ `<LocalLeader>s+` : Sort the file on `+Projects` + `<LocalLeader>s+` : Sort the file on `+Projects`
+ `<LocalLeader>s@` : Sort the file on `@Contexts` + `<LocalLeader>s@` : Sort the file on `@Contexts`
+ `<LocalLeader>s@` : Sort the file on due dates + `<LocalLeader>sd` : Sort the file on due dates
+ `<LocalLeader>sc` : Sort the file by context then by priority + `<LocalLeader>sc` : Sort the file by context then by priority
+ `<LocalLeader>scp` : Sort the file by context, project 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>sp` : Sort the file by project then by priority

View File

@@ -3,7 +3,6 @@
" Author: David Beniamine <david@beniamine.net> " Author: David Beniamine <david@beniamine.net>
" Licence: Vim licence " Licence: Vim licence
" Website: http://github.com/dbeniamine/todo.txt.vim " Website: http://github.com/dbeniamine/todo.txt.vim
" Version: 0.7.3
" vim: ts=4 sw=4 :help tw=78 cc=80 " vim: ts=4 sw=4 :help tw=78 cc=80
" These two variables are parameters for the successive calls the vim sort " These two variables are parameters for the successive calls the vim sort
@@ -23,6 +22,14 @@ endif
" Functions {{{1 " Functions {{{1
function! todo#GetCurpos()
if exists("*getcurpos")
return getcurpos()
endif
return getpos('.')
endfunction
" Increment and Decrement The Priority " Increment and Decrement The Priority
:set nf=octal,hex,alpha :set nf=octal,hex,alpha
@@ -35,7 +42,7 @@ function! todo#PrioritizeDecrease()
endfunction endfunction
function! todo#PrioritizeAdd (priority) function! todo#PrioritizeAdd (priority)
let oldpos=getcurpos() let oldpos=todo#GetCurpos()
let line=getline('.') let line=getline('.')
if line !~ '^([A-F])' if line !~ '^([A-F])'
:call todo#PrioritizeAddAction(a:priority) :call todo#PrioritizeAddAction(a:priority)
@@ -55,7 +62,11 @@ function! todo#RemovePriority()
endfunction endfunction
function! todo#PrependDate() function! todo#PrependDate()
if (getline(".") =~ '\v^\(')
execute "normal! 0f)a\<space>\<esc>l\"=strftime(\"%Y-%m-%d\")\<esc>P"
else
normal! 0"=strftime("%Y-%m-%d ") normal! 0"=strftime("%Y-%m-%d ")
P
endif endif
endfunction endfunction
@@ -130,9 +141,28 @@ function! todo#Sort()
silent! %s/\(x\s*\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g silent! %s/\(x\s*\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g
sort n /^x\s*/ sort n /^x\s*/
silent! %s/\(x\s*\d\{4}\)\(\d\{2}\)/\1-\2-/g silent! %s/\(x\s*\d\{4}\)\(\d\{2}\)/\1-\2-/g
else
let oldcursor=getpos(".")
silent normal gg
let l:first=search('^\s*x')
if l:first != 0
sort /^./r
" at this point done tasks are at the end
let l:first=search('^\s*x')
let l:last=search('^\s*x','b')
let l:diff=l:last-l:first+1
" Cut the done lines
execute ':'.l:first.'d a '.l:diff
endif endif
sort /@[a-zA-Z]*/ r sort /@[a-zA-Z]*/ r
sort /+[a-zA-Z]*/ r sort /+[a-zA-Z]*/ r
sort /\v([A-Z])/ r
if l:first != 0
silent normal G"ap
execute ':'.l:first.','.l:last.'sort /@[a-zA-Z]*/ r'
execute ':'.l:first.','.l:last.'sort /+[a-zA-Z]*/ r'
execute ':'.l:first.','.l:last.'sort /\v([A-Z])/ r'
endif
call cursor(oldcursor) call cursor(oldcursor)
endif endif
endfunction endfunction
@@ -179,16 +209,28 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort)
let l:sortmodesub=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_second_level_sort_mode) let l:sortmodesub=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_second_level_sort_mode)
let l:sortmodefinal=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_third_level_sort_mode) let l:sortmodefinal=Todo_txt_InsertSpaceIfNeeded(g:Todo_txt_third_level_sort_mode)
" Count the number of lines " Count the number of lines
let l:position= getpos(".") let l:position= todo#GetCurpos()
execute "silent normal g\<c-g>" execute "silent normal G"
let l:linecount=getpos(".")[1]
if(exists("g:Todo_txt_debug"))
echo "Linescount: ".l:linecount
endif
execute "silent normal gg" execute "silent normal gg"
" Get all the groups names " Get all the groups names
let l:groups=GetGroups(a:symbol,1,l:linecount)
if(exists("g:Todo_txt_debug"))
echo "Groups: "
echo l:groups
echo 'execute sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/'
endif endif
" Sort by groups " Sort by groups
execute 'sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/' execute 'sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/'
for l:g in l:groups for l:g in l:groups
let l:pat=a:symbol.l:g.'.*$'
if(exists("g:Todo_txt_debug"))
echo l:pat
endif endif
normal gg normal gg
" Find the beginning of the group " Find the beginning of the group
@@ -217,6 +259,9 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort)
execute l:subgroupBegin.','.l:subgroupEnd.'sort'.l:sortmodefinal execute l:subgroupBegin.','.l:subgroupEnd.'sort'.l:sortmodefinal
endfor endfor
else else
" Sort by priority
if(exists("g:Todo_txt_debug"))
echo 'execute '.l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal
endif endif
execute l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal execute l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal
endif endif
@@ -231,7 +276,7 @@ function! GetGroups(symbol,begin, end)
function! GetGroups(symbol,begin, end) function! GetGroups(symbol,begin, end)
let l:curline=a:begin let l:curline=a:begin
let l:groups=[] let l:groups=[]
while l:curline <= a:end while l:curline <= a:end
let l:curproj=strpart(matchstr(getline(l:curline),a:symbol.'\S*'),1) let l:curproj=strpart(matchstr(getline(l:curline),a:symbol.'\S*'),1)
if l:curproj != "" && index(l:groups,l:curproj) == -1 if l:curproj != "" && index(l:groups,l:curproj) == -1
let l:groups=add(l:groups , l:curproj) let l:groups=add(l:groups , l:curproj)
@@ -254,7 +299,7 @@ endfunction
" Completion {{{1 " Completion {{{1
" Simple keyword completion on all buffers {{{2 " Simple keyword completion on all buffers {{{2
function! TodoKeywordComplete(base) function! TodoKeywordComplete(base)
" Search for matches " Search for matches
let res = [] let res = []
for bufnr in range(1,bufnr('$')) for bufnr in range(1,bufnr('$'))
@@ -270,6 +315,25 @@ function! TodoKeywordComplete(base)
endfor endfor
return res return res
endfunction endfunction
" Convert an item to the completion format and add it to the completion list
fun! TodoAddToCompletionList(list,item,opp)
" Create the definitive item
let resitem={}
let resitem.word=a:item.word
let resitem.info=a:opp=='+'?"Projects":"Contexts"
let resitem.info.=": ".join(a:item.related, ", ")
\."\nBuffers: ".join(a:item.buffers, ", ")
call add(a:list,resitem)
endfun
fun! TodoCopyTempItem(item)
let ret={}
let ret.word=a:item.word
let ret.related=[a:item.related]
let ret.buffers=[a:item.buffers]
return ret
endfun
" Intelligent completion for projects and Contexts {{{2 " Intelligent completion for projects and Contexts {{{2
fun! todo#Complete(findstart, base) fun! todo#Complete(findstart, base)
@@ -290,7 +354,7 @@ fun! todo#Complete(findstart, base)
let res = [] let res = []
for bufnr in range(1,bufnr('$')) for bufnr in range(1,bufnr('$'))
let lines=getbufline(bufnr,1,"$") let lines=getbufline(bufnr,1,"$")
for line in lines for line in lines
if line =~ " ".a:base if line =~ " ".a:base
" init temporary item " init temporary item
let item={} let item={}
@@ -304,10 +368,7 @@ fun! todo#Complete(findstart, base)
call sort(res) call sort(res)
" Here all results are sorted in res, but we need to merge them " Here all results are sorted in res, but we need to merge them
let ret=[] let ret=[]
if res != [] if res != []
let curitem={}
let curitem.word=res[0].word
let curitem.related=[]
let curitem=TodoCopyTempItem(res[0]) let curitem=TodoCopyTempItem(res[0])
for it in res for it in res
if curitem.word==it.word if curitem.word==it.word
@@ -318,19 +379,14 @@ fun! todo#Complete(findstart, base)
if index(curitem.buffers,it.buffers) <0 if index(curitem.buffers,it.buffers) <0
call add(curitem.buffers,it.buffers) call add(curitem.buffers,it.buffers)
endif endif
else else
" Create the definitive item " Add to list
let resitem={}
let resitem.word=curitem.word
let resitem.info=opp=='+'?"Projects":"Contexts"
let resitem.info.=": ".join(curitem.related, ", ")
\."\nBuffers: ".join(curitem.buffers, ", ")
call TodoAddToCompletionList(ret,curitem,opp) call TodoAddToCompletionList(ret,curitem,opp)
" Init new item from it " Init new item from it
let curitem.word=it.word
let curitem.related=[it.related]
let curitem=TodoCopyTempItem(it) let curitem=TodoCopyTempItem(it)
endif endif
endfor
" Don't forget to add the list item
call TodoAddToCompletionList(ret,curitem,opp) call TodoAddToCompletionList(ret,curitem,opp)
endif endif
return ret return ret

123
autoload/todo/txt.vim Normal file
View File

@@ -0,0 +1,123 @@
" File: todo.txt.vim
" Description: Todo.txt filetype detection
" Author: Leandro Freitas <freitass@gmail.com>
" License: Vim license
" Website: http://github.com/freitass/todo.txt-vim
" Version: 0.4
" Export Context Dictionary for unit testing {{{1
function! s:get_SID()
return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction
let s:SID = s:get_SID()
delfunction s:get_SID
function! todo#txt#__context__()
return { 'sid': s:SID, 'scope': s: }
endfunction
" Functions {{{1
function! s:remove_priority()
:s/^(\w)\s\+//ge
endfunction
function! s:get_current_date()
return strftime('%Y-%m-%d')
endfunction
function! todo#txt#prepend_date()
execute 'normal! I' . s:get_current_date() . ' '
endfunction
function! todo#txt#replace_date()
let current_line = getline('.')
if (current_line =~ '^\(([a-zA-Z]) \)\?\d\{2,4\}-\d\{2\}-\d\{2\} ') &&
\ exists('g:todo_existing_date') && g:todo_existing_date == 'n'
return
endif
execute 's/^\(([a-zA-Z]) \)\?\(\d\{2,4\}-\d\{2\}-\d\{2\} \)\?/\1' . s:get_current_date() . ' /'
endfunction
function! todo#txt#mark_as_done()
call s:remove_priority()
call todo#txt#prepend_date()
normal! Ix
endfunction
function! todo#txt#mark_all_as_done()
:g!/^x /:call todo#txt#mark_as_done()
endfunction
function! s:append_to_file(file, lines)
let l:lines = []
" Place existing tasks in done.txt at the beggining of the list.
if filereadable(a:file)
call extend(l:lines, readfile(a:file))
endif
" Append new completed tasks to the list.
call extend(l:lines, a:lines)
" Write to file.
call writefile(l:lines, a:file)
endfunction
function! todo#txt#remove_completed()
" Check if we can write to done.txt before proceeding.
let l:target_dir = expand('%:p:h')
let l:todo_file = expand('%:p')
let l:done_file = substitute(substitute(l:todo_file, 'todo.txt$', 'done.txt', ''), 'Todo.txt$', 'Done.txt', '')
if !filewritable(l:done_file) && !filewritable(l:target_dir)
echoerr "Can't write to file 'done.txt'"
return
endif
let l:completed = []
:g/^x /call add(l:completed, getline(line(".")))|d
call s:append_to_file(l:done_file, l:completed)
endfunction
function! todo#txt#sort_by_context() range
execute a:firstline . "," . a:lastline . "sort /\\(^\\| \\)\\zs@[^[:blank:]]\\+/ r"
endfunction
function! todo#txt#sort_by_project() range
execute a:firstline . "," . a:lastline . "sort /\\(^\\| \\)\\zs+[^[:blank:]]\\+/ r"
endfunction
function! todo#txt#sort_by_date() range
let l:date_regex = "\\d\\{2,4\\}-\\d\\{2\\}-\\d\\{2\\}"
execute a:firstline . "," . a:lastline . "sort /" . l:date_regex . "/ r"
execute a:firstline . "," . a:lastline . "g!/" . l:date_regex . "/m" . a:lastline
endfunction
function! todo#txt#sort_by_due_date() range
let l:date_regex = "due:\\d\\{2,4\\}-\\d\\{2\\}-\\d\\{2\\}"
execute a:firstline . "," . a:lastline . "sort /" . l:date_regex . "/ r"
execute a:firstline . "," . a:lastline . "g!/" . l:date_regex . "/m" . a:lastline
endfunction
" Increment and Decrement The Priority
:set nf=octal,hex,alpha
function! todo#txt#prioritize_increase()
normal! 0f)h
endfunction
function! todo#txt#prioritize_decrease()
normal! 0f)h
endfunction
function! todo#txt#prioritize_add(priority)
" Need to figure out how to only do this if the first visible letter in a line is not (
:call todo#txt#prioritize_add_action(a:priority)
endfunction
function! todo#txt#prioritize_add_action(priority)
execute 's/^\(([a-zA-Z]) \)\?/(' . a:priority . ') /'
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@@ -31,6 +31,18 @@ Table of Contents *TodoTxt-Contents* ~
=============================================================================== ===============================================================================
1. Release notes *TodoTxt-ReleaseNotes* ~ 1. Release notes *TodoTxt-ReleaseNotes* ~
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).
Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to Since v0.7.3, `TodoComplete` is replaced by `todo#Complete`, you might need to
update your vimrc (see |TodoTxt-Completion|). update your vimrc (see |TodoTxt-Completion|).
@@ -205,7 +217,7 @@ prevent this behavior, add the following line to your vimrc
`<LocalLeader>s@` : Sort the file on @Contexts `<LocalLeader>s@` : Sort the file on @Contexts
`<LocalLeader>s@` : Sort the file on due dates `<LocalLeader>sd` : Sort the file on due dates
`<LocalLeader>sc` : Sort the file by context then by priority `<LocalLeader>sc` : Sort the file by context then by priority

View File

@@ -3,7 +3,7 @@
" Author: David Beniamine <david@beniamine.net>, Leandro Freitas <freitass@gmail.com> " Author: David Beniamine <david@beniamine.net>, Leandro Freitas <freitass@gmail.com>
" License: Vim license " License: Vim license
" Website: http://github.com/dbeniamine/todo.txt-vim " Website: http://github.com/dbeniamine/todo.txt-vim
" Version: 0.7.2 " vim: ts=4 sw=4 :help tw=78 cc=80
autocmd BufNewFile,BufRead [Tt]odo.txt set filetype=todo 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\}-\d\\\{2\}.txt set filetype=todo

View File

@@ -3,13 +3,18 @@
" Author: David Beniamine <David@Beniamine.net>, Leandro Freitas <freitass@gmail.com> " Author: David Beniamine <David@Beniamine.net>, Leandro Freitas <freitass@gmail.com>
" License: Vim license " License: Vim license
" Website: http://github.com/dbeniamine/todo.txt-vim " Website: http://github.com/dbeniamine/todo.txt-vim
" Version: 0.7.2
" vim: ts=4 sw=4 :help tw=78 cc=80 " vim: ts=4 sw=4 :help tw=78 cc=80
" Save context {{{1 " Save context {{{1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
if exists("g:Todo_txt_loaded")
finish
else
let g:Todo_txt_loaded=0.7.6
endif
" General options {{{1 " General options {{{1
" Some options lose their values when window changes. They will be set every " Some options lose their values when window changes. They will be set every
" time this script is invocated, which is whenever a file of this type is " time this script is invocated, which is whenever a file of this type is
@@ -49,12 +54,15 @@ if !exists("g:Todo_txt_do_not_map")
noremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR> noremap <script> <silent> <buffer> <localleader>d :call todo#PrependDate()<CR>
" Mark done {{{2 " Mark done {{{2
noremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR> noremap <script> <silent> <buffer> <Plug>DoToggleMarkAsDone :call todo#ToggleMarkAsDone('')<CR>
\:call repeat#set("\<Plug>DoToggleMarkAsDone")<CR>
nmap <localleader>x <Plug>DoToggleMarkAsDone
" noremap <script> <silent> <buffer> <localleader>x :call todo#ToggleMarkAsDone('')<CR>
" Mark done {{{2 " Mark done {{{2
noremap <script> <silent> <buffer> <localleader>C :call todo#ToggleMarkAsDone('Cancelled')<CR> noremap <script> <silent> <buffer> <Plug>DoCancel :call todo#ToggleMarkAsDone('Cancelled')<CR>
\:call repeat#set("\<Plug>DoCancel")<CR>
nmap <localleader>C <Plug>DoCancel
" Mark all done {{{2 " Mark all done {{{2
noremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR> noremap <script> <silent> <buffer> <localleader>X :call todo#MarkAllAsDone()<CR>
@@ -96,4 +104,3 @@ endfunction
" Restore context {{{1 " Restore context {{{1
let &cpo = s:save_cpo let &cpo = s:save_cpo
" Modeline {{{1

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: __init__.py
# Author: Guilherme Victal <guilherme at victal.eti.br>
# Description: Dateregex library entry point
# License: Vim license
# Website: http://github.com/freitass/todo.txt-vim
# Version: 0.1
from dateregex.after import regex_date_after
from dateregex.before import regex_date_before

View File

@@ -0,0 +1,95 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: after.py
# Author: Guilherme Victal <guilherme at victal.eti.br>
# Description: Generates regexes after a certain date
# License: Vim license
# Website: http://github.com/freitass/todo.txt-vim
# Version: 0.1
from datetime import date, timedelta, MAXYEAR
def _year_regex_after(year):
if int(year) > MAXYEAR:
return None
year_regex = r'(\d+\d{%s}' % len(year)
for idx, digit in enumerate(year):
if digit != '9':
regex = '|' + year[0:idx]
regex += '9' if digit == '8' else '[%s-9]' % str(int(digit) + 1)
if idx < len(year) - 1:
regex += '\d{%s}' % (len(year) - (idx + 1))
year_regex += regex
year_regex += ')'
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
def _month_regex_after(year, month):
if month == '12':
return None
digit1, digit2 = month
if digit1 == '1':
month_regex = r'12' if month == '11' else r'1[12]'
else:
month_regex = r'1[0-2]'
if digit2 != '9':
if digit2 == '8':
month_regex = r'(' + month_regex + r'|09)'
else:
month_regex = r'(' + month_regex + r'|0[%s-9])'
month_regex = month_regex % str(int(digit2) + 1)
return '-'.join((year, month_regex, r'\d{2}'))
def _day_regex_after(year, month, day):
last_month_day = str((date(int(year), (int(month) + 1) % 12, 1) + - date.resolution).day)
if day == last_month_day:
return None
day_regex = r'('
digit1, digit2 = day
last_digit1, last_digit2 = last_month_day
if digit1 == last_digit1:
day_regex = last_month_day if int(digit2) == int(last_digit2) - 1 else last_digit1 + r'[%s-%s]' % (str(int(digit2) + 1), last_digit2)
else:
day_regex = r'('
day_regex += last_digit1 if int(digit1) == int(last_digit1) - 1 else r'[%s-%s]' % (str(int(digit1) + 1), last_digit1)
day_regex +=r'\d'
if digit2 < '9':
day_regex += '|' + digit1
day_regex += '9' if digit2 == '8' else r'[%s-9]' % str(int(digit2) + 1)
day_regex += ')'
return '-'.join((year, month, day_regex))
def regex_date_after(given_date):
year, month, day = given_date.isoformat().split('-')
year_regex = _year_regex_after(year)
month_regex = _month_regex_after(year, month)
day_regex = _day_regex_after(year, month, day)
date_regex = '(' + year_regex if year_regex else '('
date_regex += ('|' + month_regex) if month_regex else ''
date_regex += ('|' + day_regex) if day_regex else ''
date_regex += ')'
return date_regex
def __main():
import re
date_regex = regex_date_after(date(1999,12,31))
print(date_regex)
pattern = re.compile(date_regex)
d = date.today() + date.resolution
assert pattern.match(date.strftime(d, '%Y-%m-%d')) is not None
print(date.strftime(d, '%Y-%m-%d') + ' is okay')
d += date.resolution
if __name__ == '__main__':
__main()

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: before.py
# Author: Guilherme Victal <guilherme at victal.eti.br>
# Description: Generates regexes before a certain date
# License: Vim license
# Website: http://github.com/freitass/todo.txt-vim
# Version: 0.1
from datetime import date, timedelta, MINYEAR
def _year_regex_before(year):
if int(year) <= MINYEAR:
return None
year_regex = r'('
year_regex += r'\d{1,%s}' % str(len(year) - 1) if len(year) > 1 else ''
for idx, digit in enumerate(year):
if digit != '0':
regex = '|' + year[0:idx]
regex += '0' if digit == '1' else '[0-%s]' % str(int(digit) - 1)
if idx < len(year) - 1:
regex += '\d{%s}' % (len(year) - (idx + 1))
year_regex += regex
year_regex += ')'
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
def _month_regex_before(year, month):
if month == '01':
return None
digit1, digit2 = month
if digit1 == '0':
month_regex = '01' if month == '02' else r'0[1-%s]' % str(int(digit2) - 1)
elif month == '10':
month_regex = r'0\d'
elif month == '11':
month_regex = r'(0\d|10)'
else:
month_regex = r'(0\d|1[01])'
return '-'.join((year, month_regex, r'\d{2}'))
def _day_regex_before(year, month, day):
if day == '01':
return None
last_month_day = str((date(int(year), int(month) % 12 + 1, 1) + - date.resolution).day)
last_digit1, last_digit2 = last_month_day
digit1, digit2 = day
if digit1 == '0':
day_regex = '01' if day == '02' else r'0[1-%s]' % str(int(digit2) - 1)
else:
day_regex = r'('
day_regex += '0' if digit1 == '1' else r'[0-%s]' % str(int(digit1) - 1)
day_regex += r'\d'
if digit2 != '0':
day_regex += '|'
day_regex += digit1
day_regex += '0' if digit2 == '1' else r'[0-%s]' % str(int(digit2) - 1)
day_regex += ')'
return '-'.join((year, month, day_regex))
def regex_date_before(given_date):
year, month, day = given_date.isoformat().split('-')
year_regex = _year_regex_before(year)
month_regex = _month_regex_before(year, month)
day_regex = _day_regex_before(year, month, day)
date_regex = '(' + year_regex if year_regex else '('
date_regex += ('|' + month_regex) if month_regex else ''
date_regex += ('|' + day_regex) if day_regex else ''
date_regex += ')'
return date_regex

31
syntax/python/todo.py Normal file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# File: todo.py
# Description: Todo.txt overdue date syntax script
# License: Vim license
# Website: http://github.com/freitass/todo.txt-vim
# Version: 0.1
import vim
import os
import sys
from datetime import date
dateregex_dir = os.path.join(vim.eval('s:script_dir'), 'dateregex')
if os.path.isdir(dateregex_dir):
sys.path.insert(0, dateregex_dir)
def add_due_date_syntax_highlight():
try:
from dateregex import regex_date_before
except ImportError:
print("dateregex module not found. Overdue dates won't be highlighted")
return
regex = regex_date_before(date.today())
regex = r'(^|<)due:%s(>|$)' % regex
vim.command("syntax match OverDueDate '\\v%s'" % regex)
vim.command("highlight default link OverDueDate Error")
add_due_date_syntax_highlight()

View File

@@ -3,39 +3,39 @@
" Author: David Beniamine <David@Beniamine.net>,Leandro Freitas <freitass@gmail.com> " Author: David Beniamine <David@Beniamine.net>,Leandro Freitas <freitass@gmail.com>
" License: Vim license " License: Vim license
" Website: http://github.com/dbeniamine/todo.txt-vim " Website: http://github.com/dbeniamine/todo.txt-vim
" Version: 0.7.2 " vim: ts=4 sw=4 :help tw=78 cc=80
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
endif endif
syntax match TodoDone '^[xX]\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoDone '^[xX]\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityA '^([aA])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityA '^([aA])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityB '^([bB])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityB '^([bB])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityC '^([cC])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityC '^([cC])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityD '^([dD])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityD '^([dD])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityE '^([eE])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityE '^([eE])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityF '^([fF])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityF '^([fF])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityG '^([gG])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityG '^([gG])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityH '^([hH])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityH '^([hH])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityI '^([iI])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityI '^([iI])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityJ '^([jJ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityJ '^([jJ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityK '^([kK])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityK '^([kK])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityL '^([lL])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityL '^([lL])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityM '^([mM])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityM '^([mM])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityN '^([nN])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityN '^([nN])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityO '^([oO])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityO '^([oO])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityP '^([pP])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityP '^([pP])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityQ '^([qQ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityQ '^([qQ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityR '^([rR])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityR '^([rR])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityS '^([sS])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityS '^([sS])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityT '^([tT])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityT '^([tT])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityU '^([uU])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityU '^([uU])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityV '^([vV])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityV '^([vV])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityW '^([wW])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityW '^([wW])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityX '^([xX])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityX '^([xX])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityY '^([yY])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityY '^([yY])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoPriorityZ '^([zZ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext syntax match TodoPriorityZ '^([zZ])\s.\+$' contains=TodoKey,TodoDate,TodoProject,TodoContext,OverDueDate
syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=NONE syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=NONE
syntax match TodoKey '\S*\S:\S\S*' contains=TodoDate syntax match TodoKey '\S*\S:\S\S*' contains=TodoDate
syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=NONE syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=NONE
@@ -51,4 +51,12 @@ highlight default link TodoDate PreProc
highlight default link TodoProject Special highlight default link TodoProject Special
highlight default link TodoContext Special highlight default link TodoContext Special
let b:curdir = expand('<sfile>:p:h')
let s:script_dir = b:curdir . "/python/"
if has('python3')
execute "py3file " . s:script_dir. "todo.py"
elseif has('python')
execute "pyfile " . s:script_dir. "todo.py"
endif
let b:current_syntax = "todo" let b:current_syntax = "todo"