Textmate:如何输入重复的字符序列?
我经常需要像这样输入文本(由重复的字符组成):
------------------------------------
TODO
------------------------------------
在 emacs 中,我可以执行以下
C-u 60 -
操作:先按 Ctrl+U,然后按“60”,再按“-”,这样就可以轻松输入重复的字符序列。
有什么方法可以在 TextMate 中执行类似的操作吗?
I often need to enter text (consisting of repeated characters) like this:
------------------------------------
TODO
------------------------------------
In emacs, I can do a
C-u 60 -
that's a Ctrl+U followed by a "60" followed by a "-", which makes entering a repeated sequence of characters easy.
Is there any way to do something like this in TextMate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 TextMate 中,打开捆绑包编辑器并选择您想要执行此操作的语言。(如果您希望在所有语言中都具有此功能,请使用源捆绑包)单击左下角的加号,然后选择“新命令。” 为“保存”字段选择“无”,为两个输入字段选择“选定的文本或行”。 然后将其粘贴到命令字段中:
然后您可以在激活字段中选择键盘快捷键来激活它。 它的工作方式与 emacs 命令非常相似:键入所需的字符数,然后键入该字符。 然后选择它们(如果它们是该行中唯一的文本,则无需执行此步骤)并按快捷键。 我的脚本允许您指定要打印的多个字符,并以空格分隔。 因此,如果您输入
并按下快捷键,您会得到
编辑:经过思考...这是另一个版本。 这将在数字后面打印字符串。 例如
打印
以下是该版本:
In TextMate, open the Bundle Editor and select the language you'd like to do this in. (If you'd like to have this functionality in all languages, use the Source bundle) Click the plus symbol at the bottom left, and choose "New Command." Chose "Nothing" for the Save field and "Selected Text or Line" for the two input fields. Then paste this into the Commands field:
You can then choose a keyboard shortcut to activate this with in the Activation field. The way it works is very similar to that emacs command: type the number of characters you want followed by the character. Then select both of them (this step is unnecessary if they're the only text on the line) and press the shortcut key. My script allows you to specify multiple characters to print, delimited by spaces. So if you typed
and hit the shortcut key, you'd get
Edit: After thinking about it...here's another version. This one will print the string after the number. So for example
prints
Here's that version:
对于您给出的具体示例,您可以键入 Ctrl-Shift-B、“TODO”来创建文本横幅。
For the specific example you've given, you can type Ctrl-Shift-B, "TODO" to create a text banner.