我喜欢Textmate,但这有点奇怪,总是困扰着我。
我目前正在使用版本1.5.10。
我使用Command + Option + Dot
来关闭html标记,但是当我这样做时,结果就是这样。
<html>
</html>
我希望Textmate知道如何做到这一点。添加关闭标记时自动解除缩进。
<html>
</html>
顺便说一句,这适用于Ruby代码。输入end
时,Textmate会缩进。
答案 0 :(得分:2)
TextMate中的Insert Close Tag (⌘⌥.)
命令(以及Bundles菜单中的所有其他命令)可通过Bundle Editor
完全自定义。
如果您打开捆绑编辑器(Bundles
&gt; Bundle Editor
&gt; Show Bundle Editor (⌃⌘⌥B)
),并在左侧列表中找到“插入关闭标记”命令,则应该能够查看和编辑该命令中的代码。
要实现非缩进功能,请找到此代码块(位于文件末尾):
else
print "</#{stack.pop}>"
end
并修改它,使其看起来像这样:
else
print "</#{stack.pop}>"
%x{ osascript -e 'tell application "System Events" to key code 33 using command' }
end
这一额外的代码行告诉TextMate,在插入结束标记之后,它应该通过模拟按下组合键Shift Left
来执行⌘[
命令 - 从而取消缩进代码。