diff --git a/autoload/todo/txt.vim b/autoload/todo/txt.vim index 0232488..efd72df 100644 --- a/autoload/todo/txt.vim +++ b/autoload/todo/txt.vim @@ -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 diff --git a/doc/todo.txt b/doc/todo.txt index 2a28bf4..c84d869 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -25,6 +25,7 @@ CONTENTS *todo-contents* `s+` Sort the file on +Projects `s@` Sort the file on @Contexts `sd` Sort the file on dates + `sdd` Sort the file on due dates (i.e. due:2015-10-25) 1.2 Edit priority: *todo-commands-priority* `j` Decrease the priority of the current line diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 65252db..548617b 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -26,6 +26,8 @@ nnoremap