On Feb 07, 2017, at 12:29, brian schroeder <[email protected]
<mailto:[email protected]>> wrote:
> Hi. How could you use a text factory to remove white space? Thanks.
Hey Brian,
Open a new Text Factory.
Leave the target as (nothing to process)
Select “Replace All”
Select “Options”
Turn on “grep”
Search for:
[[:blank:]]+
Replace with:
Nothing
Save it here:
~/Library/Application Support/BBEdit/Text Filters/
Personally I subcategorize Text Filters like so:
~/Library/Application Support/BBEdit/Text
Filters/Textfactories/removeHorizontalWhitespace.textfactory
Run the Text Factory from the menu Text > Apply Text Filter > [Your Text
Factory], or give it a keyboard shortcut in the BBEdit prefs.
Personally I'd rather use AppleScript than a Text Factory, because it's faster
– and I have more control.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/02/07 15:00
# dMod: 2017/02/07 15:33
# Appl: BBEdit
# Task: General Handler for Find/Replace – operates on selection if exists –
otherwise the whole document.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Handler, @Find, @Replace, @Document,
@Selection, @RegEx
-------------------------------------------------------------------------------------------
bbReplaceText("[[:blank:]]+", "")
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on bbReplaceText(findPattern, replacePattern)
tell application "BBEdit"
if (contents of the selection) ≠ "" then
tell front text window's its text of selection
replace findPattern using replacePattern options {search mode:grep,
case sensitive:false}
end tell
else
tell front text window's its text
replace findPattern using replacePattern options {search mode:grep,
case sensitive:false, starting at top:true}
end tell
end if
end tell
end bbReplaceText
-------------------------------------------------------------------------------------------
--
Best Regards,
Chris
--
This is the BBEdit Talk public discussion group. 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>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.