aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-01 22:33:01 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-01 22:33:01 +1200
commit09d180ee3c798928535c5a0d0677594605652b9a (patch)
tree954108c16afc17b7732d505a1261640d73d7e048 /vim/autoload
parent8c364ee070ca116c462997b6cfc28d963c33becd (diff)
downloaddotfiles-09d180ee3c798928535c5a0d0677594605652b9a.tar.gz
dotfiles-09d180ee3c798928535c5a0d0677594605652b9a.zip
Merge HTML timestamp into after/ftplugin/html.vim
I don't see myself breaking this out into its own ftplugin, and the Makefile can be simpler this way.
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/html.vim17
-rw-r--r--vim/autoload/html/timestamp.vim15
2 files changed, 17 insertions, 15 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
diff --git a/vim/autoload/html/timestamp.vim b/vim/autoload/html/timestamp.vim
deleted file mode 100644
index 1b3ea830..00000000
--- a/vim/autoload/html/timestamp.vim
+++ /dev/null
@@ -1,15 +0,0 @@
-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