From f474d1b727f40c130bef5208f0374193bc3da356 Mon Sep 17 00:00:00 2001 From: Alexandr Kondratev Date: Thu, 11 Jul 2019 23:56:33 +0300 Subject: [PATCH] Configurable DatesEnabled to keep creation date or date of last modification --- plugin/vim-todo-lists.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugin/vim-todo-lists.vim b/plugin/vim-todo-lists.vim index 83ee05a..18fd7eb 100644 --- a/plugin/vim-todo-lists.vim +++ b/plugin/vim-todo-lists.vim @@ -29,6 +29,11 @@ function! VimTodoListsInit() let g:VimTodoListsDatesEnabled = 0 endif + " Keep a date of creation or update with a current + if !exists('g:VimTodoListsDatesKeepCreation') + let g:VimTodoListsDatesKeepCreation = 1 + endif + if !exists('g:VimTodoListsDatesFormat') let g:VimTodoListsDatesFormat = "%X, %d %b %Y" endif @@ -351,6 +356,12 @@ function! VimTodoListsAppendDate() if(g:VimTodoListsDatesEnabled == 1) let l:date = strftime(g:VimTodoListsDatesFormat) execute "s/$/ (" . l:date . ")" + " XXX: makes better match up of date + if (g:VimTodoListsDatesKeepCreation == 0) + silent! execute "s/ ([^)]\\+)\\( ([^)]\\+)\\)$/\\1" + else + silent! execute "s/\\( ([^)]\\+)\\) ([^)]\\+)$/\\1" + endif endif endfunction