打开本地文本应用程序以使用 ssh 编辑远程文本文件?
所以我在使用 ssh 的 VPS 终端中。
在正常情况下,我可以在本地运行
mate <file>
,它会使用该文件启动 TextMate。
是否可以使用相同的命令并以某种方式打开本地 TextMate 应用程序但编辑远程文件?
如果您在 VPS 中工作并且不想一直使用 vim,那会很好。
So i am in a VPS terminal using ssh.
In normal case I could just run locally
mate <file>
and it fires up TextMate with that file.
Is it possible to use the same command and somehow open the local TextMate application but editing the remote file?
That would be good if you are working in VPS and don't want to use vim all the time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
解决方案是使用
sshfs
挂载远程系统。在 OS X 上,可以使用 Homebrew 安装sshfs
。文件系统是使用常规 SSH 凭据或密钥通过 SSH 挂载的,因此非常容易做到,然后您可以像本地目录一样导航它,并享受访问所有本地工具的好处。
The solution is to mount the remote system using
sshfs
. On OS X,sshfs
can for instance be installed by using Homebrew.The filesystem is mounted via SSH using your regular SSH credentials or key so it's very easy to do, and then you navigate it as if it's a local directory and enjoy the benefit of having access to all your local tools.
您有不同的选择:
几年前,我曾经在一些项目中这样做过,并且它对于 LAN 和 WAN 都运行得很好。
如果您想坚持使用 TextMate,则 furtive 的解决方案是理想的。
You have different options:
I used to do this in a few years back for some projects, and it worked perfectly, both for LANs and WANs.
If you want to stick to TextMate, then furtive's solution is ideal.
或者,您可以通过 ssh 与 rsync 同步文件夹。
这样您就可以在本地工作,并让 rsync 为您将其同步到服务器。这可以由您显式启动或在守护进程中运行。
Alternatively you could sync the folder with rsync over ssh.
That way you work locally, and let rsync sync it to the server for you. That could either be explicitly initiated by you or be run in a daemon.
如果您通过 ssh 到另一个盒子,那么您可以使用 cat 打开该文件并将其通过管道传输到本地文件。
我不认为您可以将其流式传输到本地框中的编辑器。
If you do ssh to another box then you can open the file using cat and pipe it to a local file.
I dont think so that you can stream it to an editor in the local box.
另一种选择是使用两个可用的 Textmate Sync 捆绑包之一 - 两者都使用 rsync 和 ssh 来保持远程和本地文件夹同步。
Textmate 远程同步包
这是我使用的捆绑包。它看起来与第二个捆绑包具有完全相同的功能,但我首先找到了这个。
Textmate 同步捆绑包
我要添加的唯一警告是第一次同步将清除远程文件夹并将其替换为本地文件夹中的内容。
Another option is to use one of the two available Textmate Sync bundles - both use rsync and ssh to keep the remote and local folders synchronized.
Textmate remote sync bundle
This is the bundle I use. It looks to have the exact same functionality as the second bundle but I found this one first.
Textmate Sync bundle
The only word of warning I would add is the first sync will clear the remote folder and replace it with the contents from the local folder.
http://kennethreitz.com/remote-textmate-development-via -ssh-and-rsync.html
http://kennethreitz.com/remote-textmate-development-via-ssh-and-rsync.html