How to jump in the line to the first non-blank-character

37 views
Skip to first unread message

Vlad Ghitulescu

unread,
Oct 26, 2015, 9:15:01 AM10/26/15
to bbe...@googlegroups.com
Hello!


I have the following line in a HTML-file:

<li>Beidseitige Flügelüberdeckung mit Alu-Ornamenten</li>

I have a couple of TABs left (simplified to only one for this email) and my cursor is before „Alu-Ornamenten“.

Now I want to jump just before <li> on the left.

Is there a magic-shortcut for this?

Thanks!


Regards,
Vlad


P.S. Actually what I want is to replace the text between <li> and </li> with the text I have in the clipboard, that’s why:

- I jump to the left of the left-<li>-tag
- press 4x the right arrow key to position the cursor to the right of the left-<li>-tag
- keep SHIFT + ALT pressed and start to press the right arrow to move the cursor until the left of the right-<li>-tag and select the text in between
- press CMD-V

Is there a more intelligent way to do this?

Patrick Woolsey

unread,
Oct 26, 2015, 9:26:22 AM10/26/15
to bbe...@googlegroups.com
On 10/26/15 at 9:14 AM, Vl...@Ghitulescu.de (Vlad Ghitulescu) wrote:

> I have the following line in a HTML-file:
>
> <li>Beidseitige Flügelüberdeckung mit Alu-Ornamenten</li>
>
> I have a couple of TABs left (simplified to only one for this email)
> and my cursor is before „Alu-Ornamenten“.
>
> [...] what I want is to replace the text between <li> and </li> with the
> text I have in the clipboard, that’s why: [...]


Type Command-B (View -> Balance), then paste. :-)



Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com/>

Vlad Ghitulescu

unread,
Oct 26, 2015, 9:46:48 AM10/26/15
to bbe...@googlegroups.com
Hi, Patrick!


> Am 26.10.2015 um 14:26 schrieb Patrick Woolsey <pwoo...@barebones.com>:
>
> On 10/26/15 at 9:14 AM, Vl...@Ghitulescu.de (Vlad Ghitulescu) wrote:
>
>> I have the following line in a HTML-file:
>>
>> <li>Beidseitige Flügelüberdeckung mit Alu-Ornamenten</li>
>>
>> I have a couple of TABs left (simplified to only one for this email)
>> and my cursor is before „Alu-Ornamenten“.
>>
>> [...] what I want is to replace the text between <li> and </li> with the
>> text I have in the clipboard, that’s why: [...]
>
>
> Type Command-B (View -> Balance), then paste. :-)

Ha! That’s amazing! Thanks, Patrick!

Christopher Stone

unread,
Oct 26, 2015, 8:02:27 PM10/26/15
to BBEdit-Talk Talk
On Oct 26, 2015, at 08:46, Vlad Ghitulescu <Vl...@Ghitulescu.de> wrote:
Type Command-B (View -> Balance), then paste. :-)

Ha! That’s amazing! Thanks, Patrick!
______________________________________________________________________

Hey Vlad,

If you do that a lot you can save a keystroke.

-------------------------------------------------------------------------------------
# Cursor must be inside the tags.
-------------------------------------------------------------------------------------
tell application "BBEdit"
  balance tags
  paste
end tell
-------------------------------------------------------------------------------------

Getting a little fancier we can do the same thing with the cursor anywhere on the line.

-------------------------------------------------------------------------------------
# Cursor may be anywhere in the line.
-------------------------------------------------------------------------------------
tell application "BBEdit"
  tell (front text window's line (startLine of selection))
    select insertion point after character (endLine of (first character of it whose contents is ">"))
    balance tags
  end tell
  paste
end tell
-------------------------------------------------------------------------------------

This is overkill if you don't do this task a lot, but it demonstrates how simple this sort of thing is to do with BBEdit's excellent AppleScript support.

--
Take Care,
Chris


Vlad Ghitulescu

unread,
Oct 27, 2015, 12:56:48 AM10/27/15
to bbe...@googlegroups.com
Hey, Chris!


> Am 27.10.2015 um 01:02 schrieb Christopher Stone <listm...@suddenlink.net>:
>
> This is overkill if you don't do this task a lot, but it demonstrates how simple this sort of thing is to do with BBEdit's excellent AppleScript support.

I did this about 30 times, now I’m ready with this - and yes, it makes AppleScript (in BBEdit) very likable.

(This *** move in 5 weeks and then Aperture —> Lightroom… and then is AppleScript & RegEx-time ;-)


Regards,
Vlad



Reply all
Reply to author
Forward
0 new messages