hi,
I catched this little code to update last-modified content in HTML files
: au FileType x*html
: \ exe
'g/http-equiv="last-modified"/s/content=".*/content="'.strftime("%Y-%m-%d
%T").'">'
the problem is this happens even I don't record file (:w), and so
date changes even there are no changes.
this doesn't make much sense, does it? :)
how could I make update recorded only if I write to file?
On Sun, 09 Mar 2025, 'sukolyn' via vim_use wrote:how could I make update recorded only if I write to file?You may want to use a BufWritePre autocommand instead. Thanks, Christian
that's it. thank you.
: au BufWritePre * if (&ft == "html" || &ft=="xhtml") |
exe
'g/http-equiv="last-modified"/s/content=".*/content="'.strftime("%Y-%m-%d
%T").'">' | endif