Remotely Edit Files in Vim
If you want to edit files on a remote server with your current lovely vim configs there are 2 options:
One is to copy your
.vimrc to all servers. Which is not efficent and denying
one of the main software development principle -
Another one is instead of bringing
.vimrcto each server you need to work on,
edit the remote files from your local
vim like this:
$ vim scp://[email protected]//path/to/file/file.extension
If you have already a
remoteuseris the user name on the remote server
hostis the remote server name/ip
This opens the file seamingly in place (it actually copies the file locally), and when you save, it sends the edited file back to the server for you.
It asks for an ssh password, but this can be streamlined via ssh keys.
The only drawback of this method is that you don’t get path/file competion as you would when working directly on the machine which is not a big deal beside advantages.
- 2020-11-06 : Change title and filename. Add scp tag.