Edit remote file with vim

Editing a file located in a remote machine with vim on my local machine has never cross my mind until now. Today, I need to do some coding in a remote machine that didn’t have vim installed and I don’t have the right to install it there. Vim support what I need:

vim scp://user@remoteHost//path_to_file
E.g. vim scp://user@10.1.1.10//home/user/help.txt

*Note the double slash after the remote host. Single slash will not work.

The command will:
1. Download the remote file.
2. Start vim to edit it.
3. Upload the file back to remote host every time you save.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: