far
is a TUI tool for project-wide find and replace. It's .gitignore
-aware
and uses PCRE-style regexes.
I use vim as my editor, but it has awful support for this sort of thing. Some plugins get close, but in my experience they still require a ton of keystrokes to set up what should be a fast and easily-checkable process.
With stack installed, just do stack install
in this directory.
To start a find-and-replace from scratch in a directory just use far
in the
root directory (or far PATH
from elsewhere). To replace a set of paths e.g.
from a previous ls
or rg
command you can just pipe:
rg -l foobar | far
far [FILES] [-f|--from FROM] [-t|--to TO] [-i|--case-insensitive] [-e|--extended]
Short | Long | Description | Default |
---|---|---|---|
-i |
--case-insensitive |
Case-insensitive search | false |
-e |
--extended |
Use extended PCRE regexes | false |
-f |
--from |
Initial from-regex | Empty |
-t |
--to |
Initial to-regex (use \1 , \2 , etc. for capture groups) |
Empty |
Key | Action |
---|---|
Tab |
Next input |
Shift-Tab |
Previous input |
Space |
Toggle option |
Enter |
Start replacing |