Find and replace in file
You can quickly find and replace text strings in the current document. Using different options, you can narrow your search process, use regular expressions in your search, and manage your search results.
Find the search string in a file
Open your file in the editor.
Press ⌃ F or select
from the main menu.In the search field that opens, enter your search string. AppCode highlights the results of your search in the file. Alternatively, in the editor, highlight the string you want to find and press ⌃ F. AppCode places the highlighted string into the search field.
Find in selection
You can search for a text string inside the multi-line selection.
Select a multi-line fragment and press ⌃ F.
Click and type your search string. AppCode will search for the target inside the selected fragment first.
If you release , AppCode will switch the search process back to the whole file.
If you want to search for the multi-line fragment itself, select it and press ⌃ F.
Find the word at the caret
This command lets you find occurrences of the current word independently on its structural meaning — it can be anything in your document: an identifier or a keyword in the code, a word in a string literal or a comment, an XML tag or attribute, or even a number. If any matches are found, you can quickly navigate between them.
Note that this command is case-sensitive.
To find the word at the caret, choose
from the main menu.To go to the next or previous occurrence, press F3 or ⇧ F3, respectively.
Manage your search
AppCode lets you adjust your search process and perform various actions with the displayed search results.
If you want to see the list of previous searches, press ⌥↓ in the search field.
If you want to enter a multi-line string, click the icon in the search field for a new line.
With selected, AppCode automatically escapes special regex symbols with backslash
\
when you search for a text string by selecting it in the editor and clicking ⌃ F.For more details on regex, refer to the search with regex documentation.
Use the and arrows to navigate to the previous or the next occurrence.
Work with the list of occurrences ⌥ F7 in the Find tool window, where you have other options, for example, to group your results or to open them in a separate window.
Click the or icon to add a selection of the next occurrence or deselect the previous occurrence ⌥ J or ⌥ ⇧ J.
If you want to quickly replace the target of your search in the whole file, press ⌃ ⌥ ⇧ J and type a new string.
You can narrow your search when you click , in the search field, or click to select a scope for your search.
You can press ^⌥X (previously known as ⌥G) to quickly toggle the Regex option. You can use regular expressions to opt for more challenging searches.
Press ⌃ F7 to see usages of any element in the opened file.
If you don't want AppCode to highlight all found usages in the file, open the Preferences dialog ⌃ ⌥ S and on the page clear the Highlight usages of element at caret option.
Press ⌥ F7 to search for usages beyond the current file or ⌃ ⌥ F7 to open the search results in a separate popup. If you need to configure some options before the search, press ⌃ ⌥ ⇧ F7 to open the Find Usages dialog.
Replace the search string in a file
Press ⌃ R or select Replace in File window.
from the main menu to open theIn the top field, enter your search string. In the bottom field, enter your replacement string. If you need to preserve the case, click located in the replace field.
Click for a multi-line replace. For example, if you want to replace a comma with a comma and a new line, enter a comma in the search field and a comma and the new line in the replace field.
Click Replace to replace items one by one, Replace all to replace all items in your file, and Exclude to omit some items from replacing.
The options that appear in the Replace window, are similar to the Find window and you can refer to the manage the search results section.