On Thu, Apr 04, 2024 at 08:01:01PM +0000, david sowerby wrote: > Hi, in Vim/Neovim I can save a copy of the file when I exit. The copy is > renamed file-$(date +%s).bak. This gives me a file with an increasing number > plus .bak. It looks like "date+%s" and "&stime" do the same thing. Is this > possible in vile? I know I can save a file as file.bak but I like to save a > series of changed files, not just one. > So a macro that saves a copy and I then call that macro with write-hook. > Thanks.
write-hook is called before a file is written (so I don't think it would work just like the suggested order). But you could have a macro which decides what the filename should be, and writes to that. The macro should save and restore $cfilname, otherwise $cfilname will get updated to point to the most recently written file. -- Thomas E. Dickey <dic...@invisible-island.net> https://invisible-island.net
signature.asc
Description: PGP signature