hi there - I'll keep it simple, here's what I'm trying to do: I'm converting a text doc to a HTML doc and I decide I want to enclose a paragraph in <p> tags (or whatever). so I manually select the paragraph and use my command-ctrl-. command and everything's beautiful. but wait I say to myself - I don't like having to take my fingers off the keyboard to select the paragraph... oh I'll just use TM's 'Select Paragraph' command (via recorded macro to assign keystroke). but it turns out it doesn't work the way I want it to: 'Select Paragraph' - and also 'Select Line' - both extend their selection past the last character out to an apparently 'infinite' margin... here is an example - I have this text:
Orsay School Group Lottery FormFor K–12 school groups a limited number of free tickets are available for Monday-only viewings (9:30 a.m. to 1:30 p.m., October 4 through December 13, 2010). These tickets will be distributed as a lottery. Please read carefully the Orsay lottery guidelines below to determine if the lottery system is appropriate for your class. To apply, please complete the application below. For questions about the lottery, please e-mail kerickson@famsf.org or call 415-750-2603.
and I select the first paragraph using the 'Select Paragraph' command and then use the Cmd-Ctrl-. shortcut to enclose in <h3> this is what I get:
<h3>Orsay School Group Lottery FormFor K–12 school groups a limited number of free tickets are available for Monday-only viewings (9:30 a.m. to 1:30 p.m., October 4 through December 13, 2010). These tickets will be distributed as a lottery. Please read carefully the Orsay lottery guidelines below to determine if the lottery system is appropriate for your class. </h3>To apply, please complete the application below. For questions about the lottery, please e-mail kerickson@famsf.org or call 415-750-2603.
notice that the </h3> tag is on the next line - obviously this is undesirable and it slows down my coding way too much to have to then manually take my cursor over and insert a return after the closing tag - so much that it is obviously not worth it.
so for the sake of my being able to write readable code how do I accomplish this?
thanks. bennett
bennett von bennett asked...
notice that the </h3> tag is on the next line - obviously this is undesirable and it slows down my coding way too much to have to then manually take my cursor over and insert a return after the closing tag - so much that it is obviously not worth it.
so for the sake of my being able to write readable code how do I accomplish this?
You can just hit the tab key after you've finished entering the tag name (h3 in your example). This takes you to just after the closing tag, and a simple return in there does what you're seeking.
Cheers, Paul
well - yes, that does work - but it's not the effect I want... I like to have my closing tags on the same line etc. plus if there is an indent at the beginning of the paragraph then it ends up creating space example:
Now is the time for all good men. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean odio nibh, euismod a, lobortis in, laoreet eu, eros. Praesent lorem risus, commodo sit amet, viverra in, sagittis nec, justo.
ends up becoming:
<p> Now is the time for all good men. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean odio nibh, euismod a, lobortis in, laoreet eu, eros. Praesent lorem risus, commodo sit amet, viverra in, sagittis nec, justo. </p>
with the spaces in the beginning... and yes - I could go through and shift everything left etc but when I'm working with large text files it helps to be able to see where the paragraphs are etc etc.
also and this is even more of a pain - if I have the cursor in the closing tag and then try to 'Select Paragraph' I find that I can only select the closing tag itself - because it has enclosed a return inside the tags - at least I think that's why...
anyway - even if for just cosmetic reasons I'd still like there to be a way to select just to the first and last character of a paragraph... anyone out there handy with Ruby/PHP/Source want to make me a Command or Macro?
cheers, bennett
On Jul 21, 2010, at 7:21 PM, Paul McCann wrote:
bennett von bennett asked...
notice that the </h3> tag is on the next line - obviously this is undesirable and it slows down my coding way too much to have to then manually take my cursor over and insert a return after the closing tag - so much that it is obviously not worth it.
so for the sake of my being able to write readable code how do I accomplish this?
You can just hit the tab key after you've finished entering the tag name (h3 in your example). This takes you to just after the closing tag, and a simple return in there does what you're seeking.
Cheers, Paul
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Jul 21, 2010, at 7:32 PM, bennett von bennett wrote:
notice that the </h3> tag is on the next line - obviously this is undesirable and it slows down my coding way too much to have to then manually take my cursor over and insert a return after the closing tag - so much that it is obviously not worth it.
I understand what you’re saying, but “Select → Paragraph” was no doubt meant as a general purpose tool and not specifically for wrapping things in tags. Imagine if you were trying to delete the paragraph instead. You’d be annoyed that the newline at the end wasn’t included (or at least I would).
so for the sake of my being able to write readable code how do I accomplish this?
A couple of options:
* Use Find & Replace with a regular expression. * Use the HTML bundle’s “Wrap Each Selected line…” command (⌃⇧⌘W) instead of “Wrap Selection”. If no line is literally selected, it will just wrap the current line. * Use the Markdown bundle. (see http://daringfireball.net/projects/markdown/ if you’re not familiar)
I write almost everything in Markdown because it’s just boring, portable text, but if I do need HTML for whatever reason, it’s just a keystroke away. Your document may already be formatted to where Markdown will do what you want. If not, you can probably get it there with some small changes.