You can create individual script files in the Scripts menu and assign them key 
equivalents. Using Script Editor save this simple script into the user 
Library/Application Support/BBEdit/Scripts folder and then open Preferences > 
Menus & Shortcuts in BBEdit and you can assign it a shortcut. This script would 
replace all runs of white space with single spaces in the front window.

tell application "BBEdit"
        replace "\\s+" using " " searching in first text of front document 
options {search mode:grep, wrap around:true}
end tell

Repeat with as many find/replace patterns as you need. 

An easy way to match BBEdit's options is to hit Record in Script Editor, do the 
search/replace you want and then model your script on what was recorded.

[fletcher]


> On Jan 11, 2017, at 6:38 AM, BenJ <[email protected]> wrote:
> 
> Hey guys,
> 
> I use BBEdit's regexp search patterns a lot for text processing, and have a 
> routine set of custom regexp patterns I use, and switch between, a lot.
> 
> However, when processing text, it's a bit of a pain having to go to the 
> search window, click the G button, then choose the next pattern just to use 
> it to process a text item. Far too much switching with the mouse and menu 
> hunting etc.
> 
> What I'd really like to do is to basically map a bunch of my search pattern 
> presets to keyboard shortcuts, much as you can do for clippings or text 
> filters in their own palette windows.
> 
> I don't think there's currently any way to do this in BBEdit, and as 
> recalling patterns seems to be only done by selecting them from the pattern 
> menu in the search window, it doesn't lend itself to automating.
> 
> Edit: having a poke around at the scripting possibilities, it seems the "Sort 
> lines using saved grep" script example shows a way of scripting the recall of 
> grep presets, and as you can assign scripts to hotkeys, that would seem the 
> way to go at this time. (Although a "Patterns" palette window would be a 
> nicer and more comfortable way of doing this...)
> 
> Any other options/ideas?
> 
> Cheers! (at least the process of writing this post has brought forth some 
> more options to explore).
> 
> -- 
> 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.

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

Reply via email to