I'm trying to use Sublime Text 2 as an editor when I SSH in to my work server, and I'm stumped. I found this http://urbangiraffe.com/2011/08/13/remote-editing-with-sublime-text-2/ (among many other posts) that looks like it might help, but I don't follow it exactly, particularly with what values I should put in for the remote variable in line 5. I set "/Users/path/to/local/copy" to my local root directory, but I don't know if that's right or if there's more to do. Any thoughts? I'm on OSX10.8


当前回答

你可以使用sftp挂载远程目录在你的位置机器上,然后简单地打开文件使用Sublime文本你通常会。

要使用sftp挂载远程目录,在Linux文件管理器上输入以下命令;

sftp://user@remote_box.com:22/home/user/code_directory

它可能看起来很慢,这取决于你的网速。但这对我很管用。

其他回答

有三种方法:

Use SFTP plugin (commercial) http://wbond.net/sublime_packages/sftp - I personally recommend this, as after settings public SSH keys with passphrase it is safe, easy and worth every penny http://opensourcehacker.com/2012/10/24/ssh-key-and-passwordless-login-basics-for-developers/ Mount the remote as local file system using osxfuse and sshfs as mentioned in the comments. This might be little difficult, depending on OSX version and your skills with UNIX file systems. Hack together something like rmate which does file editing over remote tunneling using some kind of a local daemon (very difficult, cumbersome, but sudo compatible) http://blog.macromates.com/2011/mate-and-rmate/

此外,理论上,你可以在远程服务器上安装X11,并通过VNC或X11转发在那里运行Sublime,但这将非常缓慢。

I am on MacOS, and the most convenient way for me is to using CyberDuck, which is free (also available for Windows). You can connect to your remote SSH file system and edit your file using your local editor. What CyberDuck does is download the file to a temporary place on your local OS and open it with your editor. Once you save the file, CyberDuck automatically upload it to your remote system. It seems transparent as if you are editing your remote file using your local editor. The developers of Cyberduck also make MountainDuck for mounting remote files systems.

你可以使用sftp挂载远程目录在你的位置机器上,然后简单地打开文件使用Sublime文本你通常会。

要使用sftp挂载远程目录,在Linux文件管理器上输入以下命令;

sftp://user@remote_box.com:22/home/user/code_directory

它可能看起来很慢,这取决于你的网速。但这对我很管用。

使用FileZilla

这适用于Mac和Windows用户(我在Mac上使用)。多年来,我使用了列出的几个答案,发现FileZilla很适合我在有SSH访问权限的远程主机上编辑文件时的需求。它的设置也很快。

我配置一个新的服务器连接 连接到服务器 右键点击我想编辑的文件,选择查看/编辑。

这会打开我的默认编辑器(Sublime),但它可以与任何编辑器一起工作 已安装的编辑器。

一旦我保存了文件,Filezilla会自动提示我是否要“将该文件上传到服务器”,我点击“是”,然后它就更新了。

根据你的具体需要,你可以考虑使用bt同步。在你的家庭电脑和工作电脑上创建一个共享文件夹。在你的家庭电脑上编辑文件(使用Sublime或其他你喜欢的工具),当你保存时,它们会自动同步。BitTorrent Sync不依赖于存储文件的中央服务器(如Dropbox等),所以理论上你应该清楚由于第三方存储敏感信息的任何问题。