From 09d180ee3c798928535c5a0d0677594605652b9a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 1 Jul 2018 22:33:01 +1200 Subject: 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. --- vim/autoload/html.vim | 17 +++++++++++++++++ vim/autoload/html/timestamp.vim | 15 --------------- 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 vim/autoload/html/timestamp.vim (limited to 'vim/autoload') 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 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*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 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*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