From 8c364ee070ca116c462997b6cfc28d963c33becd Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 16:58:37 +1200 Subject: Add new html/timestamp.vim ftplugin Not sure if this one will get published--it's a bit ad-hoc in its current state. --- vim/autoload/html/timestamp.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 vim/autoload/html/timestamp.vim (limited to 'vim/autoload') diff --git a/vim/autoload/html/timestamp.vim b/vim/autoload/html/timestamp.vim new file mode 100644 index 00000000..1b3ea830 --- /dev/null +++ b/vim/autoload/html/timestamp.vim @@ -0,0 +1,15 @@ +function! html#timestamp#Update() abort + if !&modified + return + endif + let l:cv = winsaveview() + call cursor(1,1) + let l:li = search('\C^\s*Last updated: .\+$', 'n') + if l:li + let l:date = substitute(system('date -u'), '\C\n$', '', '') + let l:line = getline(l:li) + call setline(l:li, substitute(l:line, '\C\S.*', + \ 'Last updated: '.l:date.'', '')) + endif + call winrestview(l:cv) +endfunction -- cgit v1.2.3