macos 使用 TextMate 通过 SSH 编辑远程文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2597712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Editing remote files over SSH, using TextMate?
提问by Zack Burt
I LOVE using TextMate on my MacBook. It's great.
我喜欢在我的 MacBook 上使用 TextMate。这很棒。
Unfortunately, I want to edit some files directly on my dev server, since it's difficult to recreate the environment locally. I'm using Git, so one alternative is to just edit locally, git commit, git push, and then git merge, but that's kind of complicated every time I want to make a simple change.
不幸的是,我想直接在我的开发服务器上编辑一些文件,因为很难在本地重新创建环境。我正在使用 Git,所以另一种选择是在本地编辑、git commit、git push,然后 git merge,但是每次我想要做一个简单的更改时,这都会有点复杂。
I'd rather just ... use another solution. One thing I tried is mounting a hard drive via MacFusion, and then loading that in an editor. But that's so freaking laggy/slow!
我宁愿......使用另一种解决方案。我尝试过的一件事是通过 MacFusion 安装硬盘驱动器,然后将其加载到编辑器中。但这实在是太迟钝了/太慢了!
Has anyone cooked up a better solution?
有没有人想出更好的解决方案?
采纳答案by Kim Sharma
OK - here is the one that works on Mountain Lion.
好的 - 这是适用于 Mountain Lion 的那个。
- Go to http://osxfuse.github.com/
- Install FUSE for OS X
- Install SSHFS for OS X
- Then the following commands on your terminal:
- 转到http://osxfuse.github.com/
- 为 OS X 安装 FUSE
- 为 OS X 安装 SSHFS
- 然后在终端上执行以下命令:
mkdir /Volumes/SSHFS
/usr/local/bin/sshfs username@host:/path/to/dir /Volumes/SSHFS
mkdir /Volumes/SSHFS
/usr/local/bin/sshfs username@host:/path/to/dir /Volumes/SSHFS
Done.
完成。
I would also recommend using the ReMate plugin as pointed out by another user to prevent TextMate from beach-balling every time you refocus it. Link:
我还建议使用另一位用户指出的 ReMate 插件,以防止 TextMate 在每次重新聚焦时进行沙滩球。关联:
ReMate http://ciaranwal.sh/remate
ReMate http://ciaranwal.sh/remate
回答by Scott Giese
I use Fetch and TextMate for just such tasks. Fetch can be set to use TextMate as an external editor and can even automatically open files in TextMate by double clicking.
我将 Fetch 和 TextMate 用于此类任务。Fetch 可以设置为使用 TextMate 作为外部编辑器,甚至可以通过双击自动打开 TextMate 中的文件。
Saving the window in TextMate automatically pushes the file back to the server. Of course you would have to commit the changes on the server at a later time.
在 TextMate 中保存窗口会自动将文件推送回服务器。当然,您必须稍后在服务器上提交更改。
I'm sure most Mac FTP clients could do the same.
我相信大多数 Mac FTP 客户端都可以这样做。
回答by Ahmed Jolani
回答by Roger Gilbrat
I use the free version of TextWrangler for just this and it works great. I can load and save files over sftp.
我为此使用了 TextWrangler 的免费版本,而且效果很好。我可以通过 sftp 加载和保存文件。
回答by ascotan
The correct answer is to use sshfs and make sure "Perform atomic saves" is checked in the Textmate preferences window. The easiest way to setup sshfs is to use Macfusion. http://macfusionapp.org/.
正确的答案是使用 sshfs 并确保在 Textmate 首选项窗口中选中“执行原子保存”。设置 sshfs 的最简单方法是使用 Macfusion。http://macfusionapp.org/。
回答by romainl
If you are not able — for whatever reason — to replicate your environment locally and still want to use TextMate, the FTP client+TextMate combo is the best solution I can think of. MacFusion and all the other similar solutions are neat on the paper but awfully slow.
如果您无法(无论出于何种原因)在本地复制您的环境,但仍想使用 TextMate,则 FTP 客户端 + TextMate 组合是我能想到的最佳解决方案。MacFusion 和所有其他类似的解决方案在纸面上都很整洁,但速度非常慢。
If you feel adventurous and confident enough to drop the TextMate requirement, SSH+Vim in the terminal works amazingly well.
如果您有足够的冒险精神和信心放弃 TextMate 要求,那么终端中的 SSH+Vim 效果非常好。
Are you positive you can't replicate at all your remote environment?
您确定无法在远程环境中进行复制吗?
回答by Nick Jennings
I know this question already has several answers, and it's been a while, but I wanted to also point out DokanSSHFS - This will use SSH to make a local drive of the directory location on the server that you choose. Then you can use your editor of choice to edit the files as if they were on a local disk.
我知道这个问题已经有几个答案,而且已经有一段时间了,但我还想指出 DokanSSHFS - 这将使用 SSH 在您选择的服务器上创建目录位置的本地驱动器。然后您可以使用您选择的编辑器来编辑文件,就像它们在本地磁盘上一样。
回答by Eddy Pronk
Try one of these methods.
尝试其中一种方法。
see: http://wiki.macromates.com/Main/FAQ#projects
见:http: //wiki.macromates.com/Main/FAQ#projects
also have a look at:
也看看:
回答by Lie Ryan
You don't need to push
every time you make simple changes; git is a distributed version control system, you commit
to your local repository for the small changes. You should only push
to the remote repository once you finished working on a feature/bug (or for really huge feature, a complete subfeature). Well, that's assuming you can recreate the environment; which apparently you can't.
您不需要push
每次进行简单的更改;git 是一个分布式版本控制系统,您可以commit
对您的本地存储库进行小的更改。push
一旦你完成了一个功能/错误(或者对于非常大的功能,一个完整的子功能),你应该只到远程存储库。好吧,假设您可以重新创建环境;显然你不能。
A decent text editor can have integration with your favorite control version system; if you cannot configure your editor to commit and push from inside your editor, get a decent editor.
一个体面的文本编辑器可以与您最喜欢的控件版本系统集成;如果您无法将编辑器配置为从编辑器内部提交和推送,请使用合适的编辑器。
An even better editor can be set to save, commit, push, compile, and run your program all in one click or keypress.
一个更好的编辑器可以设置为通过单击或按键来保存、提交、推送、编译和运行您的程序。
回答by Sergei G
Most of the proposed solutions are centered around sshfs in one form or another. I have tried these solutions, but I found that reliability of filesystem is not always as good as desired.
大多数提议的解决方案都以一种或另一种形式围绕 sshfs。我已经尝试过这些解决方案,但我发现文件系统的可靠性并不总是如预期的那样好。
There is tool called rmate, which allows editing of remote files in text mate.
有一个名为rmate 的工具,它允许在 text mate 中编辑远程文件。
Use command from ssh session to edit file on the server:
使用来自 ssh 会话的命令来编辑服务器上的文件:
rmate file_name
The readme on github provides easy to follow instructions on how to set it up.
github 上的自述文件提供了关于如何设置它的易于遵循的说明。