This, I am sure, is super newbie basic material, but somehow it eludes me with tenacity...
What's the shortcut to select text within tags in html? Let's say, for instance, to select "I am a paragraph" in:
<p>I am a paragraph</p>
I'm ashamed to ask that, so go easy on me, thanks ;)
Actually, I think this is a very GOOD question. It is something I often want to do when I'm trying to figure out somebody else's HTML code.
There is the Edit > Select > Enclosing Brackets command, but the command I want might be called "Select enclosing TAG."
For example, if you set the insertion point in a line of text that is enclosed by paragraph tags, and execute this command, all the text from "<p>" to "</p>" would be selected. Conceptually, you work backwards from the insertion point until you find a tag, then work forward from there until you find the matching closing tag, then select the entire range.
If the starting point was a selection, the same thing happens except that the starting point for "search backwards for a tag" would be the beginning of the selection, and the "...then work forward from there" point would be the end of the current selection.
With this functionality, you could set the insertion point inside a big mess of HTML code and, by repeatedly issuing the command, work your way outward.
eo
On Feb 2, 2006, at 5:27 PM, minimal.design wrote:
This, I am sure, is super newbie basic material, but somehow it eludes me with tenacity...
What's the shortcut to select text within tags in html? Let's say, for instance, to select "I am a paragraph" in:
<p>I am a paragraph</p>
I'm ashamed to ask that, so go easy on me, thanks ;)
JetBrains' IDEA has a superior and simple solution to this problem: expanding areas selection. This is one of the features I miss the most in Textmate.
"expanding areas selection:" "Ctrl+W (select word) in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc."
, and "Shift-Ctrl+W" is the reverse action.
And if you use CamelHumps, Ctrl-W will play it smart by stopping on Humps.
Alain
I've written a couple of pretty handy macros that do something pretty handy, although not precisely what you guys are talking about.
Check out the ScreenCast! http://subtlegradient.com/articles/2006/02/05/my_textmate_bundles_etc
You place your caret inside something and the macro will select everything in between enclosing characters. It's kinda like the balance command, except it grabs everything INSIDE the characters, but not the characters themselves.
it works with:
[], {}, (), '', "", word="", <>, ><, $word, @word, /* word */, <% word %>, <%= word %>, <%# word %>, <%@ word %>, integers, and probably more, but I forget now.
How it applies to this conversation. If you want to select the "paragraph text" section of the following HTML, place your caret somewhere in the text and hit the macro. It'll select everything between the > & < characters.
<p class="blah"> paragraph text </p>
It's hip, you'll hate it!
On Feb 5, 2006, at 4:39 AM, Alain Ravet wrote:
JetBrains' IDEA has a superior and simple solution to this problem: expanding areas selection. This is one of the features I miss the most in Textmate.
"expanding areas selection:" "Ctrl+W (select word) in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc."
, and "Shift-Ctrl+W" is the reverse action.
And if you use CamelHumps, Ctrl-W will play it smart by stopping on Humps.
Alain