views:

121

answers:

9

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.

A: 

Forward your X11 session to your terminal.

http://dragonwall.net/xdeep-putty.html

This probably belongs on superuser.com.

Vitor Py
+4  A: 

There are various options.

You can make the terminal larger. ;)

If you have a graphical environment installed on the machine you are ssh'ing into, you can login with ssh -X (or xdeep-putty if you are on Windows) to enable window forwarding. You can then run your favourite editor on the remote machine, whose graphical output is forwarded.

Finally, you can mount the ssh connection into your file system, using for example fuse (similar options might exist for non-linux operating systems). That allows you to access any file on the remote machine as if it were in your filesystem, with your favourite editor, locally.

relet
+1 yep, mounting with FUSE and editing with your favorite editor works well.
neoneye
A: 

X11 forward can be sluggish... what OS are you connecting to? You might try 'nano' on ubuntu, or 'diakonos' if you want windows key bindings.

peter karasev
A: 

If you using windows, try Editplus. It's not free but allows you to open files directly over scp. Custom syntax files are coming really handy, too.

+2  A: 

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 aptitude install sshfs

and then mount the remote filesystem like this

mkdir ~/remote_code
sshfs remote.example.com:/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.

Gerald Senarclens de Grancy
I am using windows which is terrible at all things useful (minus Adobe) and switching over to an Ubuntu VM allowed me to use it's awesome terminal which allows resizing! So for now I'll just edit files with vim since I can now make that nasty line-wrapping go away. I will also look into mounting the filesystem!
Xeoncross
Glad to hear you already have a workaround for your problem. When using a VM w/ Ubuntu, sshfs should work just as you desire. If you'd like to stick w/ Windows, you could install the tools provided by Cygwin (http://www.cygwin.com/) offering a more capable terminal + shell w/ a nice ssh client etc.
Gerald Senarclens de Grancy
Just finished setting up sshfs and I'm very pleased with it. Tried looking into fuse but I couldn't figure it out.
Xeoncross
Glad to hear that sshfs does the trick for you :)
Gerald Senarclens de Grancy
A: 

I'm not 100% sure if this works for files owned by root, but if your desktop is KDE & your remote system is Linux (or pretty much any form of *nix), you can get konqueror to access the remote machine using the "fish://" protocol. From there you can open the file from konqueror using kate, or your preferred editor, and konqueror will take care of copying the file to your local machine and copying it back when you save.

Failing which the X11 forward is a good option, but X11 over ssh to remote sites can be slow. "ssh -X -C" compresses the data stream and can give better performance.

Bruce Clement
A: 

You might try the Komodo editor. It has a feature to load a 'remote file' over ssh. It's really convenient.

Alex JL
A: 

Emacs and ange-ftp.

Patrick
+1  A: 
h3xStream
Yes, I use this with SciTE often.
Xeoncross