1
0
Fork
You've already forked swpui
0
forked from beeb/swpui
Mirror for repository on github
  • Rust 99.3%
  • Nix 0.7%
beeb-release-plz[bot] e5fc832069
chore: release v0.9.0 ( #51 )
Co-authored-by: beeb-release-plz[bot] <146623270+beeb-release-plz[bot]@users.noreply.github.com>
2026年06月13日 11:26:47 +02:00
.github ci(mirror): add retries for ssh-keyscan ( #49 ) 2026年05月26日 22:22:13 +02:00
src feat: mouse support ( #55 ) 2026年06月13日 11:22:51 +02:00
tests feat(config): add support for config files ( #48 ) 2026年05月26日 22:09:54 +02:00
.envrc chore: add flake 2026年02月25日 22:30:04 +02:00
.gitignore chore: add package output to flake ( #9 ) 2026年04月29日 22:00:00 +02:00
Cargo.lock chore: release v0.9.0 ( #51 ) 2026年06月13日 11:26:47 +02:00
Cargo.toml chore: release v0.9.0 ( #51 ) 2026年06月13日 11:26:47 +02:00
CHANGELOG.md chore: release v0.9.0 ( #51 ) 2026年06月13日 11:26:47 +02:00
cliff.toml chore: prepare for release 2026年04月27日 22:16:33 +02:00
clippy.toml refactor: move stuff around 2026年03月22日 17:34:00 +02:00
CONTRIBUTING.md chore: add license and contributing guide 2026年03月28日 15:37:27 +02:00
deny.toml chore: prepare for release 2026年04月27日 22:16:33 +02:00
dist-workspace.toml chore: prepare for release 2026年04月27日 22:16:33 +02:00
flake.lock chore: add flake 2026年02月25日 22:30:04 +02:00
flake.nix ci: check msrv ( #45 ) 2026年05月10日 21:05:57 +02:00
LICENSE-APACHE chore: add license and contributing guide 2026年03月28日 15:37:27 +02:00
LICENSE-MIT chore: add license and contributing guide 2026年03月28日 15:37:27 +02:00
README.md feat: mouse support ( #55 ) 2026年06月13日 11:22:51 +02:00
release-plz.toml chore: prepare for release 2026年04月27日 22:16:33 +02:00
rust-toolchain.toml ci: check msrv ( #45 ) 2026年05月10日 21:05:57 +02:00
screenshot.png docs: update screenshot ( #41 ) 2026年05月09日 10:59:28 +02:00

swpui

swpui screencast

swpui (pronounced "swap UI") is a TUI utility to search and replace text, with a focus on ergonomics, speed and case-awareness in source code.

Dual-licensed under MIT or Apache 2.0.

Installation

Via cargo

cargo install swpui

Via cargo-binstall

cargo binstall swpui

Via Nix (nixpkgs-unstable)

nix profile install nixpkgs#swpui

Or run without installing:

nix run nixpkgs#swpui

Pre-built binaries and install script

Head over to the releases page!

Usage

Launch the TUI

$ swp

Keybindings

Global

Key Action
Tab Next pane
Shift+Tab Previous pane
Ctrl+r / Alt+r Cycle match mode
Ctrl+o / Alt+o Open options menu
Ctrl+c Quit

Options Menu

Key Action
r Cycle match mode
h Toggle hidden files
g Toggle gitignored files
Esc / Ctrl+o / Alt+o Close options menu

File List

Key Action
j / Down Next file
k / Up Previous file
l / Enter / Right Focus preview pane
s / Space Skip all matches in file (toggle)
f Apply replacement to file
a Apply replacement to all files
q Quit

Preview

Key Action
j / Down Next match
k / Up Previous match
Space Skip selected match (toggle)
Enter Apply replacement for selected match
h / Esc / Left Back to file list
s Skip all matches in file (toggle)
f Apply replacement to file
q Quit

Input Panes

Key Action
Esc Focus file list

Capture groups

In regex mode, the replacement template can reference capture groups from the search pattern using 0ドル through 9ドル:

  • 0ドル expands to the entire match.
  • 1ドル-9ドル expand to the corresponding capture groups (parenthesized sub-expressions in the pattern).
  • $$ produces a literal $.
  • References to groups that did not participate in the match expand to an empty string.

For example, searching for (\w+)_(\w+) and replacing with 2ドル_1ドル swaps the two halves of each snake_case pair.

Configuration

Default values for the options can be persisted in a swpui.toml (or .swpui.toml) file. On startup, swpui looks for them in:

  1. The user config directory (~/.config/swpui/ on Linux and macOS, %APPDATA%\beeb\swpui\ on Windows).
  2. Each directory from the filesystem root down to the directory where swpui was launched.

Settings closer to the working directory override settings from parents, and any field omitted from a file falls back to the value from the next layer up, ultimately defaulting to the built-in defaults shown below:

[options]
match-mode = "case-aware" # case-aware | literal | regex | regex-multiline
include-hidden = true
include-gitignored = false

Custom ignore file

In addition to .gitignore and .ignore files, swpui honors .swpignore files. These use the same gitignore syntax and are scoped per-directory: a .swpignore placed in any directory applies to that directory and its descendants.

Features

  • Case-aware replacement
  • Regex support (incl. multiline)
  • Multithreaded search
  • Respects (git)ignore files
  • Batch actions
  • Capture groups replacement
  • Toggle hidden files
  • Toggle gitignored files
  • Custom .swpignore files
  • Mouse support
  • Glob to include/exclude files

Credits

This tool was inspired by serpl, thanks for the great idea! It would also not have been possible without the amazing work put into ratatui and rat-widget, thank you! Finally, a massive thanks to the creator of ripgrep for their awesome work on ignore and regex.