At 11:46 -0700 3/6/12, Oliver Taylor wrote:

I'm trying to write an applescript that emulates vim's "go to first non-whitespace character on the line".

I'm also building it to be smart about skipping lists (since most of my writing is prose).


Try this:


tell application "BBEdit"
  set _line to startLine of selection
  tell front document
    set _chars to characters of (get contents of line _line)
    set _i to 0
    repeat with _c in _chars
      set _i to _i + 1
      if _c is not in {space, tab} then
        select insertion point before character _i of line _line
        exit repeat
      end if
    end repeat
  end tell
end tell


JD

--
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