On Jun 03, 2012, at 13:46, Oliver Taylor wrote:
> I'm trying to write an applescript that emulates vim's "go to first 
> non-whitespace character on the line".
______________________________________________________________________

Hey Oliver,

No need for System Events - BBEdit can do it.

--
Best Regards,
Chris

------------------------------------------------------------------------------------------------
try
        tell application "BBEdit"
                tell text of front text window
                        select insertion point before character 1 of line 
(startLine of selection)
                        find "([^ \\-\\t\\d*•.])" options {search mode:grep, 
starting at top:false, wrap around:false, backwards:false, case 
sensitive:false, match words:false, extend selection:false} with selecting match
                end tell
        end tell
on error eMsg number eNum
        set {c, s} to {return, "------------------------------------------"}
        set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum 
& c & s
        beep
        set dDlg to display dialog e buttons {"Cancel", "Copy", "OK"} default 
button "OK"
        if button returned of dDlg = "Copy" then
                set the clipboard to e
        end if
end try
------------------------------------------------------------------------------------------------



-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to