DismissedAsDrone
DismissedAsDrone

Reputation: 185

Use VI VIM on External Server to Edit Local Files

Is there any way to use an instance of vi/vim on a remote server to edit a local file?

Something along the lines of:

cat $local_file | ssh -t $remote_server "vim -" > $local_file

[I'm using the code above only to simplify and illustrate the intent of the question]

I know that I can go the other way and edit the file from the remote_server using vim + scp, but I was curious if it could be done in this direction as well.

Upvotes: 3

Views: 543

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185161

You can use this kind of command :

ssh -t remote 'vim scp://root@oldy//etc/resolv.conf'

vim copy the file in local /tmp in a file like /tmp/v7MZ6yF/0 in the background.

Upvotes: 4

Related Questions