Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing <li><a><span> and with a keystroke or two get </span></a></li>.
Also, I can't seem to find anything related to automatically wrapping text in html tags. E.g. selecting a few blocks of text and automatically wrapping them in <p> tags. BBedit has its nice HTML bar where you can do this kind of thing in a few clicks, but i've always found it a bit clunky
Thanks for any input.
On Wed, 19 Jul 2006, Eric D. Fields wrote:
Also, I can't seem to find anything related to automatically wrapping text in html tags. E.g. selecting a few blocks of text and automatically wrapping them in <p> tags. BBedit has its nice HTML bar where you can do this kind of thing in a few clicks, but i've always found it a bit clunky
Doesn't Ctrl-Shift-W do that in the HTML bundle?
William D. Neumann
---
"There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Life is unfair. Kill yourself or get over it. -- Black Box Recorder
On Jul 19, 2006, at 10:45 AM, Eric D. Fields wrote:
Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing
<li><a><span> and with a keystroke or two get </span></a></li>.
The TextMate way to handle this is to close them as you open them using control-<. Hope that helps.
James Edward Gray II
On Jul 19, 2006, at 10:45 AM, Eric D. Fields wrote:
Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing
<li><a><span> and with a keystroke or two get </span></a></li>.
I'll let someone else tackle that one. I've never found it to be a problem, since I generate all my tags via ctrl+< , hence they are always paired to begin with.
Also, I can't seem to find anything related to automatically wrapping text in html tags. E.g. selecting a few blocks of text and automatically wrapping them in <p> tags. BBedit has its nice HTML bar where you can do this kind of thing in a few clicks, but i've always found it a bit clunky
What about the "wrap selection in tag" command? (ctrl+shift+W) or the "wrap each selected line..."? If you want a more specialized behavior, you'll probably have to write your own command.
Thanks for any input.
-- eric
Haris
On Jul 19, 2006, at 8:51 AM, Charilaos Skiadas wrote:
On Jul 19, 2006, at 10:45 AM, Eric D. Fields wrote:
Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing
<li><a><span> and with a keystroke or two get </span></a></li>.
I'll let someone else tackle that one. I've never found it to be a problem, since I generate all my tags via ctrl+< , hence they are always paired to begin with.
i am trying to figure out how this can be efficient, maybe i am doing something wrong.
to get <span class="junk"><a href="bogus.html">blah blah</a></span>
i type span[ctrl+<] which gives me <span>[cursor</span> so i have to press [left-arrow] class="junk"[right-arrow] and likewise for a[ctrl+<][left-arrow] href="bogus.html"[right-arrow] blah blah
am i missing some other way to use this shortcut? all the cursor movement seems superfluous and counter-productive for any tags that have attributes.
--- michael reece :: software engineer :: mreece@vinq.com
On Jul 19, 2006, at 12:16 PM, Michael Reece wrote:
On Jul 19, 2006, at 8:51 AM, Charilaos Skiadas wrote:
On Jul 19, 2006, at 10:45 AM, Eric D. Fields wrote:
Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing
<li><a><span> and with a keystroke or two get </span></a></li>.
I'll let someone else tackle that one. I've never found it to be a problem, since I generate all my tags via ctrl+< , hence they are always paired to begin with.
i am trying to figure out how this can be efficient, maybe i am doing something wrong.
to get <span class="junk"><a href="bogus.html">blah blah</a></span>
i type span[ctrl+<] which gives me <span>[cursor</span> so i have to press [left-arrow] class="junk"[right-arrow] and likewise for a[ctrl+<][left-arrow] href="bogus.html"[right- arrow]blah blah
am i missing some other way to use this shortcut?
Yep. Push control-< before you type a word. ;)
Both modes are handy in different situations. Worth getting the hang of.
James Edward Gray II
On Jul 19, 2006, at 12:21 PM, James Edward Gray II wrote:
Yep. Push control-< before you type a word. ;)
Both modes are handy in different situations. Worth getting the hang of.
I further suggest studying the command that does this trick. Here is the code for it, with comments removed:
#!/usr/bin/env ruby single_no_arg = /^(?:br|hr)$/i single = /^(?:img|meta|link|input|base|area|col|frame|param)$/i print case tag = STDIN.read when single_no_arg then "<#{tag} />" when single then "<#{tag} $1/>" when '' then "<${1:p}>$2</${1/\s.*//}>" else "<#{tag}>$1</#{tag.strip[/^\S+/]}>" end
It is set to output "Insert as snippet". This means that the various strings to be printed that we see above should be interpreted as snippets. The one relevant for us here is: "<${1:p}>$2</${1/\s.*//}>"
when that snippet is in action, anything you type in the <${1:p}> part gets copied at the closing snippet as well, except that everything from the first space and no is substituted by nothing (that's what the ${1/\s.*//} does, see http://macromates.com/ textmate/manual/snippets#transformations ).
So you would do ctrl+<, followed by typing 'span' , then space, and then the class stuff. On the closing tag only the 'span' part will appear. When you are ready to type the things in the tag, press tab.
And of course, you could write your own span snippet that does some more specialized behavior. The bundle already has a bunch of example snippets.
James Edward Gray II
Haris
Just shift+control+w, type span [space] class="" etc ... The wrap selection also works on it's own and will insert an empty p- tag that you can easily change into whatever. Ok, this explanation sucks, but try it out yourself and you'll see that all you ever need is shift+control+w. At least that works excellent for me ad I'm a heavy html-typist :)
Andreas
On 19/07/06, Eric D. Fields eric_fields@emerson.edu wrote:
Hi. I adore texmate to death but I'm trying to get more automation out of it. I know that there's a keyboard shortcut to close the last previously opened tag, but is it possible get TM to close all the tags on the current line you're working on? So i can be writing
<li><a><span> and with a keystroke or two get </span></a></li>.
Well, you say a "keystroke or two". With three, you can hit command-option-. three times, and it will close each one in succession. It's just a quick ripple - hold the modifiers, tap period once for each tag you want to close.
Given I don't have more than 3/4 tags I want to close at once like that, I think that's a perfectly acceptable situation.
If you've got long, repetetive lines, the other solutions suggested might work; alternatively, consider building the tags first with some form of column typing, and then later add the content.
On 19/7/2006, at 17:45, Eric D. Fields wrote:
[...] is it possible get TM to close all the tags on the current line you're working on?
The Insert Close Tag is a small Ruby script in the HTML bundle. It takes as input the entire document, parses that, and inserts (as a snippet) the missing close tag.
With a few modifications this script could be made to work only for the current line instead.
As for <span class="something"> one can also use ⌃< with a selection (to use the selection as the tag, where it will strip arguments when mirroring — however, I would make a dedicated snippet for this, if I used it a lot (we do have one for div.)
I think i'm set for now. I've learned quite a bit from this thread. Thanks all.
On 7/20/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 19/7/2006, at 17:45, Eric D. Fields wrote:
[...] is it possible get TM to close all the tags on the current line you're working on?
The Insert Close Tag is a small Ruby script in the HTML bundle. It takes as input the entire document, parses that, and inserts (as a snippet) the missing close tag.
With a few modifications this script could be made to work only for the current line instead.
As for <span class="something"> one can also use ⌃< with a selection (to use the selection as the tag, where it will strip arguments when mirroring — however, I would make a dedicated snippet for this, if I used it a lot (we do have one for div.)
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