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


当前回答

这是本地编辑远程主机上的文件的最简单的方法,您之前已经设置了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,可以在数字海洋上看到这个来自好心的人的啧啧声

其他回答

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

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

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

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

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.

您可以使用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

这是本地编辑远程主机上的文件的最简单的方法,您之前已经设置了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,可以在数字海洋上看到这个来自好心的人的啧啧声

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