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,可以在数字海洋上看到这个来自好心的人的啧啧声

其他回答

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

另一个类似于osxfuse的mac解决方案是只使用Panic Software的传输FTP客户端,它允许您将远程文件夹挂载为本地磁盘。它支持SFTP,非常安全。

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

有三种方法:

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

一个对我来说非常有用的解决方案——在Mac上进行本地编辑,然后让文件自动同步到远程机器上

Make sure you have passwordless login to the remote machine. If not, follow these steps http://osxdaily.com/2012/05/25/how-to-set-up-a-password-less-ssh-login/ create a file in ~/Library/LaunchAgents/filesynchronizer.plist, with the following content: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>filesynchronizer</string> <key>ProgramArguments</key> <array> <string>/usr/bin/rsync</string> <string>-avz</string> <string>/Users/USERNAME/SyncDirectory</string> <string>USERNAME@REMOTEMACHINE:~</string> </array> <key>WatchPaths</key> <array> <string>/Users/USERNAME/SyncDirectory</string> </array> </dict> </plist> In a terminal window run launchctl load ~/Library/LaunchAgents/filesynchronizer.plist That's it. Any changes to any files in ~/SyncDirectory will be synchronized to ~/SyncDirectory on the remote machine. Local changes will override any remote changes.

这将创建一个监视SyncDirectory的launchd作业,当有任何更改时,将运行rsync将该目录同步到远程计算机。