Incorporated due date workaround from durcheinandr

This commit is contained in:
David Beniamine
2015-07-05 12:29:02 +02:00
4 changed files with 49 additions and 31 deletions

View File

@@ -39,7 +39,6 @@ function! TodoTxtUnMarkAsDone()
:s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}\s*//g
endfunction
function! TodoTxtMarkAsDone()
function! TodoTxtMarkAsDone()
call TodoTxtPrependDate()
normal! Ix
@@ -85,6 +84,13 @@ function! TodoTxtSort()
:sort /+[a-zA-Z]*/ r
:sort /\v\([A-Z]\)/ r
endfunction
function! TodoTxtSortDue()
:silent! %s/\(due:\d\{4}\)-\(\d\{2}\)-\(\d\{2}\)/\1\2\3/g
:sort! n /due:/
:silent! %s/\(due:\d\{4}\)\(\d\{2}\)/\1-\2-/g
" TODO: add time sorting (YYYY-MM-DD HH:MM)
endfunction
" Mappings {{{1
" Sort tasks {{{2
@@ -209,6 +215,11 @@ if !hasmapto("<localleader>D",'n')
if !hasmapto("<localleader>D",'n')
nnoremap <script> <silent> <buffer> <localleader>D :call TodoTxtRemoveCompleted()<CR>
endif
" Sort @_sched by due: date {{{2
if !hasmapto("<localleader>sd".'n')
nnoremap <script> <silent> <buffer> <localleader>sd :call TodoTxtSortDue()<CR>
endif
" Folding {{{1
" Options {{{2