[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macro question
From: |
Brendan O'Dea |
Subject: |
Re: macro question |
Date: |
Sat, 6 Apr 2024 19:21:33 +1100 |
On Fri, 5 Apr 2024 at 16:09, david sowerby <d_sowerby@yahoo.com> 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.
I vaguely recall dealing with operating systems which did this (VMS?
MVS?). Every file save added a new version, and you had to
periodically run `PURGE` to recover disk space.
An alternative is to stash each write in a version control system.
In a previous job (more than a decade ago, before git existed), all of
our production servers had the attached script installed as both `viw`
(update file and send diff), and a link as `vis` (silently update
file). This logged changes to any production files (typically in
/etc), and stashed them in version control so you could easily revert
a problem change; see the difference b/w versions, etc.
Note that this script will prompt for a description of the file on
first commit, and a reason for the change in subsequent updates.
This worked pretty well for us at the time, and didn't version every
file, just the ones we cared about.
--bod
viw
Description: Binary data