如何在Textmate包中更改语言上下文?

时间:2021-01-01 07:23:58

I'd like to get my Textmate bundles to use the correct contexts based on what I'm editing. For example I use YUI a lot so I'd like the HTML bundle to use the YUI JS bundle instead of the standard JS one, etc.

我想让我的Textmate包根据我正在编辑的内容使用正确的上下文。例如,我使用YUI很多,所以我希望HTML包使用YUI JS包而不是标准的JS包等。

Can anyone suggest where and what I should be editing to make that happen. Bonus points for tips on bundle editing.

任何人都可以建议我应该编辑的位置和内容以实现这一目标。有关捆绑编辑的提示的奖励积分。

1 个解决方案

#1


The thing we are talking about here is scope. You'll have to edit your Bundle elements scope.

我们在这里讨论的是范围。您必须编辑Bundle元素范围。

Let's take a look:

让我们来看看:

alt text http://mtod.org/so/scope.png

alt text http://mtod.org/so/scope.png

Now, edit the scope to a wider one, for example use source.js instead of source.js.yui. This should be applied to every snippet, command, etc. in the Bundle. You could probably do a search & replace directly on your Bundle files.

现在,将范围编辑为更宽的范围,例如使用source.js而不是source.js.yui。这应该应用于Bundle中的每个片段,命令等。您可以直接在Bundle文件上进行搜索和替换。

alt text http://mtod.org/so/edit.png

alt text http://mtod.org/so/edit.png

That's it. Bundle snippet triggered below.

而已。下面触发的捆绑片段。

alt text http://mtod.org/so/yui.png

alt text http://mtod.org/so/yui.png

#1


The thing we are talking about here is scope. You'll have to edit your Bundle elements scope.

我们在这里讨论的是范围。您必须编辑Bundle元素范围。

Let's take a look:

让我们来看看:

alt text http://mtod.org/so/scope.png

alt text http://mtod.org/so/scope.png

Now, edit the scope to a wider one, for example use source.js instead of source.js.yui. This should be applied to every snippet, command, etc. in the Bundle. You could probably do a search & replace directly on your Bundle files.

现在,将范围编辑为更宽的范围,例如使用source.js而不是source.js.yui。这应该应用于Bundle中的每个片段,命令等。您可以直接在Bundle文件上进行搜索和替换。

alt text http://mtod.org/so/edit.png

alt text http://mtod.org/so/edit.png

That's it. Bundle snippet triggered below.

而已。下面触发的捆绑片段。

alt text http://mtod.org/so/yui.png

alt text http://mtod.org/so/yui.png