Vim logo vim online Vim Book Ad

 Tip #337: editing remote files via scp in vim

 tip karma   Rating 66/27, Viewed by 798 

created:   October 3, 2002 12:56      complexity:   intermediate
author:   Matthew Weier O'Phinney      as of Vim:   6.0

VIM 6.x has the netrw plugin installed as a standard plugin. It allows you to edit files via ftp, rcp, scp, or http. If your username differs on the remote host, however, and you're trying to use scp, things can get a little wierd, particularly if you're not editing a document under your user tree.

To get around this, try opening the file as follows:
    vim scp://[email protected]//path/to/document
Notice two things: adding the "remoteuser@" syntax, and the use of two slashes (//) between the servername and the path. The first sets the remote user so that scp will not grab the $USERNAME environment variable, the second will appropriately set the absolute path.

 rate this tip  Life Changing Helpful Unfulfilling 

<<type the line number and press enter to get there | vim + cscope + cygwin >>

Additional Notes

nickm(at)mail.sochi.ru, October 14, 2002 13:41
Good tip!

ps RTFM ;-)
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo