如何通过SSH编辑文件? [英] How do you edit files over SSH?

查看:627
本文介绍了如何通过SSH编辑文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用eclipse编程,有时使用GUI文本编辑器(例如SciTE或vim)。但是,我正处于一个项目中,要求我在80列SSH窗口中通过ssh连接编辑文件。

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.

因为我必须(*颤抖*) sudo vim ,在我打开文件之前,我不确定如何在终端之外的编辑器中打开文件(这样可以我看到的文字超过80列)。如果命令行较大,那么我想使用直接vim不会有问题。

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.

推荐答案

也许您应该只是将远程文件系统挂载到本地计算机上,然后使用任何喜欢的编辑器如果运行的是Debian衍生版本,请安装sshfs

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 $USER@remote.example.com:/home/$USER/code ~/remote_code

完成此操作后,您可以使用任何GUI工具访问〜/ remote_code中的代码,而无需使用ssh -X占用带宽(但是您仍然需要良好的连接w / ping时间短)。

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:使用ssh时,我可以将终端设置为适合我的屏幕的宽度,然后使用其全宽度,所以我担心我不能完全理解您的问题。

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.

这篇关于如何通过SSH编辑文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆