diff --git a/README.markdown b/README.markdown index 7a966ec..02192bb 100644 --- a/README.markdown +++ b/README.markdown @@ -164,6 +164,8 @@ like this behavior, you can set the default done.txt name: `x` is a toggle which allow you to unmark a task as done. +`c` Mark a task cancelled + Syntax highlighting for couples key:value If the current buffer is a done.txt file, the basic sort sorts on completion diff --git a/autoload/todo.vim b/autoload/todo.vim index 90660a4..3e9c98c 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -58,19 +58,27 @@ function! todo#PrependDate() normal! 0"=strftime("%Y-%m-%d ") P endfunction -function! todo#ToggleMarkAsDone() +function! todo#ToggleMarkAsDone(status) if (getline(".") =~ 'x\s*\d\{4\}') - :call todo#UnMarkAsDone() + :call todo#UnMarkAsDone(a:status) else - :call todo#MarkAsDone() + :call todo#MarkAsDone(a:status) endif endfunction -function! todo#UnMarkAsDone() - :s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}\s*//g +function! todo#UnMarkAsDone(status) + if a:status=='' + let pat='' + else + let pat=' '.a:status + endif + exec ':s/\s*x\s*\d\{4}-\d\{1,2}-\d\{1,2}'.pat.'\s*//g' endfunction -function! todo#MarkAsDone() +function! todo#MarkAsDone(status) + if a:status!='' + exec 'normal! I'.a:status.' ' + endif call todo#PrependDate() normal! Ix endfunction diff --git a/ftplugin/todo.vim b/ftplugin/todo.vim index 8a44f7b..cb4728d 100644 --- a/ftplugin/todo.vim +++ b/ftplugin/todo.vim @@ -122,16 +122,27 @@ endif " Mark done {{{2 if !hasmapto("x",'n') - nnoremap