diff --git a/README.markdown b/README.markdown index e8e465c..53948af 100644 --- a/README.markdown +++ b/README.markdown @@ -18,6 +18,10 @@ function for context and projects (see section 1.4). git clone https://github.com/dbeniamine/todo.txt-vim.git ~/.vim/bundle/todo.txt-vim +If you want the help installed, run ":helptags ~/.vim/doc" inside vim after having copied the files. +Then you will be able to get the commands help with: :h todo.txt + + ## Features included in Freitass version This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. It also defines a few mappings, to help with editing these files: @@ -28,6 +32,8 @@ This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. `s@` : Sort the file on @Contexts +`-sd` : Sort @_sched entries by due-date + `j` : Lower the priority of the current line `k` : Increase the priority of the current line @@ -48,9 +54,6 @@ This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. `-D` : Move completed tasks to done.txt -If you want the help installed, run ":helptags ~/.vim/doc" inside vim after having copied the files. -Then you will be able to get the commands help with: :h todo.txt - ## New features This fork provides a hierarchical sorting function designed to do by project diff --git a/doc/todo.txt b/doc/todo.txt index 8fb150a..19e88c9 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -9,6 +9,8 @@ COMMANDS *todo-commands* `s@` : Sort the file on @Contexts +`s@` : Sort the file on due dates + `sc` : Sort the file by context then by priority `scp` : Sort the file by context, project then by priority diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 996873b..e5b2108 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -39,7 +39,6 @@ function! TodoTxtUnMarkAsDone() endfunction function! TodoTxtMarkAsDone() - " call s:TodoTxtRemovePriority() call TodoTxtPrependDate() normal! Ix endfunction @@ -85,6 +84,13 @@ function! TodoTxtSort() :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 if !hasmapto("s",'n') @@ -209,6 +215,11 @@ if !hasmapto("D",'n') nnoremap