From 259125d9efe93f69582f50ef68c17e20fd1e963a Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Fri, 25 May 2018 18:08:55 +0200 Subject: [PATCH] Move tasks without priority before done on sort Closes #32 --- autoload/todo.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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'