Move cursor to start of indented line?

100 views
Skip to first unread message

KevinC

unread,
Feb 19, 2024, 4:41:56 PM2/19/24
to BBEdit Talk
Hi, 

Is there a shortcut for moving to the start of an indented line (to just before the first non-blank character)?

In most other text editors that I've used, Cmd+Left Arrow does this.

However, in BBEdit, it seems to always move it to the start of the actual line. Is there a setting that I'm missing somewhere?

A similar question was asked previously at https://groups.google.com/g/bbedit/c/roAMZjB4A3U/m/WH35A5SVBgAJ, but for a different purpose. I actually only want to move to the first non-blank character. :)

Thanks!

Marshall Clow

unread,
Feb 19, 2024, 5:32:01 PM2/19/24
to bbe...@googlegroups.com
On Feb 19, 2024, at 1:30 PM, KevinC <noaccou...@gmail.com> wrote:
>
> Hi,
>
> Is there a shortcut for moving to the start of an indented line (to just before the first non-blank character)?
>
> In most other text editors that I've used, Cmd+Left Arrow does this.
>

> However, in BBEdit, it seems to always move it to the start of the actual line. Is there a setting that I'm missing somewhere?

Control-left arrow followed by option-right arrow is what I use.
I don’t know if there’s a single-keystroke version.

— Marshall

jj

unread,
Feb 20, 2024, 3:54:20 AM2/20/24
to BBEdit Talk
You could do this with a bit of AppleScript:

try

   tell application "BBEdit"

       tell first window

           set vLine to startLine of selection

           tell first document

               set vResult to find "^\\h*" searching in its line vLine options {search mode:grep, wrap around:false, starting at top:true}

               if vResult's found then

                   if vResult's found text is "" then

                       select insertion point before its line vLine

                   else

                       select insertion point after last character of vResult's found object

                   end if

               end if

           end tell

       end tell

   end tell

on error aMessage

   display alert aMessage

end try


HTH

Jean Jourdain

KevinC

unread,
Feb 21, 2024, 3:18:18 PM2/21/24
to BBEdit Talk
Thanks! The AppleScript did exactly what I wanted.
Reply all
Reply to author
Forward
0 new messages