ok scope isnt quite the right word...
lets says i have
<img src="something" width="10" height="15>
and i have the caret somewhere around src
is there a way to move to either right before or after the closing >
or when you get auto "" and it drops the caret in the middle, is there a way to jump to right outside the quote?
been googling and digging through the power editing book but i'm not finding anything...
On 20 Mar 2008, at 07:00, Sean Allen wrote:
lets says i have
<img src="something" width="10" height="15>
and i have the caret somewhere around src
is there a way to move to either right before or after the closing >
Not by default, no. But if you need this a lot, do something like:
Start Macro Recording Search forward for > Stop Macro Recording
Now save this macro, and here is the nice part, give it an easy key equivalent like e.g. ⌃→. Then give it a scope selector like ‘meta.tag’. This will then only have the key run the macro when caret is inside tags. I.e. the idea here is that you can pick a key sequence with good mnemonic, since it will only be for this limited scope.
You can find more info about macros and scope selectors in the manual.
or when you get auto "" and it drops the caret in the middle, is there a way to jump to right outside the quote?
Well, pressing " again will overtype it, pressing → will move past it, so will ⌃F. You need a fourth option? :)
There are however more options, for example ⌘↩ is a macro for “move to end of line and press return”, so say you type: ‘<h1 id="bar’ you will actually have: ‘<h1 id="bar‸">’ (‸ marking the caret). Rather than “step over” the two end characters, simply press ⌘↩ to skip both _and_ advance to the next line.
A variant of ⌘↩ is ⇧⌘↩ which also inserts a line-terminator, in C and related languages, that would be a semi-colon, but in prose it is a period.
On 20-Mar-08, at 3:30 AM, Sean Allen wrote:
ok scope isnt quite the right word...
lets says i have
<img src="something" width="10" height="15>
and i have the caret somewhere around src
is there a way to move to either right before or after the closing >
or when you get auto "" and it drops the caret in the middle, is there a way to jump to right outside the quote?
been googling and digging through the power editing book but i'm not finding anything...
This is not possible with the current language definition for HTML. I did a deep dive into the language grammar to figure this out and came up blank.
The following works for languages with hierarchical symbols in the language definition: 1) Create a Command in the Bundle Editor called "Move to End of Scope" 2) Paste the following script into the command editor: #!/usr/bin/env ruby print while gets 3) Set Input to Selected Text or Scope 4) Set Output to Insert as Snippet 5) Set the scope to 'meta.function.erlang, meta.tag.block.any.html' (add scopes as you find them useful)
I do not know why this doesn't work with the HTML language definition. Anyone savvy to this problem?