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
当前回答
根据你的具体需要,你可以考虑使用bt同步。在你的家庭电脑和工作电脑上创建一个共享文件夹。在你的家庭电脑上编辑文件(使用Sublime或其他你喜欢的工具),当你保存时,它们会自动同步。BitTorrent Sync不依赖于存储文件的中央服务器(如Dropbox等),所以理论上你应该清楚由于第三方存储敏感信息的任何问题。
其他回答
作为@ubik回答的后续,以下是让“subl”命令在远程服务器上工作的三个简单(一次性)步骤:
使用Sublime包管理器在Sublime Text中安装rsub包 [Local]执行以下Bash命令(这将建立一个SSH隧道,这是rsub的秘密武器): printf "Host *\n RemoteForward 52698 127.0.0.1:52698" >> ~/.ssh/config 在远程服务器上执行以下Bash命令(这将安装subl shell命令): sudo wget -O /usr/local/bin/subl https://raw.github.com/aurora/rmate/master/rmate Sudo chmod +x /usr/local/bin/subl
瞧!你现在在SSH上使用Sublime Text。
你可以从服务器上用subl ~/test.txt打开Sublime Text中的示例文件
你可以试试我一直在研究的一种叫做“xeno”的东西。它将允许您通过SSH连接打开Sublime文本(或任何本地编辑器)中的文件/文件夹,并自动将更改同步到远程机器。它应该可以在几乎所有的POSIX系统上工作(我自己使用它从OS X连接到Linux机器并在Sublime Text中编辑文件)。它是免费的,开源的。我想要一些反馈。
For more information: it's basically a Git/SSH mashup written in Python that allows you to edit files and folders on a remote machine in a local editor. You don't have to configure kernel modules, you don't need to have a persistent connection, it's all automatic, and it won't interfere with existing source control because it uses an out-of-worktree Git repository. Also, because it's built on Git, it's extremely fast and supports automatic merging of files that might be changing on both ends, unlike SSHFS/SFTP which will just clobber any files with older timestamps.
有三种方法:
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,但这将非常缓慢。
你可以使用sftp挂载远程目录在你的位置机器上,然后简单地打开文件使用Sublime文本你通常会。
要使用sftp挂载远程目录,在Linux文件管理器上输入以下命令;
sftp://user@remote_box.com:22/home/user/code_directory
它可能看起来很慢,这取决于你的网速。但这对我很管用。
我知道这很老了,但我有一个很酷的方法值得分享。
Conemu和WinSCP工具需要准备的内容。这些都是简单的指令
Open WinSCP.exe and login to my desired remote server (I have found that it's important to login before attaching ... ). In the preferences for WinSCP - two settings to change. Choose Explorer type interface and rather than Commander - so you don't see local files. Unless you want to (but that seems like it would suck here). Set up Sublime as your default editor. With ConEmu open, right click the tab bar and select the option Attach to.... A dialog box will open with your running applications. Choose, WinSCP and select OK. ConEmu will now have an open tab with WinSCP displaying your remote files. Right click on the WinSCP tab and choose New console.... When the dialog box opens, enter the path to the Sublime executable on your system. Before you press Start, In the box that says New console split select the radio button to right and set the percentage. I usually choose 75%, but you can customize this to your liking, and it can be changed later. Now you will see Sublime in the same window running to the right of WinSCP. In Sublime, from the View menu, choose Sidebar->Hide Sidebar, and bam, you now have remote files in exactly the same manner as you would locally - with a few caveats of course that comes with editing anything remotely. WinSCP is lightening fast though.
我有两个显示器-左边显示器显示Chrome浏览器,右边显示器显示代码编辑器。同样在ConEmu中,我创建了另一个选项卡并ssh到我正在工作的站点,所以我可以远程运行gulp或grunt,也可以从命令行操作文件。认真加快发展。
这是一张截图:
推荐文章
- Github权限被拒绝:ssh添加代理没有身份
- 如何修复/转换崇高文本的空间缩进?
- 警告:未受保护的私钥文件!当尝试SSH到Amazon EC2实例时
- 如何设置ssh超时时间?
- 如何在SSH上使用Sublime
- 使用Git GUI或SSH -keygen的SSH私钥权限太开放
- 在gitlab上被拒绝许可(公钥)
- 使用脚本自动输入SSH密码
- 在Linux中是否有办法继续中断的scp(安全拷贝)命令进程?
- 为什么SSH远程命令得到的环境变量比手动运行时少?
- 将Keypair添加到现有的EC2实例中
- 如何解决“sign_and_send_pubkey:签名失败:代理拒绝操作”?
- 对于未设置密码的OpenSSH私钥,如何添加密码?
- 'heroku'似乎不是一个git存储库
- 如何使标尺始终显示在崇高的文本2?