Find and replace
Search text in the open file with the find bar, or in the whole project with the Find in Files panel, and replace what you find, with regular expressions if you like. Both: Works.
To find a name rather than text, such as every call of a function, use
Find Usages: it knows which total is which.
Find in the open file
Section titled “Find in the open file”- Press ⌘F (CtrlF), or Edit › Find › Find…. The find bar opens above the text with the selected word, or your last search.
- Type. Matches are marked in the text and in the stripe at the right edge, and the counter says
2/5. - ↩ and ⇧↩ go to the next and previous match, from the last one back to the first. Esc closes the bar.
The three switches in the field are Cc (Match Case), W (Words) and .* (Regex). The funnel limits the search to comments or string literals, or excludes them; Edit › Search in Selection Only searches inside the selection. ⌥↓ opens the last 20 searches of the window. New Line (or ⌘⇧↩) searches across lines.
The More menu (⋮) holds Add Selection for Next Occurrence, Select All Occurrences (one caret on each match, to edit them all at once) and Open Results in Find Window.
Replace in the open file
Section titled “Replace in the open file”- Press ⌘R (CtrlR), or Edit › Find › Replace…. A second row opens under the search field.
- Type the replacement. With .* on,
$1,${name}and$$insert groups and a dollar sign; the row shows the result for the current match (→ cart_total) before you replace it. - Choose Replace for the current match, Exclude to skip it, or Replace All. The status bar says how many were replaced.
Each replacement is one undo step. Preserve Case (a switch in the replace row) carries the case of the found text over to the replacement.
Search the whole project
Section titled “Search the whole project”- Press ⌘⇧F (CtrlShiftF), or Edit › Find › Find in Files…. The panel opens under the editor.
- Type. The search runs while you type, and the panel lists files with their matches, and a preview of the selected match at the right.
- Narrow it down: a file mask such as
*.rs, *.toml, and in In the scope Project, Directory or Open Files. - ↩ or a double click opens a match and closes the panel. Pin the panel (or press ⌘↩, Ctrl↩) to keep it open while you go through the results.
The panel lists at most 1,000 matches (1000+ when there are more). It searches the project’s
own sources: no virtual environments, node_modules, build output, files Git ignores, or symbolic
links. A line under the results says what was left out, for example
2 folders and 1 file not searched (libraries and ignored files); switch on Libraries and
ignored files to search them too. Binary files and files over 10 MiB are skipped.
Open files with unsaved changes are searched as you see them in the editor, not as they are on disk.
Replace across files
Section titled “Replace across files”- Press ⌘⇧R (CtrlShiftR), or Edit › Find › Replace in Files….
- Fill in the search, the replacement, the mask and the scope, and check the list. What is listed is exactly what will be replaced.
- Choose Replace All. The status bar says
Replaced 12 occurrences in 4 files.
Files open in an editor change there, unsaved, so ⌘Z takes the change back.
Files that are not open are written to disk, and each one gets a
local history entry first, so you can restore it. Replacing never
touches the files of Git, the .ferris-idea folder, symbolic links or files outside the project,
and files outside the project’s own sources only when Libraries and ignored files is on.
Regular expressions
Section titled “Regular expressions”The regex switch uses the syntax of Rust’s regex crate: character classes, groups, named groups
(?<name>…), \b, flags such as (?i). Look-around and back-references are not supported, which
keeps every search linear in time, even on large files. An invalid pattern is shown in red with
the reason.
Shortcuts
Section titled “Shortcuts”| Action | Shortcut |
|---|---|
| Edit › Add Selection for Next Occurrence | ⌃GAltJ |
| Edit › Find › Find | ⌘FCtrlF or AltF3 |
| Edit › Find › Find in Files | ⇧⌘FCtrlShiftF |
| Edit › Find › Find Next Occurrence | ⌘GF3 or CtrlL |
| Edit › Find › Find Previous Occurrence | ⇧⌘GShiftF3 or CtrlShiftL |
| Edit › Find › Replace | ⌘RCtrlR |
| Edit › Find › Replace in Files | ⇧⌘RCtrlShiftR |
| Edit › Search in Selection Only | ⌃⌥ECtrlAltE |
| Edit › Select All Occurrences | ⌃⌘GCtrlAltShiftJ |
| Find | ⌘3Alt3 |
| Show search historyShowSearchHistory | ⌥↓Altdown |
When it does not work
Section titled “When it does not work”0 resultsin red, although the text is there. Check Cc, W and .* and the funnel; they stay as you set them last.- A file is missing from Find in Files. It is outside the project’s own sources. Switch on Libraries and ignored files, or check the file mask.
- Replace in Files is missing in a remote project. Searching works on a remote host; replacing across files does not yet.
For agents
Section titled “For agents”Searching and previewing a replacement need no right. replace_in_files_preview writes nothing;
to change files, an agent edits them with the editing tools, which need write.
replace_in_files_previewPreview a find-and-replace across the project's own source files: per file the replacements (line, old, new) and the number of changes.search_everywhereSearch Everywhere: workspace files, classes, symbols (C, Go, Java, JavaScript, Python, Rust, TypeScript), IDE actions with shortcuts and text lines, by a few characters of the name.search_in_filesFind text or a regular expression in the project's own source files (match case, whole words, file mask such as*.rs, *.toml).
No tool matches. Try fewer words, or .