diff --git a/autoload/todo/txt.vim b/autoload/todo/txt.vim index 88830ea..0232488 100644 --- a/autoload/todo/txt.vim +++ b/autoload/todo/txt.vim @@ -25,6 +25,10 @@ function! s:get_current_date() return strftime('%Y-%m-%d') endfunction +function! todo#txt#prepend_date() + execute 'normal! I' . s:get_current_date() . ' ' +endfunction + function! todo#txt#replace_date() let current_line = getline('.') if (current_line =~ '^\(([a-zA-Z]) \)\?\d\{2,4\}-\d\{2\}-\d\{2\} ') && diff --git a/test/tc_mark_as_done.todo.txt b/test/tc_mark_as_done.todo.txt index e706faf..3cabcdd 100644 --- a/test/tc_mark_as_done.todo.txt +++ b/test/tc_mark_as_done.todo.txt @@ -1,5 +1,5 @@ # lorem_ipsum first task to be marked as done second task to be marked as done -third task to be marked as done +2015-05-20 third task to be marked as done # end_lorem_ipsum diff --git a/test/tc_mark_as_done.vim b/test/tc_mark_as_done.vim index 23fc4ce..f5a1e4b 100644 --- a/test/tc_mark_as_done.vim +++ b/test/tc_mark_as_done.vim @@ -8,13 +8,13 @@ let s:TODAY = strftime("%Y-%m-%d") let s:FIRST_TASK_DONE = [ \ 'x ' . s:TODAY . ' first task to be marked as done', \ 'second task to be marked as done', - \ 'third task to be marked as done', + \ '2015-05-20 third task to be marked as done', \ ] let s:ALL_TASKS_DONE = [ \ 'x ' . s:TODAY . ' first task to be marked as done', \ 'x ' . s:TODAY . ' second task to be marked as done', - \ 'x ' . s:TODAY . ' third task to be marked as done', + \ 'x ' . s:TODAY . ' 2015-05-20 third task to be marked as done', \ ] function! s:tc.test_mark_as_done()