如何在 TextMate 中多次执行某个操作(Emacs 和 Vim 都可以轻松完成!)?
Emacs: C-U (79) #
» a pretty 79 character length divider
VIM: 79-i-#
» see above
Textmate: ????
Or is it just assumed that we'll make a Ruby call or have a snippet somewhere?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
受到其他答案的启发。 使用以下内容创建一个片段:
并可选择为其分配一个键序列,例如 CTRL-SHIFT-R
如果您键入
-x:4
,选择它,然后调用该片段(例如通过它的快捷方式) ),你会得到“-xxxx”。您还可以使用
::4
来获取“::::”。您重复的字符串用单引号括起来,因此要重复 ',您必须使用 \'。
Inspired by the other answers. Make a snippet with the following:
and optionally assign a key sequence to it, e.g. CTRL-SHIFT-R
If you type
-x:4
, select it, and call the snippet (by it's shortcut for example), you'll get "-x-x-x-x".You can also use
::4
to obtain "::::".The string you repeat is enclosed in single quotes, so to repeat ', you have to use \'.
通过更进一步
,您可以复制您在问题中给出的示例。
只需制作一个片段,称为分隔符或其他内容,将
tab 触发器
字段设置为适当的'--'
例如,然后输入类似以下内容:然后当您键入
--⇥
(破折号破折号选项卡),您应该获得正确宽度的分隔线。确实,您已经失去了一些从 vim 获得的简洁性,但是这更容易重用,而且您只需输入一次。 您也可以使用您喜欢的任何语言。
By taking the
a step further, you can duplicate the examples you gave in the question.
Just make a snippet, called divider or something, set the
tab trigger
field to something appropriate'--'
for example, then enter something like:Then when you type
--⇥
(dash dash tab), you should get a divider of the correct width.True, you've lost some of the terseness that you get from vim, but this is far easier to reuse, and you only have to type it once. You can also use whatever language you like.
我将创建一个捆绑命令来执行此操作。
您可以将编辑器选择作为脚本的输入,然后将其替换为执行结果。 例如,此命令将采用选定的数字并打印字符“#”该次数。
当然,这个示例不允许您指定字符,但它让您了解可能发生的情况。
I would create a bundle command to do this.
You can take editor selection as input to your script, then replace it with the result of execution. This command, for example, will take a selected number and print the character '#' that number of times.
Of course this example doesn't allow you to specify the character, but it gives you an idea of what's possible.