aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-01 16:58:37 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-01 16:58:37 +1200
commit8c364ee070ca116c462997b6cfc28d963c33becd (patch)
tree9152210111e6aac14288c36f176a85f1618511c8 /vim/autoload
parentSupport nested dirs in two Vim runtime subdirs (diff)
downloaddotfiles-8c364ee070ca116c462997b6cfc28d963c33becd.tar.gz
dotfiles-8c364ee070ca116c462997b6cfc28d963c33becd.zip
Add new html/timestamp.vim ftplugin
Not sure if this one will get published--it's a bit ad-hoc in its current state.
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