I do most of my work in vim. I much prefer to edit files using vim locally rather than sshing into a server and running vim there, for many reasons, one of the most important being UI responsiveness on a slow connection.
I know that I can edit remote files using vim and scp and I also have a setup with sshfs that allows me to quite simply cd to a mount point and vim up some files.
However, it really bothers me that every time I save the file, it writes the whole file to the remote server. This really slows down my workflow.
What I really would like to do is have some sort of setup like this:
- When opening a remote file with local vim, pull the file's contents and a hash of the file
- When saving the file, check if the remote hash has not changed, and if it has not, upload a diff and patch the remote file with the new changes.
- Preferably do this all through a persistent ssh connection, so that no time is lost opening a new connection each time.
This would be much faster and much more bandwidth efficient, and have the same functionality.
I usually use git or svn to achieve a similar result, but I really want this kind of minimal functionality for situations when I do not have the luxury of using such SCM systems.
My questions are:
1. Does anyone know of any existing scripts or programs that will do some or all of this for me?
2. Anyone care to whip up some bash one liners that will do the trick? I know it should be able to be done with a few of these...