Tuesday, June 23, 2020

Re: Date in a boilerplate file

Very generous, thank you. I'll study your code and I'm sure it will help me a lot.
guido


In order to keep track of file versions, I have a .vimrc file that updates
a timestamp every time the file is saved. That sounds similar to this
problem.

I've attached the complete file, but in case that has the problem, here's
the text:

" .vimrc with timestamp

function! UpdateTimestamp ()   " Note silent! suppresses error message if
                               " no matching string found
silent!  '[,']s/^[#\"] End.*Last changed: \zs.*/\= strftime("%Y-%m-%d
%H:%M:%S") /

endfunction

augroup TimeStamping
    autocmd!

    autocmd BufWritePre,FileWritePre,FileAppendPre  *  :call
UpdateTimestamp()
augroup END

:set expandtab
:set tabstop=3

" End .vimrc Last changed: 2019-08-22 15:43:18

As you can see, the .vimrc itself uses the technique.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8c995f65-b6e9-49ec-b3c4-957d9546e0cfo%40googlegroups.com.

No comments: