At 10.10 -0400 2006-09-21, ·ime Ramov wrote:
>Hello,
>
>How can I remove trailing spaces in the document? I think that this should be 
>essential feature included in BBEdit, via menus, and maybe also included in 
>preferences, to be able to select it to strip trailing spaces automatically 
>upon saving the file.
>
>But for now, is there any other quick way? Regular expression? Thanks.

You can attach a script to any menu item in BBEdit.

Save this script with the name File*Save (that's a bullet character in the 
middle) in the folder Menu Scripts, and it will fix this automatically for you 
at every save.

using terms from application "BBEdit" -- only needed to make the script compile
        -- no "tell" needed since script is executed inside of BBEdit
        on menuselect(menu_name, item_name)
                if (count of text windows) > 0 then -- and class of document 1 
is text window then
                        tell text window 1
                                set replacecount to (replace "\s+\z" using "" 
options {starting at top:true, search mode:grep})
                        end tell
                end if
                return false -- BBEdit continues with the command
        end menuselect
end using terms from


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[EMAIL PROTECTED]
 (spam-safe email address, replace '-' with 'a')

--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to