I once struggled with a variant of this problem: keeping local records of changes that I made in the same source tree on the same remote computer.
I saved a local copy of the entire source tree and local svn repository for the file version. Instead of using netrw and looking for a way to save backups locally, I edited everything locally and needed the ability to automatically propagate my changes to a remote machine.
Solution 1: use Autocommand BufWritePost to call scp to copy the file after it is written. This can work quite efficiently if the system allows processes to exchange file descriptors, since you can start an ssh master session on a remote computer and share the connection for subsequent sessions. If you are less fortunate (I was working on a Windows machine at the time), the time it takes to discuss a new connection for each file can be painful.
Solution 2: for Windows, use WinSCP , which has the “save the remote machine” mode, in which it controls the directory and all its subdirectories for changes, and then automatically distributes the changes, given the set of rules (patterns for ignoring, transfer mode for different types of files and etc.).
Aryeh leib taurog
source share