最喜欢的 Textmate 命令、片段、捆绑包等
这不是一个具体的一般编程问题,但我认识的很多 textmate 用户最终都会构建一个 textmate 命令来完成他们经常做的事情,但由于它本身从未真正发布过。 下面是:
Objective-C 构建和运行
当我快速编写一个小型 Objective-C 命令行程序时,请将其放入新命令中; 将输入设置为整个文档,输出为 HTML 并根据需要设置激活(我使用 [apple] + [shift] + R)。
gcc "$TM_FILEPATH" -o "$TM_DIRECTORY"tmpTextMateRunObjectiveC -l objc
"$TM_DIRECTORY"tmpTextMateRunObjectiveC
rm "$TM_DIRECTORY"tmpTextMateRunObjectiveC
This isn't specifically a general programming question but a lot of textmate users I know end up building a textmate command to do something they often do but as it's on it's own never really release it. Mines Below:
Objective-C Build and Run
For when I'm just quickly writing a small Objective-C command line program, place this in a new command; set input to entire document, output as HTML and set the activation as you want it (I use [apple] + [shift] + R).
gcc "$TM_FILEPATH" -o "$TM_DIRECTORY"tmpTextMateRunObjectiveC -l objc
"$TM_DIRECTORY"tmpTextMateRunObjectiveC
rm "$TM_DIRECTORY"tmpTextMateRunObjectiveC
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我使用的唯一真正的 TextMate 增强功能(除了语言包之外)是 ProjectPlus 插件。 它用项目面板取代了烦人的项目抽屉,添加了对 SVN、Git、Mercurial、Bazaar 和 Svk 的支持,并添加了许多其他小东西。
以下是项目页面的功能列表:
SCM 状态徽章:
将项目抽屉替换为面板
Finder 颜色标签
功能
The only real TextMate enhancement I use (other than language bundles) the ProjectPlus plug-in. It replaces the annoying project drawer with a project panel, adds support for SVN, Git, Mercurial, Bazaar and Svk, and adds lots of other small stuff.
Here's the feature list from the project page:
SCM status badges:
Swapping the project drawer for a panel
Finder colour labels
关于 Alex Payne 如何使用 TextMate 的精彩博客文章。 我强烈建议使用 GetBundles 捆绑包来管理和更新 TextMate 中的捆绑包。 非常适合浏览新捆绑包以及现有捆绑包的更新。
A nice blog post on how Alex Payne uses TextMate. I highly recommend using the GetBundles bundle, to manage, and update your bundles in TextMate. Very nice for browsing for new bundles, and updates to existing ones.
修改语法突出显示(例如,用您选择的语言教授 TextMate 新关键字)。
例如,要使 TM 在 Python 中突出显示“eval”和“compile”:
(i) 选择“Bundles”>“ '捆绑编辑器> “编辑语言”;
(ii) 从捆绑包编辑器左侧的捆绑包中选择“Python”;
(iii) 单击“Python”,以便您看到下拉选项(前面带有“L”);
(iv) 单击选项“Python”;
(v) 确保 B/E 右上角的“编辑”已切换;
(vi) 在 RHS 上,您将看到所选语言的完整语法;
(vii) 向下滚动大约 100 行,直到看到“comment =”不适合的关键字
进入其他组(尚未)。”;
(viii) 许多语言包都有此类别,并且您将进行许多更改
想要做的可能就属于这里;
(ix) 现在转到下一行(以“match”开头)并在后面添加一个竖线字符(“|”)
')\b' 之前的最后一项,然后键入 'exec',后跟另一个 '|' 然后输入
“编译”——就是这样。
现在TM会认出这两个词了,但是是什么? 即,它们是如何着色的?
在本例中,我们告诉 TM 它们是关键字,因此转到 TextMate > 首选项> 字体和 颜色,然后向下滚动,直到在“元素”字段中找到“注释”。 在那里您会看到它的颜色,但这只是您当前使用的主题的一个功能。
总之,您可以更改 TM 识别的单词(通过相关语言语法)以及 TM 通过字体和颜色为该单词着色的方式。 颜色选项卡,这又与主题相关。
现在来一些完全不同的东西:如果您厌倦了紫色,请查看替代的 GUI,它(大约需要 2 分钟或更短的时间来进行 DL 和安装): http://wiki.macromates.com/Main/AlternativeGUIs。 Jason Evers 的最后一款名为“Green Moleskine”是我用过的唯一一款。 如您所见,非常华丽,而且 DL 和安装大约需要 2 分钟。
Modify Syntax Highlighting (e.g., teach TextMate new keywords in your language of choice).
For example, to cause TM to highlight 'eval' and 'compile' in Python:
(i) select 'Bundles' > 'Bundle Editor > 'Edit Languages';
(ii) choose 'Python' from the Bundles on the LHS of the Bundle Editor;
(iii) click on 'Python' so that you see the drop-down choices (preceded by 'L');
(iv) click the choice 'Python';
(v) make sure 'Editing' is toggled in the upper right-hand-cornder of the B/E;
(vi) on the RHS, you'll see the entire grammar for the selected language;
(vii) scroll down about 100 lines, until you see, 'comment = "keywords that haven't fit
into other groups (yet).";
(viii) a number of language Bundles have this category and many of the changes you'll
want to make will likely belong here;
(ix) now go to the next line (begins w/ 'match') and add a pipe character ('|') after
the last item before the ')\b', then type 'exec', followed by another '|' then type
'compile'--that's it.
Now TM will recognize these two words, but as what? I.e., how does it color them?
In this instance, we told TM they were keywords, so go to TextMate > Preferences > Fonts & Colors, and scroll down until you find the 'Comment' in the Element field. There you'll see it's color, but that's just a function of the Theme you're using at the moment.
In sum, you can change both which words TM recognizes (via the relevant language grammar) and how TM colors that word via the Fonts & Colors tab, which again is Theme-dependent.
And Now For Something Completely Different: if you get tired of purple, check out the alternative GUIs, which (takes about 2 minutes or less to DL and install): http://wiki.macromates.com/Main/AlternativeGUIs. The last one called 'Green Moleskine' by Jason Evers is the only one i've used. Gorgeous as you can see, plus takes like 2 min to DL and install.
我制作了一堆片段/命令/宏,但它们大多是特定于语言的,并且在某种程度上是特定于 Martin 的。 不过,我所做的大部分工作是对操作系统的其余部分进行编程,使其与 TextMate 很好地配合工作,通常是通过 QuickSilver(或者有时当我无法让 QS 来完成这项工作时;QuicKeys)。
在 TextMate 中打开 Firefox 中的“查看源代码”窗口只需通过 google 搜索即可,在这篇文章 (对我而言)有一些 AppleScript 可以派上用场。 当然,您应该安装“在 TextMate 中编辑”插件,该插件可以让您在 TM 中的任何 Cocoa 应用程序中编辑任何文本字段,保存并继续使用。
不过,为了回答您的实际问题,我觉得大多数人都非常慷慨地分享他们发现可能符合公共利益的内容,而大多数情况下 TextMate 往往会成为一种非常个人化的工具,与用户一起成长。 意义; 如果我向您发送了我尚未公开共享的命令和片段,您可能不会喜欢它们。
I have a bunch of snippets/commands/macros I've made but they are mostly language specific, and to a certain degree Martin-specific. What I do a whole lot of though is to program the rest of the OS to work nicely with TextMate, usually through QuickSilver (or sometimes when I can't get QS to do the job; QuicKeys).
Opening the "View Source" window in Firefox in TextMate is just a google search away, and in this post (by me) there's a few AppleScripts that comes in handy. Of course, you should install the "Edit in TextMate" plug that'll let you edit any textfield in any Cocoa app in TM, save it and get on with it.
To answer your actual question though, I feel that for the most part people are extremely generous about sharing what they find might be of public interest, while for the most part TextMate tends to become a very personal tool that grows with its user. Meaning; If I sent you the commands and snippets I haven't already shared publically you probably wouldn't like them.
我通常发现自己只是添加自己的自定义语言片段。 我什至还没有弄清楚如何在 Textmate 中编辑语法着色或其他更复杂的东西。 我也没有发现自己需要知道如何做这些事情。
我确实使用 ProjectPlus,但主要是添加我自己的代码片段的能力是我喜欢 Textmate 的 90% 的原因。
Martin,我很想听听您使用 Quicksilver 和 Textmate 所做的一些事情,因为 Quicksilver 是我想学习“滥用和过度使用”的另一个应用程序。
I generally find myself just adding my own custom language snippets. I haven't even yet figured out how to edit the syntax coloring or other more complex things in Textmate. I haven't found myself needing to know how to do those things either.
I do use ProjectPlus though but mainly the ability to add my own snippets is 90% of what makes me love Textmate.
Martin, I'd love to hear about some of these things you do with Quicksilver and Textmate as Quicksilver is another app that I want to learn to "abuse and overuse".