Most of my machines are headless, they do not have a monitor attached. Vim usually is installed on all of them, gvim is not. But occasionally I prefer to edit certain files in gvim rather than vim or edit the same file on different machines in one editor instance. So wouldn’t it be nice if I could open remote files directly from my workstation? Sure, no problem. Vim does support opening remote files. For example, using scp:
gvim scp://root@server2//etc/fstab
Note the double slashes after the hostname. With only one slash you’d be using a path relative to the $HOME directory of the remote user. Just think that the colon which would usually be used with the scp command needs to be replaced with a forward slash.
The same also works with opening files from within an already running editor session:
:e scp://root@server2//etc/hosts
I’ve only ever used this with the scp
and sftp
methods, but it should work with several more:
- dav
- fetch
- ftp
- http
- rcp
- rsync
- scp
- sftp