在 Xcode 中自动插入右括号
当我输入开头的“(”时,有没有办法让 Xcode 附加一个右括号“)”?我知道它是为那些 {} 执行此操作。我真的很怀念 Textmate :( 定义哪些字符应该是的通用方法输入开头时自动插入将是很酷的。
is there a way to have Xcode append a closing bracket ")" when I type the opening one "("? I know that it does this for those {}. I really miss Textmate :( A generic way to define which chars should be automatically inserted when the opening ones are entered would be kickass.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Xcode 3.1 中,转到“首选项”->“缩进”
检查 Syntax-ware 缩进是否开启
并选中自动插入结束字符“}”
并选择要在开始字符时插入的字符。
另外,为什么不使用 Textmate,没有什么可以阻止你,Xcode 会注意到文件是否在外部编辑
In Xcode 3.1 go to Preferences->Indentation
Check Syntax-ware indenting to on
and check Automatically insert closing "}"
and choose the characters you want to be inserted when the opening one is.
Also why not use Textmate nothing stops you and Xcode will notice if a file is edited externally
查看“编辑”->“插入文本宏”->“目标 C”->“括号表达式”。这将插入一对匹配的括号(或者如果您有突出显示的内容,请在其周围加上括号)。您可以将其绑定到 [ 作为键盘快捷键。
您可以按照此处的说明为括号创建一个。我尝试过但无法使其发挥作用。
http://cocoawithlove.com/2008/ 06/hidden-xcode-build-debug-and-template.html#textmacros
就个人而言,我将类文件夹拖到 Textmate 并在那里进行编辑。当我需要输入一些长方法名称或进行构建时,我会切换回 Xcode。我一直在为我在 Textmate 中所做的一些常见事情构建一个片段库,以使那里的生活更轻松。
Have a look under Edit->Insert Text Macro->Objective C->Bracket Expression. This will insert a matched pair of brackets (or if you have something highlighted, put brackets around it). You could bind this to [ as a keyboard shortcut.
You can follow the instructions here to create one for parentheses. I tried but couldn't make it work.
http://cocoawithlove.com/2008/06/hidden-xcode-build-debug-and-template.html#textmacros
Personally, I drag the classes folder over to Textmate and edit there. I switch back to Xcode when I need to type in some long method name, or to build. I've been building a library of snippets for some of the common things I do in Textmate to make life easier there.