aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/html.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/autoload/html.vim')
-rw-r--r--vim/autoload/html.vim17
1 files changed, 17 insertions, 0 deletions
diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim
index f46b323f..c3d99706 100644
--- a/vim/autoload/html.vim
+++ b/vim/autoload/html.vim
@@ -13,3 +13,20 @@ function! html#UrlLink() abort
normal! a</a>
endfunction
+
+" Update a timestamp
+function! html#TimestampUpdate() 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