Search and replace

Editor

Search and replace

Search one buffer, the whole project, or the file tree, and make controlled replacements with Red's regular-expression syntax.

Search the current buffer

/Search forward with a live preview
?Search backward
n / NRepeat in the same or opposite direction
*Search for the word under the cursor
:nohClear search highlighting

Search patterns use Rust regular-expression syntax. Search history is shared between / and ? and persists across restarts.

Search the project

Press Space g to open project search. Type a query, move through matches with the arrow keys or Ctrl-n/Ctrl-p, and press Enter to open a result. Project search runs rg, so install ripgrep if Red reports that the process is unavailable.

Search the file tree

Press Ctrl-e to open the file tree, then / to search paths recursively. Enter opens a file or reveals a directory, Ctrl-Enter reveals without opening, and Esc restores the tree. Press D to search only directories, f to keep a filter, and Ctrl-x to clear it.

Replace text

:%s/old/new/g
:%s/(old)-([0-9]+)/$1-$2/g
:'<,'>s/old/new/gc

Red supports the current line, the whole buffer with %, numeric line ranges, and the last Visual selection. Add g for every match on a line, i for case-insensitive matching, or c to confirm each replacement.