Feb 032010
 

if you need to make an edit to a file on a remote server simply

vim scp://hostname.example.com//path/to/file.txt (will require username on remote host to be the same as what you have on screen)
[email protected]'s password: (enter pw)
Press ENTER or type command to continue (hit enter, file opens, make edits, then save and close)
:wq
[email protected]'s password: (enter pw)
#

Or, if you need to connect as a different user:

$ vim scp:[email protected]//path/to/file.txt

If you need to specify an alternate port, use the familiar colon (:) syntax:

$ vim scp:[email protected]:5757//path/to/file.txt

That’s all there is to it! The file is read into VIM from the remote system, if it exists. Then, you are free to make changes. When you save, changes are written to the remote system.

 Posted by at 7:35 am