thomasschafer / scooter

Interactive find and replace in the terminal
MIT License
179 stars 4 forks source link

scooter

Scooter is an interactive find-and-replace terminal UI app.

Search with either a fixed string or a regular expression, enter a replacement, and interactively toggle which instances you want to replace. You can also specify a regex pattern for the file paths you want to search.

If the instance you're attempting to replace has changed since the search was performed, e.g. if you've switched branches and that line no longer exists, that particular replacement won't occur: you'll see all such cases at the end.

Scooter preview

Features

Scooter respects both .gitignore and .ignore files.

You can add capture groups to the search regex and use them in the replacement string: for instance, if you use (\d) - (\w+) for the search text and ($2) "$1" as the replacement, then 9 - foo would be replaced with (foo) "9".

Installation

Cargo

Ensure you have cargo installed (see here), and then run

cargo install scooter

Building from source

Ensure you have cargo installed (see here), then pull down the repo and run

cargo install --path .

Usage

Run scooter in a terminal to launch Scooter. You can then enter some text to search with and text to replace matches with, toggle on or off fixed strings, and enter a regex pattern that filenames must match. A more extensive set of keymappings will be shown at the bottom of the window: these vary slightly depending on the screen you're on.