A Useful BBEdit AppleScript

Soft-Wrap Text in BBEdit - Uncorrected

An oldie but goodie from John Gruber that I just discovered while looking for ways to soft-wrap text in BBEdit:

This is a handy AppleScript. I don’t like to soft wrap my text in BBEdit by default, but always seem to end up wrapping it anyway. I launch this using Fastscripts by Daniel Jalkut with just a keystroke.

tell application "BBEdit"
    tell window 1
        if not (soft wrap text) then
            set soft wrap text to true
            set soft wrap mode to page guide
            set show page guide to true
        else if (soft wrap mode is page guide) then
            set soft wrap mode to window width
            set show page guide to false
        else
            set soft wrap text to false
        end if
    end tell
end tell

#Links