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


当前回答

您可以使用rsub,它的灵感来自TextMate的rate。从描述来看:

Rsub是Sublime Text 2的TextMate 2的“rate”特性的实现,允许使用SSH端口转发/隧道在远程服务器上编辑文件。

这里有一个关于如何正确设置它的好教程:(断开链接)http://log.liminastudio.com/writing/tutorials/sublime-tunnel-of-love-how-to-edit-remote-files-with-sublime-text-via-an-ssh-tunnel

其他回答

使用FileZilla

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

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

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

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

Lsyncd似乎是SSHFS方法的一个不错的替代方案。如果你使用“-delay 0”,它可以实时工作。

这是本地编辑远程主机上的文件的最简单的方法,您之前已经设置了ssh到远程IP

# issue on local box

sudo apt-get install sshfs   # on local host install sshfs ( linux )

# on local box create secure mount of remote directory

export REMOTE_IP=107.170.58.249 # remote host IP

sshfs myremoteuserid@${REMOTE_IP}:/your/remote/dir  /your/local/dir # for example

完成了! !

现在在本地主机上开始编辑文件…当你在本地列出目录时,它可能不会列出任何东西,直到你CD到子目录或列出一个特定的文件…延迟加载…这不会影响编辑文件

subl /your/local/dir/magnum_opus.go # local file edit using sublime text

上面是编辑远程文件

/your/remote/dir/magnum_opus.go  # remote file on box $REMOTE_IP

对于OSX或Windows,可以在数字海洋上看到这个来自好心的人的啧啧声

有三种方法:

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,但这将非常缓慢。

您可以使用rsub,它的灵感来自TextMate的rate。从描述来看:

Rsub是Sublime Text 2的TextMate 2的“rate”特性的实现,允许使用SSH端口转发/隧道在远程服务器上编辑文件。

这里有一个关于如何正确设置它的好教程:(断开链接)http://log.liminastudio.com/writing/tutorials/sublime-tunnel-of-love-how-to-edit-remote-files-with-sublime-text-via-an-ssh-tunnel