BBEdit finding
December 13, 2014 at 4:36 PM by Dr. Drang
BBEdit’s system for finding text is both flexible and easy to understand, but it can be inefficient if you don’t use keyboard shortcuts for switching between its options. I suspect many BBEdit users don’t even know the shortcuts exist.
You bring up the Find window through either the
menu command or the ⌘F shortcut. All of the checkboxes and buttons in the Find window have keyboard shortcuts, which you can see, one at a time, by hovering over them. I think it’s better, though, if you can see them all at once:To me, the most important items are the checkboxes along the bottom. The state of the checkboxes is whatever state you left them in during your last search. Because I frequently change the type of searching I do, being able to quickly change the state of those checkboxes is the key to efficient searching. If you find the screenshot a little too small to read comfortably, here’s a table with both the default shortcuts and mine.
Checkbox | Default shortcut | My shortcut |
---|---|---|
Case sensitive | ⌃⇧N | ⌃⇧C |
Entire word | ⌃⇧E | ⌃⇧E |
Grep (regex)1 | ⌃⇧G | ⌃⇧G |
Selected text only | ⌃⇧S | ⌃⇧S |
Wrap around | ⌃⇧W | ⌃⇧W |
They all use the ⌃⇧ prefix, and most of them use the first letter of their label by default. The only one I changed is the one for case sensitive searching. I just never could train myself to associate that with N, so I changed it to C in BBEdit’s shortcuts settings:
I confess I almost never use saved patterns, accessible through the popup menu labeled with a g,2 but I often find myself bringing back search patterns that I used just a few minutes ago. For that, the history popup (with the clock logo) can be a big timesaver. Type ⌃⇧H and then arrow down through the list of old searches until you hit the one you want to reuse.
The action buttons along the right side of the window all use ⌘ as part of the prefix. The
button uses, in addition to the Return key, ⌘G, which Mac users should recognize as the standard “Find Again” key. Similarly, the button uses ⇧⌘G, which is also commonly used as the “Find Again, But Backwards” key.By the way, do you know about the ⌘E shortcut? In BBEdit, it’s explicitly shown as the shortcut for the
command, but it works in most Mac programs. Select some text, hit ⌘E, and the text will be put on the “find pasteboard.” Subsequent taps of ⌘G will search forward for that text (and ⇧⌘G will search backward for it). Using the ⌘E/⌘G combination is a very efficient way to find later instances of a string. I use them all the time to quickly move from where a function is defined to where it’s called. And, as I said, it’s available in most Mac programs.Finally, we come to BBEdit’s 3 This brings up a little text field below the title bar for you to enter the search string. As you type, it tells you how many matches there are, the matches are highlighted in the document, and you can move from one match to another by either clicking on the arrow buttons or hitting Return (to move forward) or Shift-Return (to move backward).
command, which has a keyboard shortcut of ⌥⌘F.Live Search, like the ⌘E/⌘G combo, can be faster than bringing up the Find window, but that speed comes at the cost of some flexibility. Live Search is always case-insensitive and does plain text searching only—no regular expressions allowed. It does, however, wrap around regardless of your last setting in the Find window, which is handy.
The reason I don’t bother with simple text editors, even those that have nice features like live Markdown formatting, is that their limited capabilities keep you at a beginner level, no matter how long you’ve been using them. Serious text editors have a depth that rewards their users.
Update 12/14/14 3:18 PM
Here’s a Twitter discussion on the history of the ⌘E shortcut.
-
Personally, I think Grep should be called Regex because Regex is more descriptive, but I know BBEdit has a decades-long history of calling it Grep, so there’s no way it’ll be changed now. ↩
-
I’m sure there’s a good reason to label this button g, but I don’t know what it is. Maybe that’s part of the reason I don’t use it. ↩
-
Or ⌃S, which BBEdit inherited from Emacs. ↩