Xcode — 在外部编辑器中快速打开当前文件 [英] Xcode — quickly open current file in external editor
本文介绍了Xcode — 在外部编辑器中快速打开当前文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以设置键盘快捷键(或在某处添加一些菜单项)以在外部编辑器中打开当前编辑的文件?
Is it possible to set a keyboard shortcut (or maybe add some menu item somewhere) to open currently edited file in external editor?
(显然我可以这样做 [(在文件树中右键单击 → 在 Finder 中显示)/(在窗口标题中右键单击 → 选择包含目录)] → 右键单击文件 → 打开方式 → 应用程序" —但是步骤太多了.)
推荐答案
嗯,我找到了.
- 启动 Automator.app.
- 选择服务".
- 将运行 AppleScript"拖放到工作流程中.
- 将服务接收"设置为无输入",应用程序为 Xcode.
粘贴此代码(用您的编辑器替换 MacVim)
- Start Automator.app.
- Select "Service".
- Drag-n-drop "Run AppleScript" to workflow.
- Set "service receives" to "no input", and application is Xcode.
Paste this code (replace MacVim with your editor)
tell application "Xcode"
set current_document to last source document
set current_document_path to path of current_document
end tell
tell application "MacVim"
activate
open current_document_path
end tell
保存工作流程.
Save workflow.
我从这个项目中借用了 AppleScript 代码:Xcode 4 的 Uncrustify Automator 服务.
I've borrowed AppleScript code from this project: Uncrustify Automator Services for Xcode 4.
这篇关于Xcode — 在外部编辑器中快速打开当前文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文