diff --git a/README.markdown b/README.markdown index 39c48f4..99a4c37 100644 --- a/README.markdown +++ b/README.markdown @@ -23,6 +23,7 @@ Sorting tasks: `s@` Sort the file on @Contexts `sd` Sort the file on dates `sdd` Sort the file on due dates +`sdt` Sort the file on start dates as represented by the "t" metadata key (e.g., "t:2017-11-23") Edit priority: `j` Decrease the priority of the current line diff --git a/autoload/todo/txt.vim b/autoload/todo/txt.vim index c5158f0..1d5f0f2 100644 --- a/autoload/todo/txt.vim +++ b/autoload/todo/txt.vim @@ -99,6 +99,12 @@ function! todo#txt#sort_by_due_date() range execute a:firstline . "," . a:lastline . "g!/" . l:date_regex . "/m" . a:lastline endfunction +function! todo#txt#sort_by_start_date() range + let l:date_regex = "t:\\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 8d7ca3d..3b45f4f 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -26,6 +26,7 @@ CONTENTS *todo-contents* `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) + sdt Sort the file on due dates (i.e. t: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 548617b..c2fa7f0 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -28,6 +28,8 @@ nnoremap