如何在 Textmate 中自动识别,类似于 Emacs
如何在 Textmate 中自动缩进类似于 Emacs 下此代码的效果:
(defun set-newline-and-indent ()
(local-set-key (kbd "RET") 'newline-and-indent))
(add-hook 'c-mode 'set-newline-and-indent)
即我不想按回车键,然后按 Tab 键缩进。我想按回车键并让 Textmate 根据语言自动缩进到正确的位置。
感谢您的任何提示。
How do I auto-indent in Textmate similar to the effect of this code under Emacs:
(defun set-newline-and-indent ()
(local-set-key (kbd "RET") 'newline-and-indent))
(add-hook 'c-mode 'set-newline-and-indent)
i.e. I don't want to hit return, then tab to indent. I want to hit return and have Textmate automatically indent to the correct location based on the language.
Thanks for any hints.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Textmate 应该自动执行此操作。如果没有,您可以在包编辑器中创建自定义宏、命令或代码片段来为您完成此操作。
Bundles -> Bundle Development -> Show Scope
)。它应该类似于source.ruby string.quoted.double.ruby
。如果操作正确,您的快捷方式应该触发指定范围内的捆绑包项目,而不是插入新行。
查看包编辑器内的
CSS ->;属性 {}(})
捆绑项作为示例。Textmate should do this automatically. If if doesn't, you can create a custom macro, command, or snippet in the bundle editor which does it for you.
Bundles -> Bundle Development -> Show Scope
). It should look something likesource.ruby string.quoted.double.ruby
.If done correctly, your shortcut should trigger the bundle item in the assigned scope instead of inserting a new line.
Look inside the bundle editor at the
CSS -> properties {}(})
bundle item for an example.