summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Beniamine <david@beniamine.net>2018-05-25 18:08:55 +0200
committerDavid Beniamine <david@beniamine.net>2018-05-25 18:08:55 +0200
commit259125d9efe93f69582f50ef68c17e20fd1e963a (patch)
treefcd370b803caf53f583cad7f182afb5b2a813f5c
parent2483961aaf236bd75f464ab52069aefa2bb07a88 (diff)
downloadtodo.txt-vim-259125d9efe93f69582f50ef68c17e20fd1e963a.zip
Move tasks without priority before done on sort
Closes #32
-rw-r--r--autoload/todo.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/autoload/todo.vim b/autoload/todo.vim
index 937c3e0..2650a77 100644
--- a/autoload/todo.vim
+++ b/autoload/todo.vim
@@ -167,7 +167,16 @@ function! todo#Sort()
endif
sort /@[a-zA-Z]*/ r
sort /+[a-zA-Z]*/ r
- sort /\v([A-Z])/ r
+ sort /\v\([A-Z]\)/ r
+ "Now tasks without priority are at beggining, move them to the end
+ silent normal gg
+ let l:firstP=search('^\s*([A-Z])', 'cn')
+ if l:firstP != 1
+ let num=l:firstP-1
+ " Sort normal
+ execute ':1 d b'.num
+ silent normal G"bp
+ endif
if l:first != 0
silent normal G"ap
execute ':'.l:first.','.l:last.'sort /@[a-zA-Z]*/ r'