-- Studly Next -- https://c-command.com/scripts/bbedit/studly-next -- Summary: Jump to the next intra-word. Works like a finer-grained Option-Rightarrow. -- Requires: BBEdit 8 (similar functionality built-into BBEdit 8.5) -- Install Location: -- Last Modified: 2019-05-24 property wordCharacters : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" -- FIXME: doesn't advance past word at end of document on run tell application "BBEdit" try tell window 1 set oldOffset to characterOffset of selection set firstChar to character oldOffset as string set inWordNow to my isWordCharacter(firstChar) repeat with newOffset from oldOffset + 1 to count characters set c to character newOffset as string if my stopHere(c, inWordNow) then select insertion point after character (newOffset - 1) return end if end repeat end tell end try end tell end run on stopHere(c, inWordNow) if isCapitalLetter(c) then return true else if not isWordCharacter(c) then return true else if not inWordNow and isWordCharacter(c) then return true else return false end if end stopHere on isCapitalLetter(c) if (ASCII number of c) is greater than or equal to 65 ¬ and (ASCII number of c) is less than 97 then return true else return false end if end isCapitalLetter on isWordCharacter(c) return wordCharacters contains c end isWordCharacter