[TxMt] oniguruma is your friend!!!!

Allan Odgaard allan at macromates.com
Tue Sep 27 03:14:01 UTC 2005

On 26/09/2005, at 7.43, thomas Aylott wrote:

> [...] I have attached the Macros [...]

Would have made it easier for us if they were in a tmbundle :)

> [...] I wanted to implement using the tab key to tab to the next  
> occurrence [...]
> 1: We need to have dynamic scopes.
> Taking over the tab key equivalent takes it away from snippets too.

Ah yes, I see. While they aren't around the corner (dynamic scopes) I  
think the case for them is strong.

I also have a slightly related problem: when first going to a  
placeholder, the entire thing is selected, here I don't want the  
smart-typing pairs to “wrap selection” when used, since it's unlikely  
that I want to wrap the default placeholder text, more likely I want  
to start a string or similar -- though it is less transparent to me  
exactly how scoping the smart typing (keys) should solve this (after  
the introduction of dynamic scopes), but it would be nice if they  
could somehow do it :)

> 2: Selections carry the scope of the last character selected. [...]
> I'm not sure if this one is really the wrong behavior or what. It  
> seems logical to pick up the scope of the last character selected.  
> I can't really think of any other way of handling that.

I've had some “concerns” about this myself. I think in most  
situations when the entire scope of something is selected, the  
current scope should really not include what's exclusive for the  
selected text, since with a selection, we perform an operation _on_  
the selection, and that is done in the context of being “outside” it.

For example if we select <?php … ?> in HTML and use Toggle Comment,  
we want it to be commented as HTML, not PHP.

I am however also unsure how to “solve” it. One heuristic could be to  
look at the scope before and after the selection, and if these are  
identical, use that. So when we select something entirely, the scope  
excludes what's special for the stuff we selected. But if OTOH we  
select a partial string (or similar), the scope will include string.

More information about the textmate mailing list