Better handling of priority on done tasks
Also added <localleader>ff to fix format. this will remove leading
whitespaces and convert old (wrong) done tasks to the correct format
This commit is contained in:
David Beniamine
2017-09-20 13:15:55 +02:00
parent c6e472c048
commit ebdde99ac4
5 changed files with 23 additions and 3 deletions

View File

@@ -77,6 +77,13 @@ function! todo#ToggleMarkAsDone(status)
endif
endfunction
function! todo#FixFormat()
" Remove heading space
silent! %s/\C^\s*//
" Remove priority from done tasks
silent! %s/\C^x (\([A-Z]\)) \(.*\)/x \2 pri:\1/
endfunction
function! todo#UnMarkAsDone(status)
if a:status==''
let pat=''
@@ -84,12 +91,14 @@ function! todo#UnMarkAsDone(status)
let pat=' '.a:status
endif
exec ':s/\C^x\s*\d\{4}-\d\{1,2}-\d\{1,2}'.pat.'\s*//g'
silent s/\C\(.*\) pri:\([A-Z]\)/(\2) \1/
endfunction
function! todo#MarkAsDone(status)
if a:status!=''
exec 'normal! I'.a:status.' '
endif
exec ':s/\C^(\([A-Z]\))\(.*\)/\2 pri:\1'
call todo#PrependDate()
if (getline(".") =~ '^ ')
normal! gIx