{"id":21159771,"url":"https://github.com/thomasschafer/scooter","last_synced_at":"2025-10-21T03:58:09.024Z","repository":{"id":254193107,"uuid":"832342301","full_name":"thomasschafer/scooter","owner":"thomasschafer","description":"Interactive find-and-replace in the terminal","archived":false,"fork":false,"pushed_at":"2025-10-18T21:05:57.000Z","size":49824,"stargazers_count":1040,"open_issues_count":9,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-19T12:03:58.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasschafer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-22T20:36:05.000Z","updated_at":"2025-10-19T11:12:17.000Z","dependencies_parsed_at":"2024-11-29T11:23:45.155Z","dependency_job_id":"058f4250-4b35-45b4-962c-cb4976f81be6","html_url":"https://github.com/thomasschafer/scooter","commit_stats":null,"previous_names":["thomasschafer/scout","thomasschafer/scooter"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/thomasschafer/scooter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasschafer%2Fscooter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasschafer%2Fscooter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasschafer%2Fscooter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasschafer%2Fscooter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasschafer","download_url":"https://codeload.github.com/thomasschafer/scooter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasschafer%2Fscooter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280200870,"owners_count":26289477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T13:01:06.595Z","updated_at":"2025-10-21T03:58:09.018Z","avatar_url":"https://github.com/thomasschafer.png","language":"Rust","funding_links":[],"categories":["Rust","Applications","💻 Apps","others","\u003ca name=\"text-search-replace\"\u003e\u003c/a\u003eText search and replace (alternatives to sed)","Text Processing"],"sub_categories":["Text processing","⌨️ Development Tools"],"readme":"# scooter\n\nscooter is an interactive find-and-replace terminal UI app. By default it recursively searches through files in the current directory, but can also be used to process text from stdin.\n\nSearch with either a fixed string or a regular expression, enter a replacement, and interactively toggle which instances you want to replace. 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.\n\n![scooter preview](media/preview.gif)\n\nYou can use custom themes for syntax highlighting (see [here](#syntax_highlighting_theme) for more info):\n\n![scooter with Catppuccin Macchiato theme](media/preview_catppuccin_macchiato.png)\n\n## Contents\n\n\u003c!-- TOC START --\u003e\n- [Features](#features)\n- [Usage](#usage)\n  - [Files](#files)\n  - [Stdin](#stdin)\n  - [Search fields](#search-fields)\n- [Performance](#performance)\n- [Installation](#installation)\n  - [Homebrew](#homebrew)\n  - [Nix](#nix)\n  - [AUR](#aur)\n  - [Winget](#winget)\n  - [NetBSD](#netbsd)\n  - [Prebuilt binaries](#prebuilt-binaries)\n  - [Cargo](#cargo)\n  - [Building from source](#building-from-source)\n- [Configuration options](#configuration-options)\n- [Editor configuration](#editor-configuration)\n  - [Helix](#helix)\n  - [Neovim](#neovim)\n- [Contributing](#contributing)\n  - [Development](#development)\n\u003c!-- TOC END --\u003e\n\n\n## Features\n\nA set of keymappings will be shown at the bottom of the window: these vary slightly depending on the screen you're on.\n\nWhen searching through files, scooter respects both `.gitignore` and `.ignore` files.\n\nYou 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\"`.\n\nWhen viewing search results, you can open the selected file at the relevant line by pressing `e`. This will use the editor defined by your `EDITOR` environment variable. scooter will automatically attempt to open the editor at the correct line number, but if you'd like to override the command used then you can set `editor_open` in your [config file](#configuration-options).\n\nBy default, scooter uses a regex engine that supports only a subset of features to maximise performance. To use the full range of regex features, such as negative lookahead, start scooter with the `-a` (`--advanced-regex`) flag.\n\nHidden files (such as those starting with a `.`) are ignored by default, but can be included by using the `--hidden` flag.\n\n\n## Usage\n\n### Files\n\nRun\n\n```sh\nscooter\n```\n\nin a terminal to launch scooter. By default the current directory is used to search and replace in, but you can pass in a directory as the first argument to override this behaviour:\n\n```sh\nscooter ../foo/bar\n```\n\n### Stdin\n\nscooter can operate on content piped from stdin. For instance:\n\n```sh\necho \"hello world\" | scooter\n```\n\nIn standard TUI mode the results are written to stderr, to avoid clashing with the TUI which writes to stdout. Given this, you can write the results using `2\u003e`, e.g.:\n\n```sh\ncat input.txt | scooter 2\u003e output.txt\n```\n\nIn `--no-tui` mode (`-N`), the results are instead written to stdout. For example:\n\n```sh\ncat input.txt | scooter -N -s before -r after \u003e output.txt\n```\n\n### Search fields\n\nWhen on the search screen the following fields are available:\n\n- **Search text**: Text to search with. Defaults to regex, unless \"Fixed strings\" is enabled, in which case this reverts to case-sensitive string search.\n- **Replace text**: Text to replace the search text with. If searching with regex, this can include capture groups.\n- **Fixed strings**: If enabled, search with plain strings. If disabled, search with regex.\n- **Match whole word**: If enabled, only match when the search string forms an entire word and not a substring in a larger word. For instance, if the search string is \"foo\", \"foo bar\" would be matched but not \"foobar\".\n- **Match case**: If enabled, match the case of the search string exactly, e.g. a search string of `Bar` would match `foo Bar baz` but not `foo bar baz`.\n- **Files to include**: Glob patterns, separated by commas (`,`), that file paths must match. For instance, `*.rs, *.py` matches all files with the `.rs` or `.py` extensions.\n- **Files to exclude**: Glob patterns, separated by commas (`,`), that file paths must not match. For instance, `env/**` ignores all files in the `env` directory. This field takes precedence over the pattern in the \"Files to include\" field.\n\nNote that the glob matching library used in scooter comes from the brilliant [ripgrep](https://github.com/BurntSushi/ripgrep), and matches the behaviour there: for instance, if you wanted to include only files in the directory `dir1`, you'd need to add `dir1/**` in the \"Files to include\" field - `dir1` alone would not work.\n\n#### Pre-populating search fields\n\nYou can pre-populate the search fields using command-line flags, for instance:\n\n```sh\nscooter \\\n  --search-text \"old\" \\\n  --replace-text \"new\" \\\n  --fixed-strings \\\n  --files-to-include \"*.rs,*.py\"\n```\n\nNote that, by default, pre-populated fields are disabled in the UI. To make these fields editable by default, you can set `search.disable_prepopulated_fields` to `false` in your config - see [here](#disable_prepopulated_fields).\nYou can also temporarily unlock the pre-populated fields with `\u003calt\u003e+u`.\n\nWhen pre-populating the fields in this way, you can skip the initial search screen entirely and jump straight to searching with the `--immediate-search` flag, e.g.:\n\n```sh\nscooter --search-text \"old\" --replace-text \"new\" --immediate-search\n```\n\nRun `scooter --help` to see the full list of command-line args that can be used to pre-populate fields.\n\n\n## Performance\n\nscooter is fast. Below is a benchmark for comparison, performing a find and replace on the entire [Linux kernel](https://github.com/torvalds/linux), finding and replacing the string \"before\" with \"after\":\n\n\u003c!-- BENCHMARK START --\u003e\n| Command | Mean [s] | Min [s] | Max [s] | Relative |\n|:---|---:|---:|---:|---:|\n| `scooter` | 6.403 ± 0.093 | 6.287 | 6.543 | 1.46 ± 0.03 |\n| `scooter (--no-tui)` | 4.491 ± 0.066 | 4.424 | 4.572 | 1.02 ± 0.02 |\n| `ripgrep + sd` | 4.894 ± 0.061 | 4.816 | 4.964 | 1.11 ± 0.03 |\n| `fastmod` | 4.395 ± 0.084 | 4.322 | 4.533 | 1.00 |\n| `fd + sd` | 10.010 ± 0.000 | 10.010 | 10.011 | 2.28 ± 0.04 |\n\n\u003c!-- BENCHMARK END --\u003e\n\nMuch of the speed is thanks to using the [ripgrep](https://github.com/BurntSushi/ripgrep) file walker, found in the [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) crate.\n\nRun `scooter --help` for a full list of flags.\n\n\n## Installation\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/scooter.svg)](https://repology.org/project/scooter/versions)\n\n### Homebrew\n\nOn macOS and Linux, you can install scooter using [Homebrew](https://formulae.brew.sh/formula/scooter):\n\n```sh\nbrew install scooter\n```\n\n### Nix\n\nscooter is available as `scooter` in [nixpkgs](https://search.nixos.org/packages?show=scooter).\n\n### AUR\n\nInstall from the Arch User Repository with:\n\n```\nyay -S scooter\n```\n\nOr, to build from the latest commit:\n\n```\nyay -S scooter-git\n```\n\n### Winget\n\nInstall from Winget with\n\n```sh\nwinget install thomasschafer.scooter\n```\n\n### NetBSD\n\nInstall from the official repositories with:\n\n```sh\npkgin install scooter\n```\n\n### Prebuilt binaries\n\nDownload the appropriate binary for your system from the [releases page](https://github.com/thomasschafer/scooter/releases/latest):\n\n| Platform | Architecture | Download file |\n|-|-|-|\n| Linux | Intel/AMD | `*-x86_64-unknown-linux-musl.tar.gz` |\n| Linux | ARM64 | `*-aarch64-unknown-linux-musl.tar.gz` |\n| macOS | Apple Silicon| `*-aarch64-apple-darwin.tar.gz` |\n| macOS | Intel | `*-x86_64-apple-darwin.tar.gz` |\n| Windows | x64 | `*-x86_64-pc-windows-msvc.zip` |\n\nAfter downloading, extract the binary and move it to a directory in your `PATH`.\n\n### Cargo\n\nEnsure you have cargo installed (see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html)), then run:\n\n```sh\ncargo install scooter\n```\n\n### Building from source\n\nEnsure you have cargo installed (see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html)), then run the following commands:\n\n```sh\ngit clone git@github.com:thomasschafer/scooter.git\ncd scooter\ncargo install --path scooter --locked\n```\n\n\n## Configuration options\n\nBy default, scooter looks for a TOML configuration file at:\n\n- Linux or macOS: `~/.config/scooter/config.toml`\n- Windows: `%AppData%\\scooter\\config.toml`\n\nYou can override the config directory by using the `--config-dir` flag.\n\nThe following options can be set in your configuration file:\n\n\u003c!-- CONFIG START --\u003e\n### `[editor_open]` section\n\n#### `command`\n\nThe command used when pressing `e` on the search results page. Two variables are available: `%file`, which will be replaced\nwith the file path of the search result, and `%line`, which will be replaced with the line number of the result. For example:\n```toml\n[editor_open]\ncommand = \"vi %file +%line\"\n```\nIf not set explicitly, scooter will attempt to use the editor set by the `$EDITOR` environment variable.\n\n#### `exit`\n\nWhether to exit scooter after running the command defined by `editor_open.command`. Defaults to `false`.\n\n### `[preview]` section\n\n#### `syntax_highlighting`\n\nWhether to apply syntax highlighting to the preview. Defaults to `true`.\n\n#### `syntax_highlighting_theme`\n\nThe theme to use when syntax highlighting is enabled.\n\nThe default is `\"base16-eighties.dark\"`. Other built-in options are\n`\"base16-mocha.dark\"`, `\"base16-ocean.dark\"`, `\"base16-ocean.light\"`, `\"InspiredGitHub\"`, `\"Solarized (dark)\"` and `\"Solarized (light)\"`.\n\nYou can use other themes by adding `.tmTheme` files to `\u003cscooter-config-dir\u003e/themes` and then specifying their name here.\nBy default, `\u003cscooter-config-dir\u003e` is `~/.config/scooter/` on Linux or macOS, or `%AppData%\\scooter\\` on Windows, and can be overridden with the `--config-dir` flag.\n\nFor instance, to use Catppuccin Macchiato (from [here](https://github.com/catppuccin/bat)), on Linux or macOS run:\n```sh\nwget -P ~/.config/scooter/themes https://github.com/catppuccin/bat/raw/main/themes/Catppuccin%20Macchiato.tmTheme\n```\nand then set `syntax_highlighting_theme = \"Catppuccin Macchiato\"`.\n\n### `[style]` section\n\n#### `true_color`\n\nForce enable or disable true color. `true` forces true color (supported by most modern terminals but not e.g. Apple Terminal), while `false` forces 256 colors (supported by almost all terminals including Apple Terminal).\nIf omitted, scooter will attempt to determine whether the terminal being used supports true color.\n\n### `[search]` section\n\n#### `disable_prepopulated_fields`\n\nWhether to disable fields set by CLI flags. Set to `false` to allow editing of these pre-populated fields. Defaults to `true`.\n\n\u003c!-- CONFIG END --\u003e\n\n\n## Editor configuration\n\nBelow are a couple of ways to run scooter without leaving your editor.\n\n### Helix\n\nAs explained [here](https://github.com/helix-editor/helix/wiki/Recipes#project-wide-search-and-replace-with-scooter), you can add a keybinding like the following to open scooter directly in Helix with `\u003center\u003e s`:\n\n```toml\n[keys.select.ret]\ns = [\n    \":write-all\",\n    \":insert-output scooter --no-stdin \u003e/dev/tty\",\n    \":redraw\",\n    \":reload-all\"\n]\n```\n\nNote that this saves all files before opening scooter.\n\n#### Floating window\n\nIf you are using Helix in Tmux, you can add a keymap like the following to your Helix config to open scooter in a popup with `\u003center\u003e s`:\n\n```toml\n[keys.select.ret]\ns = \":sh tmux popup -xC -yC -w90% -h90% -E scooter\"\n```\n\nYou can also add the following to your [scooter config file](#configuration-options) to open files back in Helix from the search results page with `e`:\n\n```toml\n[editor_open]\ncommand = 'tmux send-keys -t \"$TMUX_PANE\" \":open %file:%line\" Enter'\nexit = true\n```\n\n#### Piping to scooter\n\nYou can pipe content from Helix to scooter, and it will write the updated contents back to the buffer in Helix. Select some contents in Helix, and then enter `:| scooter \u003e/dev/tty` (i.e. press `:`, type or paste `| scooter \u003e/dev/tty`, and then press enter). scooter will open, allowing you to find and replace on the contents: once you're done, the buffer will have been updated with any changes.\n\n### Neovim\n\nYou can integrate scooter with Neovim using either [ToggleTerm](https://github.com/akinsho/toggleterm.nvim) or [snacks.nvim](https://github.com/folke/snacks.nvim). Both configurations provide the following keymaps:\n* `\u003cleader\u003es` to open scooter, resuming an existing session if one exists.\n* `\u003cleader\u003er` to open scooter and search for the currently selected text in visual mode. (Note that the search text field will be disabled by default in scooter, but you can tweak this behaviour as explained [here](#pre-populating-search-fields)).\n* `e` to open files from scooter in Neovim, hiding the scooter window (which can be re-opened with `\u003cleader\u003es`).\n\nFirst, add the following to your [scooter config file](#configuration-options):\n\n```toml\n[editor_open]\ncommand = \"nvim --server $NVIM --remote-send '\u003ccmd\u003elua EditLineFromScooter(\\\"%file\\\", %line)\u003cCR\u003e'\"\n```\n\nThen, add this to your Neovim config:\n\n```lua\n\n-- REPLACE THIS: Integration-specific code here\n\nvim.keymap.set('n', '\u003cleader\u003es', open_scooter, { desc = 'Open scooter' })\nvim.keymap.set('v', '\u003cleader\u003er',\n    function()\n        local selection = vim.fn.getreg('\"')\n        vim.cmd('normal! \"ay')\n        open_scooter_with_text(vim.fn.getreg('a'))\n        vim.fn.setreg('\"', selection)\n    end,\n    { desc = 'Search selected text in scooter' })\n```\n\nFinally, replace the `-- REPLACE THIS: ...` line with one of the integration-specific code blocks below:\n\n#### Option 1: Using snacks.nvim\n\nInstall snacks.nvim as per the instructions [here](https://github.com/folke/snacks.nvim#-installation).\n\n```lua\nlocal scooter_term = nil\n\n-- Called by scooter to open the selected file at the correct line from the scooter search list\n_G.EditLineFromScooter = function(file_path, line)\n    if scooter_term and scooter_term:buf_valid() then\n        scooter_term:hide()\n    end\n\n    local current_path = vim.fn.expand(\"%:p\")\n    local target_path = vim.fn.fnamemodify(file_path, \":p\")\n\n    if current_path ~= target_path then\n        vim.cmd.edit(vim.fn.fnameescape(file_path))\n    end\n\n    vim.api.nvim_win_set_cursor(0, { line, 0 })\nend\n\nlocal function is_terminal_running(term)\n    if not term or not term:buf_valid() then\n        return false\n    end\n    local channel = vim.fn.getbufvar(term.buf, 'terminal_job_id')\n    return channel and vim.fn.jobwait({channel}, 0)[1] == -1\nend\n\nlocal function open_scooter()\n    if is_terminal_running(scooter_term) then\n        scooter_term:toggle()\n    else\n        scooter_term = require(\"snacks\").terminal.open(\"scooter\", {\n            win = { position = \"float\" },\n        })\n    end\nend\n\nlocal function open_scooter_with_text(search_text)\n    if scooter_term and scooter_term:buf_valid() then\n        scooter_term:close()\n    end\n\n    local escaped_text = vim.fn.shellescape(search_text:gsub(\"\\r?\\n\", \" \"))\n    scooter_term = require(\"snacks\").terminal.open(\"scooter --fixed-strings --search-text \" .. escaped_text, {\n        win = { position = \"float\" },\n    })\nend\n```\n\n#### Option 2: Using ToggleTerm\n\nInstall ToggleTerm as per the instructions [here](https://github.com/akinsho/toggleterm.nvim#installation), then add to your Neovim config:\n\n```lua\nlocal scooter_term = nil\n\n-- Called by scooter to open the selected file at the correct line from the scooter search list\n_G.EditLineFromScooter = function(file_path, line)\n    if scooter_term and scooter_term:is_open() then\n        scooter_term:close()\n    end\n\n    local current_path = vim.fn.expand(\"%:p\")\n    local target_path = vim.fn.fnamemodify(file_path, \":p\")\n\n    if current_path ~= target_path then\n        vim.cmd.edit(vim.fn.fnameescape(file_path))\n    end\n\n    vim.api.nvim_win_set_cursor(0, { line, 0 })\nend\n\nlocal function open_scooter()\n    if not scooter_term then\n        scooter_term = require(\"toggleterm.terminal\").Terminal:new({\n            cmd = \"scooter\",\n            direction = \"float\",\n            close_on_exit = true,\n            on_exit = function()\n                scooter_term = nil\n            end\n        })\n    end\n    scooter_term:open()\nend\n\nlocal function open_scooter_with_text(search_text)\n    if scooter_term and scooter_term:is_open() then\n        scooter_term:close()\n    end\n\n    local escaped_text = vim.fn.shellescape(search_text:gsub(\"\\r?\\n\", \" \"))\n    scooter_term = require(\"toggleterm.terminal\").Terminal:new({\n        cmd = \"scooter --fixed-strings --search-text \" .. escaped_text,\n        direction = \"float\",\n        close_on_exit = true,\n        on_exit = function()\n            scooter_term = nil\n        end\n    })\n    scooter_term:open()\nend\n```\n\n## Contributing\n\nContributions are very welcome! I'd be especially grateful for any contributions to add scooter to popular package managers. If you'd like to add a new feature, please create an issue first so we can discuss the idea, then create a PR with your changes.\n\n### Development\n\nOnce you've pulled down the repo, you can run scooter with:\n\n```sh\ncargo run --bin scooter\n```\n\nIf you make any changes to either the readme or config, you'll need to run the following to regenerate the docs:\n\n```sh\ncargo xtask readme\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasschafer%2Fscooter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasschafer%2Fscooter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasschafer%2Fscooter/lists"}