This post is part of a series in which I want to take a closer look at some of the features and functionality in Fire, our new IDE for the Mac. In this post, I’d like to look at Search and Replace.
Search and Replace is a core feature of any development environment, so of course Fire has sophisticated support for it. The basics work pretty much exactly how you would expect, but Fire goes a bit beyond, so let’s look at the feature in detail.
To start with, as you would expect, you invoke Find/Replace using the standard Cmd-F keyboard shortcut (or via Edit|Find in the menu), which brings up the Find/Replace popup:
What’s more, the search term and settings will automatically synchronize between all files you have open — all across your project, and even across multiple solutions. So as you switch files, or switch to a different document window, you will see your search term is highlighted everywhere. And, like just about all state in Fire, it will also persist across restart of the IDE.
The Find/Replace popover gives you the usual options to Find Next, Find Previous, and of course to replace either one or all occurrences of the search term with a new string.
After you dismiss the Find/Replace popover, these options continue be available via keyboard shortcuts and the Edit|Find menu. Cmd-G will jump to the next occurrence, and Shift-Cmd-G will jump to the previous, both allowing you to cycle round-and-round in the current file. Option-Cmd-G will replace the current/next occurrence of the search term, while Control-Option-Cmd-G will replace all in the entire file.
When replacing, you will notice that the editor also highlights each occurrence of the replace term as well, with a more subtle yellow. This highlighting allows you to easily keep track of what matches your search and what has been replaced already.
If you had enough of your search, you can clear the search term, and make the yellow highlights disappear with it, by pressing Control-Option-Cmd-F (or choosing Clear Search Term from the Edit|Find menu).
But that’s not all. One frequent task while navigating code is navigating between occurrences of the same token, so Fire has a shortcut for that as well. When the cursor is on a word/token, you can press Control-Option-Right or Control-Option-Left to quickly jump to the next (or previous) occurrence of that token. Fire will automatically make the token at the cursor the current search term (so you will see it highlighted all across the file). If not already turned on, Fire will also temporarily enable the “whole words only” option for this search to make sure you only find the exact token (if you want to jump from one use of ‘
i‘ to the next, you don’t want to also hit the ‘i’ in ‘
When you do a manual search later, the “whole words only” will automatically revert back to its original setting. You’ll find that the Control-Option-Right or Control-Option-Left navigation is something that, once you’re used to it, you can no longer live without
All in all, Fire’s Find and Replace support is well-rounded and — along with Fire’s other navigating mechanisms that I’ll dive into in another post — designed to make it really easy and intuitive to find your way around your code.