aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/html/timestamp.vim15
1 files changed, 15 insertions, 0 deletions
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*<em>Last updated: .\+</em>$', '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.*',
+ \ '<em>Last updated: '.l:date.'</em>', ''))
+ endif
+ call winrestview(l:cv)
+endfunction