Is there a key combination for selecting a line (or lines) of code in a tag but omitting leading and trailing spaces and tabs? I'm familiar with the Shift-Cmd-L shortcut, but it leaves in the whitespace. This makes a mess of indented HTML when I'm using the Ctrl-Shift-W and Ctrl-Shift-Cmd-W HTML shortcuts.
In other words, if I apply the combination Shift-Cmd-L followed by Ctrl-Shift-W to this line:
Here's a paragraph!
I get this:
<p> Here's a paragraph! </p>
instead of what I want, which is this:
<p>Here's a paragraph!</p>
Obviously I could use the mouse to select only the correct part, but I was hoping there might be a keyboard shortcut.
If it's best to create my own macro using Regular Expressions, any pointers as to how to get started would be helpful.
Many thanks!
jon
You can record the following macro:
- CMD + <- To move the cursor to the beggining of the line - ALT + -> To go to the first word - SHIFT + CMD + -> To select the entire line without the new line character - SHIFT + CMD + W To wrap this with html tags
Sylvain
Le 1 sept. 07 à 14:10, Jon Ippolito a écrit :
Is there a key combination for selecting a line (or lines) of code in a tag but omitting leading and trailing spaces and tabs? I'm familiar with the Shift-Cmd-L shortcut, but it leaves in the whitespace. This makes a mess of indented HTML when I'm using the Ctrl-Shift-W and Ctrl-Shift-Cmd-W HTML shortcuts.
In other words, if I apply the combination Shift-Cmd-L followed by Ctrl-Shift-W to this line:
Here's a paragraph!
I get this:
<p> Here's a paragraph! </p>
instead of what I want, which is this:
<p>Here's a paragraph!</p>
Obviously I could use the mouse to select only the correct part, but I was hoping there might be a keyboard shortcut.
If it's best to create my own macro using Regular Expressions, any pointers as to how to get started would be helpful.
Many thanks!
jon
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
Sylvain Desvé <sylvain.desve@...> writes:
You can record the following macro:
- CMD + <- To move the cursor to the beggining of the line
- ALT + -> To go to the first word
- SHIFT + CMD + -> To select the entire line without the new line
character
- SHIFT + CMD + W To wrap this with html tags
Sylvain
Le 1 sept. 07 à 14:10, Jon Ippolito a écrit :
Is there a key combination for selecting a line (or lines) of code in a tag but omitting leading and trailing spaces and tabs?
Sylvain,
Thanks for this speedy response! This is a good start.
Unfortunately, the behavior of Alt/Option + -> seems a bit unpredictable: it skips over non-word characters like " and <, and entire words when only one tab is present at left. Also, Cmd + <-/-> won't find the beginning or end of a wrapped line, only the last character before it was wrapped.
However, your thought suggested to me a macro based on RegExp searches, which seems to work:
Find previous $ Find next \S(.+?)\n Shift + <-
I appreciate the inspiration!
jon
Regular expression search macro does the trick. I've been using one I whipped up in a few minutes for about a year. It goes like this:
^A (move to beginning of paragraph) search for: [^\s].*[^\s\n]$