Use a VIM VI on an external server to edit local files

Can I use a vi / vim instance on a remote server to edit a local file?

Something line by line:

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

      

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

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

+3


source to share


1 answer


You can use this command:

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

      



vim copy the file in local / tmp to file type /tmp/v7MZ6yF/0

in the background.

+4


source







All Articles