Ive been watching a few colleagues of mine using TextMate and one of them has switched off the smart typing as she finds it doesn't really help her, the reason is to do with the way she works, which admittedly is slightly inefficient, but I myself have fallen foul of this as well, here's what she does:
She types a word and then decides it needs to be a string, so she steps the caret back to the start of the word and types a quote, but 2 quotes get added so she then has to delete one of them, then she moves to the end of the word and types the closing quote, and the same thing happens. So she switches the feature off as its "annoying". Now she could make a command to wrap a selection in quotes (as I have done), but it would be nicer if it could be smarter about when to insert the pair.
Perhaps the pair of characters only get added if they are surrounded by white space, or if some customisable regex is matched?
Chris
______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
According to Chris Jenkins:
She types a word and then decides it needs to be a string, so she steps the caret back to the start of the word and types a quote, but 2 quotes get added so she then has to delete one of them, then she moves to the end of the word and types the closing quote, and the same thing happens. So she
I'm always getting bitten by this so count me in.
On Wed, 20 Oct 2004, Chris Jenkins wrote:
Perhaps the pair of characters only get added if they are surrounded by white space, or if some customisable regex is matched?
That might be nice. I also like the way, for example, iTeXMac works with smart pairs. If you select some text and type the opening paren, brace, etc, it surrounds the selected text with the pair and moves the caret past the closing element (though it doesn't do it for quotes). One of the other things it does that is usually nice is, when you have no text selected and type the opening element of a pair, it adds the closing element and positions the caret in the middle (like TM), but it also places an anchor after the closing element, so hitting tab after you re done filling in the contents of the pair takes you out of it.
William D. Neumann wdnx@unm.edu
FWO to the Nth degree!!! --- Dear Lord, please make me the kind of person my dog thinks I am.
On 20/10/2004, at 11:50 PM, William Douglas Neumann wrote:
On Wed, 20 Oct 2004, Chris Jenkins wrote:
Perhaps the pair of characters only get added if they are surrounded by white space, or if some customisable regex is matched?
That might be nice. I also like the way, for example, iTeXMac works with smart pairs. If you select some text and type the opening paren, brace, etc, it surrounds the selected text with the pair and moves the caret past the closing element (though it doesn't do it for quotes). One of the other things it does that is usually nice is, when you have no text selected and type the opening element of a pair, it adds the closing element and positions the caret in the middle (like TM), but it also places an anchor after the closing element, so hitting tab after you re done filling in the contents of the pair takes you out of it.
That all sounds really good. Part of the problem is that TM behaves differently than we expect, or are used to. Smart typing is great most of the time, but it is, of course, a pain when you don't expect or want it to work...
Anything that can help TM better guess what our intentions are gets my vote.
Justin
On 21/10/2004, at 12:41 AM, Jeroen van der Ham wrote:
You got my vote. I'm all for the only surrounded by whitespace option.
"only surrounded by white space" doesn't work -- consider something like $foo[' which smart typing should match with '] automatically, yet neither the [ or ' are surrounded by white space.
"only FOLLOWED by white space" is a bit better, but still doesn't work
"only surrounded by white space or other smart typing pairs" is a lot better
... but I think in practice, it will take a lot of thinking before a real solution is found... no quick patch here :)
Justin
Justin French wrote:
On 21/10/2004, at 12:41 AM, Jeroen van der Ham wrote:
You got my vote. I'm all for the only surrounded by whitespace option.
"only surrounded by white space" doesn't work -- consider something like $foo[' which smart typing should match with '] automatically, yet neither the [ or ' are surrounded by white space.
"only FOLLOWED by white space" is a bit better, but still doesn't work
"only surrounded by white space or other smart typing pairs" is a lot better
... but I think in practice, it will take a lot of thinking before a real solution is found... no quick patch here :)
I don't know how this fits with other people's coding styles, but mostly I want smart typing when writing new stuff, and not so much going back editing old.
For example, if I want to go back and add an extra pair of submatch brackets into a regexp, I don't want smart typing coz it gets in the way.
So how about adding in the metric of end-of-line vs middle-of-line?
Unformed idea. blah.
drew.
On 20. Oct 2004, at 18:28, Allan Odgaard wrote:
So how about adding in the metric of end-of-line vs middle-of-line?
I think “ws or eol to the right of caret” is better.
Although it doesn't fix setting the end-quotes (it does with end braces, since these wouldn't cause auto-insertion of anything).
With regards to quotes, I could look to the left to check if these weren't balanced, to see whether the quote written was an “end quote”.
Kind regards Allan
Allan Odgaard wrote:
Although it doesn't fix setting the end-quotes (it does with end braces, since these wouldn't cause auto-insertion of anything).
With regards to quotes, I could look to the left to check if these weren't balanced, to see whether the quote written was an “end quote”.
This sounds like the best idea.
Jeroen.
1) are snippets stored anywhere on the system? Looked in the Library but couldn't find anything. Was wondering if they are in XML files somewhere to be backed up or shared/
2) is there a way to use TM variables in snippets? specifically, I was hoping to insert $TM_DATE in the snippet somwhere.
thanks, K
On 20. Oct 2004, at 19:02, kumar mcmillan wrote:
- are snippets stored anywhere on the system? Looked in the Library
but couldn't find anything. Was wondering if they are in XML files somewhere to be backed up or shared/
Yes, they are in: ~/Library/Application Support/TextMate/Bundles/Custom.tmbundle/Snippets/
- is there a way to use TM variables in snippets? specifically, I
was hoping to insert $TM_DATE in the snippet somwhere.
The TM_DATE is not among the default variables.
But in a snippet you can execute normal shell commands by embedding them in back-ticks (if you're running one of the betas).
So e.g. do: »(c) `date +%Y` Your name« to get the year.
Kind regards Allan
Please remember to start a new email when posting a new topic, instead of replying to an unrelated one. It messes up threading otherwise :-(.
Justin French wrote:
... but I think in practice, it will take a lot of thinking before a real solution is found... no quick patch here :)
Thinking about this more (I spoke too soon) ...
The most important thing has to be that the smart typing is *completely* predictable. In order to not get in the way, I think it's more important for smart typing to get in the way occasionally but predictably, than for it to get in the way sometimes and pleasantly surprise the user other times.
If you know that typing '(' always gets you a ')' then you can quickly learn to delete the ')' if you don't need it. However, if you have to stop to think what's going to happen, or worse still, predict wrong and end up deleting something you didn't want to, then the feature has failed.
So I guess I'm saying it's better that the feature is simple and reliable that too clever and difficult to predict.
drew.
On 20. Oct 2004, at 11:43, Chris Jenkins wrote:
I've been watching a few colleagues of mine using TextMate and one of them has switched off the smart typing [...] She types a word and then decides it needs to be a string [...] So she switches the feature off as its "annoying".
If you can make her use the latest beta, it would be cool to hear if the problem is fixed with the new rules -- even if it's no benefit for her (i.e. she doesn't use the new "wrap selection" or the general auto-insertion), alone the fact that it no longer clashes with her style would be a nice improvement!
Of course other people are also welcome with their input! Just remember to give it at least five minutes before you deem it a success/failure! ;)
Kind regards Allan