The Right Experience for Your BBEdit Search
BBPony 0.2 is a small collection of AppleScripts which aim to emulate aspects of the behavior of the deprecated modal find dialog in BBEdit 10. It's free for anyone to use or modify. For some of the long-time users of BBEdit who recently upgraded to version 10 this may be really handy (or, even a Pony ;-) Read the feature list to find out more!
I believe BBPony improves the workflow and the experience when executing search operations in BBEdit 10. This may well be true for newer users of BBEdit, even if they do like the current find windows as they are. If you are interested to find out more about my motivation to write those tiny scripts you can read about the background of BBPony.
Currently 0.2 is an experimental version which implements the following features:
- Toggle single-file search and multi-file search with a single keystroke
By default the shortcut cmdF opens the single-find window and cmd⇧F additionally opens the multi-find window. BBPony changes this behavior so that every subsequent hit of cmdF toggles the multi-file search, mimicking the old modal find window behavior of viewing/hiding the search locations for multi-file searches. Just like BBEdit 9.6's modal dialog did when hitting cmdM. BBPony does this by opening the multi-file find window when a single-file find window is open, and immediately closes the latter and vice versa.
- Beautiful UI impression when toggling the multi-file search
When toggling the find windows between single-file and multi-file search, BBPony retains the exact window position and width, while it remembers the previously used height of each of the two windows. This produces a pretty good optical impression when toggling the windows.
- Start at top
If the foremost window is a find window, cmdT moves the cursor of the underlying text window to the first position in the document. This does almost the same like the old, much beloved checkbox. If no find window is open cmdT executes a "Search & Replace" operation, just like normal.
- Intelligent search mode detection
BBPony is smart enough to immediately open the multi-file search window, even if you hit the shortcut cmdF when the front document is not a text document, hence a single file-search would be pointless.
If you have previously installed BBPony 0.1 you should uninstall it first. I figured I should change the shortcut for toggling the single-find window and the multi-find window to cmdF for two reasons. Firstly this removes the need for the (slow) UI scripting to be activated on your Mac and secondly works around a bug where cmdM would not expand the Markup widget if it was visible.
- Download BBPony_0.2.zip.
- Extract the archive. Once extracted, you have a folder containing a few AppleScript files with strange names like
Search•Find….scpt, etc. It is very important that you don't change those file names. The file names have to be exactly like the BBEdit menu names to be attached to, using • as delimiter (see BBEdit's manual for details.)
- Copy all files from the BBPony folder with extension
.scptinto BBEdit's Menu Scripts folder. The folder is usually located within the Application Support folder of BBEdit within the user's Library folder. The standard path is
~/Library/Application Support/BBEdit/Menu Scripts/. You may have to create parts of the path first. To do so, you can open a terminal window and paste the following command (including the quotes):
mkdir -p ~/Library/Application\ Support/BBEdit/Menu\ ScriptsPlease note for Mac OS X 10.7 Lion: The user's Library folder is hidden by default. You can navigate to it in the Finder by clicking on the "Go" menu while holding down the alt key which makes Library appear in the list.
- Quit and relaunch BBEdit. This seems to be necessary only rarely, but it also doesn't hurt.
Check it out!
That's it, you're done! Try if all works as it should. Open a find window by hitting cmdF. Now hit cmdF again to see if it switches over to the multi-file search window. Hit cmdF again, BBEdit should switch back to the single file search window. Finally, open a single-file find window and hit cmdT and confirm that the cursor jumps to the first position of the underlying document.
If the Menu Script does not work at all please read and follow all the installation steps above once again very carefully.
Please also make sure, that you did not assign other shortcuts to the menu items "Search" > "Find…" and "Search" > "Multi-File Search…":
- Open BBEdit 10's preferences, select "Menus & Shortcuts" and make sure the shortcut cmdF is assigned to the menu item "Search" > "Find…".
- Next, in the same window make sure that the shortcut cmdT is assigned to "Search" > "Replace & Find Next".
Feedback and, um... Support
I plan to evaluate a couple of other ideas for extending and improving BBPony in the future, but my private time for such projects is very restricted. Nevertheless, I you have any comments or ideas please let me know! I would appreciate to get your feedback for BBPony. On the other hand, please understand, that I will not be able to give any support. But you can always check back on this website, which I will keep updated as needed.
Background. Why BBPony in the first place?
With the release of BBEdit 10, Barebones has ultimately dropped support for the old modal find dialog which was available via a hidden preference until BBEdit version 9.6.
Many, like me, have never understood the reasons for doing away with the modal find dialog in favor of two separate search windows for single-file an multi-file searches. Honestly, this is something I always used to laugh about when using other text editors.
Moreover, the new non-modal windows are really misbehaving in my opinion. They do partly behave like normal text windows and partly like modal windows. You can drag and drop text to them, they stay open. On the other hand, they disappear (into the background) when you execute a search. And strangely, you can close them by hitting the Escape key. Try doing this with a normal text window!
Basically, I don't like them, I just can't live with them. I always, always hit cmdF when I want to search for something, because I usually test a new regular expression on a single file. I may later decide to execute the search against a complete project. So now I have to open another (almost the same) find window and end up having two find windows in the way which don't close and show up again, for example when I later switch windows using cmd> or cmd<.
Also, we BBEdit users have lost the ability to start searches at the top of the window. This used to be a killer feature, at least for me. It was just so slick. Yes, I have raised complaints with Barebones, and many more have expressed their disappointment in the BBEdit Talk group, but unfortunately to no avail.
So, what should I do? I still do think BBEdit is the best text editor around for the Mac and I'm not prepared to quit using BBEdit in favor of another piece of software. On the other hand I'm not convinced of switching to BBEdit 10 yet for many other reasons, just to name a few: HTML markup editing is a huge step backwards in functionality, file search paths are removed, saved grep patterns are now stupidly displayed in alphabetical order, etc.
Nevertheless, I'm still evaluating BBEdit 10, because there are things I like a lot in the new version. But the two separated find windows are just killing me. So what should I do?
AppleScript to the rescue!
Luckily, Barebones provides an extensive support for AppleScript in BBEdit. One of the cooler features of our beloved text editor is, that it allows to attach AppleScripts to menu items. BBEdit then calls dedicated handlers in the attached AppleScript before and after menu items have been selected. So I thought that this might be the key to fixing BBEdit's find dialogs (at least for me.)
As it turned out, I quickly came up with a solution for me that I liked good enough that I use it all day now. So I thought this might be worth sharing with the BBEdit community.
Version 0.2, 2011-09-03
- New Feature: Added intelligent search mode detection. BBPony now immediately opens the multi-file search window if you hit the shortcut cmdF when the front document is not a text document.
- Change: BBPony does not not rely on Mac OS X's UI scripting any more. The floating markup editor now appears without any additional delay.
- Change: Smarter assignment of the window bounds reduces potential screen flicker of the find windows.
- Fix: The shortcut cmdM works again properly and expands the attribute list in the open floating markup editor as it should. This required changing the shortcut to toggle the multi-file search to cmdF.
Version 0.1, 2011-08-19
- Initial Revision.
I recommend to upgrade to the current version of BBPony. You can download the most recent version of BBPony from this page. For the reference, I will also keep selected older versions and their accompanying sites in the archive.
- Delete the script files belonging to BBPony from BBEdit's Menu Scripts folder. The folder is usually located within the Application Support folder of BBEdit within the user's Library folder. The standard path is
~/Library/Application Support/BBEdit/Menu Scripts/. Drag the following files into the trash. Depending on which version of BBPony you had installed may not have all of the files:
Search•Find….scpt Search•Multi-File Search….scpt Search•Replace & Find Next.scptPlease note for Mac OS X 10.7 Lion: The user's Library folder is hidden by default. You can navigate to it in the Finder by clicking on the "Go" menu while holding down the alt key which makes Library appear in the list.
- Only if you had installed version 0.1 of BBPony: Open BBEdit 10's preferences, select "Menus & Shortcuts" and re-assign the default shortcut cmd⇧F to the menu item "Search" > "Multi-File Search…". This is important.
- Only if you had installed version 0.1 of BBPony and if you had assigned the shortcut cmdM the menu item "Markup" > "Edit Markup…" prior to the installation of BBPony, assign it back to this shortcut.