Reputation: 20637
I am not 100% sure if this is the right place to be posting this question, but I could not think of anywhere else.
I having been using textmate for around 6 months to write Ruby on Rails applications.
The snippets and stuff are nice. I am wondering if it is possible to edit to words at the same time. I am using the mcol
snippet which generates a add_column
and remove_column
in a database migration.
When the code is generated it highlights the table_name
and changes both occurences of the word table_name
when you start typing.
Hoping that this can be done to any word that you select.
Cheers
Eef
Upvotes: 0
Views: 150
Reputation: 17871
Since the whole idea of TextMate is to have an editable editor(!), if you look at the HTML bundle, the shortcut ctrl-shift-w invokes this:
<${1:p}>$TM_SELECTED_TEXT</${1/\s.*//}>
So, to add a custom shortcut to wrap a selection in a pair of editable text strings (which is what you want, I think?), go to Bundles > Show Bundle Editor
then choose New Snippet
from the add +
button (bottom left) and use (e.g.):
${1:editme}$TM_SELECTED_TEXT${1/\s.*//}
where 'editme' is the default 'doubly-editable' value. If you add a new snippet shortcut in the 'Key Equivalent' field (I used ctrl-shift-alt-W) you can then wrap any selection in an editable pair of words. Depending on what you need, the same syntax might be expanded to match your requirements?
Note: once the shortcut is allocated, you can't edit a snippet in place - you need to start again (I think - couldn't find a way around that).
Upvotes: 1