I hope this is not a very stupid question, but can someone explain to me how input patterns are supposed to work? i.e. if i have bound a snippet to an input pattern, how do I activate it? (An example of an input pattern would be much appreciated). Or are they not implemented yet?
Haris
On 04-04-2005, at 06:20, Charilaos Skiadas wrote:
I hope this is not a very stupid question, but can someone explain to me how input patterns are supposed to work? i.e. if i have bound a snippet to an input pattern, how do I activate it? (An example of an input pattern would be much appreciated). Or are they not implemented yet?
Certainly! .. you just type the pattern in the editor window as normal text, and press TAB. So it works as a short-cut really. There are plenty of snippets already in place in the various bundles :-).
On Apr 4, 2005, at 7:15 AM, Sune Foldager wrote:
On 04-04-2005, at 06:20, Charilaos Skiadas wrote:
I hope this is not a very stupid question, but can someone explain to me how input patterns are supposed to work? i.e. if i have bound a snippet to an input pattern, how do I activate it? (An example of an input pattern would be much appreciated). Or are they not implemented yet?
Certainly! .. you just type the pattern in the editor window as normal text, and press TAB. So it works as a short-cut really. There are plenty of snippets already in place in the various bundles :-).
The question is about input patterns, not tab triggers. Here's what I can find on the subject:
From: Allan Odgaard <allan at macromates.com>
Input pattern is not working yet. What it will be is a non-greedy regular expression matched against the typed input. Mainly useful for having macros executed on certain editing patterns. For example the
XML
bundle has a snippet that expands to: “<$1></$1>”. Here one could
match
“expansion of this snippet”, “giving the tag a name”, “pressing return inside the tag (w/o typing anything)”. The macro would then add indent and move the end tag down an extra line.
The question is about input patterns, not tab triggers. Here's what I can find on the subject:
So .. does it sound like I could set up a snippet/something to act like it fires on a 'space' (instead of a tab-trigger)
For instance ... let's say for example I'd like to have the sequence 'br ' expand into <br /> ... now I just have a snippet set to 'br' and to expand from a tab trigger ... so instead of the tab triggering it, w/ the input sequence, the space will trigger it ...
Is that how it'd work? Just curious ... that would be just devine ...
-steve
On Apr 4, 2005, at 20:06, Steve Lianoglou wrote:
The question is about input patterns, not tab triggers. Here's what I can find on the subject:
So .. does it sound like I could set up a snippet/something to act like it fires on a 'space' (instead of a tab-trigger)
Yes -- basically you'd be able to get items to 'fire' on whatever typing sequence that can be matched by a non-greedy regular expression, which typing “br ” sure can :)
I say non-greedy because a pattern like “a.*b’ should match “abbb”, but the item will fire already when it sees “ab”, since making a greedy match would require look-ahead.
Going slightly off topic here:
On 04-04-2005 20:06, Steve Lianoglou wrote:
For instance ... let's say for example I'd like to have the sequence 'br ' expand into <br /> ... now I just have a snippet set to 'br' and to expand from a tab trigger ... so instead of the tab triggering it, w/ the input sequence, the space will trigger it ...
Why would you want to setup a snippet for <br /> ? If you're using too many br-tags in your HTML document, you're not doing it right...
Jeroen.
On Apr 4, 2005, at 11:56 PM, Jeroen van der Ham wrote:
Why would you want to setup a snippet for <br /> ? If you're using too many br-tags in your HTML document, you're not doing it right...
Thanks for the lesson in semantic web development, Jeroen .. but it was just meant to be a trivial example to get the question across.
I'd like 'fr ' to expand into my for-loop snippet, as opposed to hitting the tab to trigger the expansion ... I just find it to be easier on my fingers to hit the space bar w/ my fat thumb ... for some reason I always find hitting the tab key a bit awkward ... my hand moves out of position and my pinky/wrists start to complain after a while is all ...
now that you mention it, though .. I should go and make a quick/easy snippet for html margin adjustments:
<img src="/images/clear.gif" width="${1:width}" height="{2:height}" alt="Make some Room" />$3
;-)
-steve
On 05-04-2005 09:22, Steve Lianoglou wrote:
On Apr 4, 2005, at 11:56 PM, Jeroen van der Ham wrote:
Why would you want to setup a snippet for <br /> ? If you're using too many br-tags in your HTML document, you're not doing it right...
Thanks for the lesson in semantic web development, Jeroen .. but it was just meant to be a trivial example to get the question across.
Sorry, just couldn't resist and there are still so many people out there doing it wrong...
I'd like 'fr ' to expand into my for-loop snippet, as opposed to hitting the tab to trigger the expansion ... I just find it to be easier on my fingers to hit the space bar w/ my fat thumb ... for some reason I always find hitting the tab key a bit awkward ... my hand moves out of position and my pinky/wrists start to complain after a while is all ...
However, if you would have space as expansion trigger, then you will have trouble typing just 'fr'. Eclipse uses ⌘-Space for it, might be a nice alternative.
I believe there is a file in TextMate containing keybindings, but I forgot where it was.
<img src="/images/clear.gif" width="${1:width}" height="{2:height}" alt="Make some Room" />$3
Aaargh! Use XHTML and CSS !
<div class="makeSpace"/>
css: .makeSpace { width=x; height=y; }
;-)
Jeroen.
On 05-04-2005, at 10:23, Jeroen van der Ham wrote:
On 05-04-2005 09:22, Steve Lianoglou wrote:
<img src="/images/clear.gif" width="${1:width}" height="{2:height}" alt="Make some Room" />$3
Aaargh! Use XHTML and CSS !
<div class="makeSpace"/> css: .makeSpace { width=x; height=y; } ;-)
I have to agree.. this clear-image stuff is horrible... but of course.. it does work, on the other hand :-p. But I think using a div box works even on IE's rather sorry excuse for a box-model implementation (trouble only starts when you add borders, padding or margin). .. .. .. I really hate IE... ;-).
At 2:27 PM +0200 4/5/05, Sune Foldager wrote:
I have to agree.. this clear-image stuff is horrible... but of course.. it does work, on the other hand :-p. But I think using a div box works even on IE's rather sorry excuse for a box-model implementation (trouble only starts when you add borders, padding or margin). .. .. .. I really hate IE... ;-).
I spent many hours trying to make a (not that complex) CSS page layout look right in IE and other better browsers. I never succeeded and had to use tables.
So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
- Eric
On 05-04-2005, at 17:07, Eric Hsu wrote:
I spent many hours trying to make a (not that complex) CSS page layout look right in IE and other better browsers. I never succeeded and had to use tables. So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
Mm... It can be done though, but it took me many hours as well. It should be noted that while Safari is one of the best css browsers there is, it also has at least one small bug pertaining to some rather exotic use of floating boxes. IE is much worse. Its notorious bug is: It counts padding and border when calculating 'width' for an element. But the standard _clearly_ states that width is inner width.
In IE6 this is fixed if you set a doctype to strict (either html or xhtml), so that at least helps.
Is this IE / Mac we're talking about? If IE / win has a buggy css implementation, they need to invent a new word for the mac version.
-----Original Message----- From: Eric Hsu [mailto:erichsu@math.sfsu.edu] Sent: Wednesday, 6 April 2005 1:07 AM To: TM Users Subject: Re: [TxMt] Input Patterns?
At 2:27 PM +0200 4/5/05, Sune Foldager wrote:
I have to agree.. this clear-image stuff is horrible... but of course.. it does work, on the other hand :-p. But I think using a div box works even on IE's rather sorry excuse for a box-model implementation (trouble only starts when you add borders, padding or margin). .. .. .. I really hate IE... ;-).
I spent many hours trying to make a (not that complex) CSS page layout look right in IE and other better browsers. I never succeeded and had to use tables.
So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
- Eric -- Eric Hsu, Assistant Professor of Mathematics San Francisco State University erichsu@math.sfsu.edu http://math.sfsu.edu/hsu ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
At 10:46 AM +0200 4/6/05, Sune Foldager wrote:
On 06-04-2005, at 03:25, David Lee wrote:
Is this IE / Mac we're talking about? If IE / win has a buggy css implementation, they need to invent a new word for the mac version.
At least I was talking about the Windows version, yes.
I was talking about both IE/Mac and IE/Win. When IE/Mac 5 first came out, it was the best browser on the planet. Sad how it's fallen.
Anyway, the original point was a positive one: that when you write for TM HTML output, you only have to worry about the quirks of embedded Webkit and not all the IEs, etc.
- Eric
Hi Eric, What you said seemed interesting the second time around, so i set up a command to pass the selection through 'cat' to html out. If i didn't use cat i got the document name , etc at the top of the window.
Is there a built-in for this? I couldn't find one, and the way you phrased it makes me think I'm missing something
thanks D
On 06/04/2005, at 1:07 AM, Eric Hsu wrote:
At 2:27 PM +0200 4/5/05, Sune Foldager wrote:
I have to agree.. this clear-image stuff is horrible... but of course.. it does work, on the other hand :-p. But I think using a div box works even on IE's rather sorry excuse for a box-model implementation (trouble only starts when you add borders, padding or margin). .. .. .. I really hate IE... ;-).
I spent many hours trying to make a (not that complex) CSS page layout look right in IE and other better browsers. I never succeeded and had to use tables.
So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
- Eric
-- Eric Hsu, Assistant Professor of Mathematics San Francisco State University erichsu@math.sfsu.edu http://math.sfsu.edu/hsu ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
At 7:21 PM +1000 4/7/05, David Lee wrote:
What you said seemed interesting the second time around, so i set up a command to pass the selection through 'cat' to html out. If i didn't use cat i got the document name , etc at the top of the window.
I assume you are talking about your Ruby script to output parsed regexp matches?
Is there a built-in for this? I couldn't find one, and the way you phrased it makes me think I'm missing something
What is it you are hoping will happen, and what is happening? I can't tell from your description.
best, Eric
ah! confusion! help!
So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
I think (?) you were saying you use TM instead of a browser to check your HTML code. I set up the following Command because i couldn't find one 'built-in', in an attempt to mimic your workflow: ---------------------------- save: nothing command: cat input: entire document (or selected text, according to taste) output: show as html activation: ctrl-alt-cmd + r --------------------------
this pops the selection up in a window within TM, rendered as HTML. It works fine.
My question is whether this was a built-in command i missed in the menus, or your own invention ...
cheers D
On 08/04/2005, at 1:03 AM, Eric Hsu wrote:
At 7:21 PM +1000 4/7/05, David Lee wrote:
What you said seemed interesting the second time around, so i set up a command to pass the selection through 'cat' to html out. If i didn't use cat i got the document name , etc at the top of the window.
I assume you are talking about your Ruby script to output parsed regexp matches?
Is there a built-in for this? I couldn't find one, and the way you phrased it makes me think I'm missing something
What is it you are hoping will happen, and what is happening? I can't tell from your description.
best, Eric
Eric Hsu, Assistant Professor of Mathematics San Francisco State University erichsu@math.sfsu.edu http://math.sfsu.edu/hsu ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Apr 7, 2005, at 11:24 AM, David Lee wrote:
this pops the selection up in a window within TM, rendered as HTML. It works fine.
My question is whether this was a built-in command i missed in the menus, or your own invention ...
Window -> Show Web Preview?
I'm going to spend the weekend honing my menu-perusing skills. Seems theyve gotten rusty of late ...
thanks
case closed
D
On 08/04/2005, at 1:41 AM, Jonathan Chaffer wrote:
On Apr 7, 2005, at 11:24 AM, David Lee wrote:
this pops the selection up in a window within TM, rendered as HTML. It works fine.
My question is whether this was a built-in command i missed in the menus, or your own invention ...
Window -> Show Web Preview?
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
At 1:24 AM +1000 4/8/05, David Lee wrote:
So in a weird way, it has been very freeing to target TM's HTML output! Yes, it has its own set of annoyances, but at least I don't have to check if it looks right in IE or Opera...
I think (?) you were saying you use TM instead of a browser to check your HTML code. I set up the following Command because i couldn't find one 'built-in', in an attempt to mimic your workflow:
save: nothing command: cat input: entire document (or selected text, according to taste) output: show as html activation: ctrl-alt-cmd + r
this pops the selection up in a window within TM, rendered as HTML. It works fine.
My question is whether this was a built-in command i missed in the menus, or your own invention ...
Ah, let me (1) answer your question first and then (2) clarify my workflow.
1. Window/Show Web Preview will make you happy. Indeed, TM has a zillion nifty features of which I know about 25%. Like that recent ctrl-space thing was real news to me.
2. I do use TM to preview my HTML as I write, but I use a command to HTML Tidy before actually firing it off. I just checked those commands into the svn HTML bundle. Notice that the Tidy command dumps errors into its output, so you should use the Tidy Error Display command first. Also, it assumes the tidy binary exists and lives at ~/bin/tidy. You can change that to suit yourself.
But my point about targeting TM's HTML output was in the narrow context of writing TM command output. In the actual outside world of HTML, I unfortunately preview on the obnoxious array of rendering engines even after I validate (IE 5,6,7, I'm looking at you!).
- Eric
At 8:50 AM -0700 4/7/05, Eric Hsu wrote:
Also, it assumes the tidy binary exists and lives at ~/bin/tidy. You can change that to suit yourself.
Mats pointed out offline that people might not know where to get HTML Tidy. http://tidy.sourceforge.net has an OS X binary under Executable Binaries.
HTML Tidy is awesome. My only gripe with it (and validation in general) is that it's not always obvious how to make your text validate and still look right.
best, Eric
However, if you would have space as expansion trigger, then you will have trouble typing just 'fr'. Eclipse uses ⌘-Space for it, might be a nice alternative.
I believe there is a file in TextMate containing keybindings, but I forgot where it was.
Yeah ... I know it be might tricky at times to trigger things on a space, but some things you just don't type that often .. like 'fr ', or 'swt ' (for a switch statement) .. or 'fnc ' .. for a function-snippet trigger (well, at least not in English anyway ... sometimes it does catch me but I've been able to work around it with a little dance about the arrow keys and some carefully placed spaces here and there -- really infrequent, tho)
But your suggestion is interesting ... are you saying I should bind the ctrl-space 'chord' to the tab key so I can use the already-in-there TextMate Tab-expansion triggers?
That might be a good workaround for me for the time being ... I remember coming accross something about a KeyBinding file that I can mess around w/ ... I think someone said it was in ~/Library/KeyBindings ... though I don't have one there ... I could make one, but I wouldn't know what to put in there ... hmm .. maybe google can help on that one.
But if anyone would like to cater to the lazy man and has any insight, it would be much appreciated.
<img src="/images/clear.gif" width="${1:width}" height="{2:height}" alt="Make some Room" />$3
Aaargh! Use XHTML and CSS !
<div class="makeSpace"/>
css: .makeSpace { width=x; height=y; }
... riiiiiight .. next thing you're going to tell me is that I don't need to wrap something in a table just to put a border around it ...
-steve
On Apr 6, 2005, at 0:22, Steve Lianoglou wrote:
[ space to expand snippets ]
Yeah ... I know it be might tricky at times to trigger things on a space, but some things you just don't type that often .. like 'fr ', or 'swt ' (for a switch statement) .. or 'fnc ' .. for a function-snippet trigger (well, at least not in English anyway ... sometimes it does catch me but I've been able to work around it with a little dance about the arrow keys and some carefully placed spaces here and there -- really infrequent, tho)
Also, the scope might be able to help here, since you can limit the scope of where the item will fire.
But your suggestion is interesting ... are you saying I should bind the ctrl-space 'chord' to the tab key so I can use the already-in-there TextMate Tab-expansion triggers?
Not being the OP, but I think that was the idea.
That might be a good workaround for me for the time being ... I remember coming accross something about a KeyBinding file that I can mess around w/ ... I think someone said it was in ~/Library/KeyBindings ... though I don't have one there ... I could make one, but I wouldn't know what to put in there ... hmm .. maybe google can help on that one.
Or maybe Help / Key Bindings! :)
But if anyone would like to cater to the lazy man and has any insight, it would be much appreciated.
If you're lazy just do: cmd-option-M (start macro recording) tab (inserts a tab/expands snippet) cmd-option-M (stop macro recording) cmd-ctrl-M (save scratch macro)
Now set the key equivalent of that macro to option-space or whatever you like.