Thanks for the suggestions. I did finally get a macro written that does what I 
want, but mapped it to F12. I can run the macro if I think I need to back-up 
the file or not. I checked and $cfilname is not affected, probably because I 
used $cbufname instead?

==========================================
Inertia is the most powerful force in the Universe.


     On Friday, April 5, 2024 at 02:46:27 PM PDT, Thomas Dickey 
<[email protected]> wrote:  
 
 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 <[email protected]>
https://invisible-island.net
  

Reply via email to