[TxMt] Re: Help with simple text conversion command

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Nov 19 18:43:49 UTC 2008


On 19.11.2008, at 19:25, Michael Reiner wrote:

> Can anyone help with a command that would convert the case of selected
> text as well as replaced spaces with underscores?
>
> So, for instance:
>
> This is a Title  ->  this_is_a_title
>
> As a complete beginner in TextMate, I'm not sure how to create a
> command to do this.

There're many ways. Maybe the simplest - record a macro:

- type 'This is a Title' and select it

- Bundles > Macro > Start Recording

- Text > Convert > to Lowercase

- Edit > Find > Find [APPLE+F]

– Find: ' ' (a space)
   Replace: '_'

   Hold down OPTION key and execute 'In Selection'

- Bundles > Macro > Stop Recording

- Bundles > Macro > Save Last Recording

That's it. You can maybe assign a shortcut to the macro of course.



--Hans





More information about the textmate mailing list