Blog entries tagged “TextMate”

Friday, january 29th, 2010

“Repeat command” in TextMate revisited

As I said in a previous post (“Repeat command” in TextMate), one of the things I use a lot in jed editor, my favorite terminal editor, is the “repeat command”: pressing ESC, typing a number and then something will repeat something number times. This also works in emacs and bash.

It can also be used with other commands like delete, yank (paste) and such. I don’t do that often, but I do use this for lines of '-' or '=' quite often.

The previous solution I posted was a “snippet”. It implied typing a number, “:”, what to repeat, select that text and then hit some hotkey.

Slow, and annoying because we have to toy with the shift + arrow keys to select the text.

Here’s a new version as a “command”.

Read the whole post…
Posted at 21:14
Tags: osx · TextMate
Wednesday, november 4th, 2009

“Repeat command” in TextMate

(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