How do you edit files over SSH?

Xeoncross picture Xeoncross · Aug 4, 2010 · Viewed 93.9k times · Source

I program with eclipse and sometimes use GUI text editors like SciTE or vim. However, I'm at a point in a project that requires me to edit files over a ssh connection in a 80 column SSH window.

Since I have to (* shiver*) sudo vim before I can open the file I'm not sure how to open the file in an editor outside the terminal (that would allow me to see the text wider than 80 columns). If the command line was larger then I guess using straight vim wouldn't be a problem.

I'm at a loss of how to deal with this situation and how I could turn this nightmare into a manageable coding environment.

Answer

Maybe you should simply mount the remote filesystem to your local machine and then use whatever editor you like. If running a Debian derivative, install sshfs

sudo apt-get install sshfs

and then mount the remote filesystem ( issue on your local machine )

mkdir ~/remote_code
sshfs [email protected]:/home/$USER/code ~/remote_code

Once this is done you can access the code in ~/remote_code w/ any of your GUI tools and without the bandwidth overhead of using ssh -X (however you still need a good connection w/ a low ping time).

PS: When using ssh I can make the terminal as wide as it fits my screen and then use its full width, so I fear I don't completely understand your issue.