views:

130

answers:

1

Please note that I did ask this on Super User and received absolutely no responses, so I decided to port this to a programming community that knows a lot more about TextMate.


Working in Ruby on Rails in TextMate, when I select a chunk of text, let's say

My text

and then hit the open bracket [ key on my keyboard, TextMate wraps the selected block in opening and closing brackets, as such:

[My text]

I'd like to modify this behavior so it wraps it in an opening bracket, space, space, closing bracket, as such:

[ My text ]

(mind the spaces).

How would I go about modifying this behavior?

I don't mind modifying it only while working for Ruby on Rails (i.e. .rb, .html.erb file scope etc...) but I'd prefer it if it would take effect throughout the application.

Thank you!

+1  A: 

Well i hope this is better than no answer. THe behaviour is controlled by a bundle. So you edit the respective bundle to get the behaviour you require.

Here is a quote "Some of the default items may not be to your exact liking, for example the coding style in snippets may differ from yours, so you may want other tab triggers, key equivalents, or similar modifications. If you edit a default item the difference will be stored in ~/Library/Application Support/TextMate/Bundles. These are then merged with the default version so your changes will be effective even after upgrading TextMate. All new items you create also end up in this location. Bundles or bundle items which you install by dragging them to TextMate or double clicking will be installed in ~/Library/Application Support/TextMate/Pristine Copy/Bundles. Editing these will also result in only the differences being stored in ~/Library/Application Support/TextMate/Bundles, meaning that if you later get a new version of this third party bundle, you can safely install this one on top of the old one (by dragging it to TextMate) and again your changes will be preserved. If you want to discard local changes then currently the only option is to delete these from ~/Library/Application Support/TextMate/Bundles."

Fo more pointers go here. Hope this helps.

PurplePilot