Wednesday, november 4th, 2009

“Repeat command” in TextMate

Warning: this entry is old. It may contain outdated information and may not reflect my opinion anymore.

(Note: this post is superseded by “Repeat command” in TextMate revisited)

The text editor I used the most in the past ten years is definitely jed. I still use it a lot, both local and over ssh, but I now mostly use TextMate when programming.

I love it for the most part. The feature I miss the most from emacs and jed are split views. Can't do much about this however.

The second feature I miss the most is the “repeat command” (press ESC or Control-U, a number, and something, to repeat “something” “number” times).

As I said on stackoverflow, it's actually quite easy to do.

First, open the Bundle Editor, then create a “New Snippet”, preferably in a personnal bundle (I put personnal things in “_Serge”). In the new snippet, add this:

1
2
`python -c "print ':'.join('$TM_SELECTED_TEXT'.split(':')[:-1]) * \
 int('$TM_SELECTED_TEXT'.split(':')[-1])"`

To use, simply type the text to repeat, “:”, then a number, select the text, and run the snippet.

Here are some examples:

Text Result
*:10 **********
::10 ::::::::::
\':10 ''''''''''
-*-:10 -*--*--*--*--*--*--*--*--*--*-
Posted at 22:22
 
Anglais seulement
Tags: osx · TextMate

Comments

Comment RSS

There are no comments for this entry.

Drop a comment






Comments are formatted using Markdown. Basic syntax on Wikipedia.