Merge pull request #43 from JonathanReeve/due-date

add ability to sort on due dates
This commit is contained in:
Leandro Freitas
2015-10-25 17:35:39 -02:00
3 changed files with 9 additions and 0 deletions

View File

@@ -93,6 +93,12 @@ function! todo#txt#sort_by_date() range
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

View File

@@ -25,6 +25,7 @@ CONTENTS *todo-contents*
`<localleader>s+` Sort the file on +Projects
`<localleader>s@` Sort the file on @Contexts
`<localleader>sd` Sort the file on dates
`<localleader>sdd` Sort the file on due dates (i.e. due:2015-10-25)
1.2 Edit priority: *todo-commands-priority*
`<localleader>j` Decrease the priority of the current line

View File

@@ -26,6 +26,8 @@ nnoremap <script> <silent> <buffer> <localleader>s+ :%call todo#txt#sort_by_proj
vnoremap <script> <silent> <buffer> <localleader>s+ :call todo#txt#sort_by_project()<CR>
nnoremap <script> <silent> <buffer> <localleader>sd :%call todo#txt#sort_by_date()<CR>
vnoremap <script> <silent> <buffer> <localleader>sd :call todo#txt#sort_by_date()<CR>
nnoremap <script> <silent> <buffer> <localleader>sdd :%call todo#txt#sort_by_due_date()<CR>
vnoremap <script> <silent> <buffer> <localleader>sdd :call todo#txt#sort_by_due_date()<CR>
" Change priority {{{2
nnoremap <script> <silent> <buffer> <localleader>j :call todo#txt#prioritize_increase()<CR>