Search code examples
vimbackupscpnetrw

Create local backup when editing remote files via netrw in vim


I work with many files remotely using vim and the netrw plugin. I also keep timestamped backups by changing the &backupext (found in the documentation).

While working in a remote file (scp://server//folder/file.txt), I noticed that when I save it, a backup isn't even being made.

Is there a way I can have a backup automatically made locally (according to vim backup settings) every time I save a remote file?


Solution

  • I don't think there's a simple setting to toggle. You could try to script something though - add your own BufWriteCmd autocommand to write a backup. Try using set verbose=9 for debugging (and to see how netrw does it).