diff --git a/autoload/do.vim b/autoload/do.vim index aaaaedd..c0f39be 100644 --- a/autoload/do.vim +++ b/autoload/do.vim @@ -78,3 +78,11 @@ function! do#debug(...) endfor exec l:command endfunction + +function! do#last_change() + if &filetype ==# 'help' + " vint: next-line -ProhibitCommandRelyOnUser -ProhibitCommandWithUnintendedSideEffect + 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e + norm!`` + endif +endfunction diff --git a/plugin/autocmds.vim b/plugin/autocmds.vim index 552e119..8b16cfb 100644 --- a/plugin/autocmds.vim +++ b/plugin/autocmds.vim @@ -9,7 +9,7 @@ augroup benieAugroup au FileType * call matchadd('Todo', '^\(<<<<<<<\||||||||\|=======\|>>>>>>>\)\s\ze.*$') " Update `Last change: ` on write then jump back previous position - au BufWritePost *.txt 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e|norm!`` + au BufWritePost *.txt silent! call do#last_change() " Read template into buffer then send line 1 to the black hold register au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _