swpui: the search-and-replace TUI your terminal workflow is missing
24/6/2026 · 9:22

swpui: the search-and-replace TUI your terminal workflow is missing

swpui (Rust, MIT/Apache-2.0, v0.9.0, 51★) — a case-aware search-and-replace TUI with per-file preview and zero runtime deps.

sed -i 's/foo/bar/g' **/*.rs works until it doesn't. You rename a function across a codebase and three hours later you find FooHandler, fooHandler, and FOO_HANDLER still littering the diff. sed doesn't know about case variants. Your IDE's find-and-replace does — but that assumes you want to open an IDE.
swpui (pronounced "swap UI") is a Rust TUI by Valentin Bersier that brings VS Code-style search-and-replace to the terminal, with case-aware replacement, per-match preview, and batch confirmation — and no runtime dependencies. 1
Cargando tarjeta de contenido…

Install

Four paths, all one-liners: 1
# Cargo (any platform with Rust toolchain)
cargo install swpui

# cargo-binstall (skips compile, downloads pre-built binary)
cargo binstall swpui

# Nix
nix profile install nixpkgs#swpui

# Arch Linux (AUR)
yay -S swpui-bin
No Homebrew formula yet. macOS users without Nix will go through Cargo — a single compile, no ongoing dependency. Pre-built binaries for five platforms are available on GitHub Releases if you'd rather download directly. The binary is ~1.2 MB. 1

What it does

The binary is called swp. Run it in any directory and it opens a split-pane TUI: a search box, a replace box, a scrollable file list with match counts per file, and a preview panel showing the diff in context. 1
swpui v0.9.0 — live preview of a hash → sha256 replacement across 14 files. 1
Four search modes are available: literal, regex, case-insensitive regex, and multiline regex. The case-aware mode is the one that makes the tool worth mentioning. When enabled, it detects whether a matched token is in snake_case, camelCase, PascalCase, UPPER_SNAKE, kebab-case, or Flat — and applies the replacement in the same case. Rename worker to executor and you get executor, Executor, EXECUTOR, and executor_pool without writing six separate sed commands. 2
Navigation is keyboard-driven: j/k move through files, Enter applies all matches in the current file, Space skips the file, f applies the entire file at once, s skips. This per-file review flow is the practical difference from a one-shot sed -i or rg --replace: you can stop mid-operation, inspect a tricky file, and decide not to touch it — without canceling the whole batch.
Regex capture groups work: $0$9 reference captured groups in the replacement pattern, the same syntax as most editors. 1 The tool respects .gitignore, .ignore, and a .swpignore file if you need to exclude generated files per project.

A concrete scenario

You're renaming a Rust type from FileHash to ContentDigest across a mid-size codebase. The type appears in doc comments, struct names, function names, and variable names — all different cases.
cd my-project
swp
# In the TUI:
# Search:  FileHash  (case-aware mode: on)
# Replace: ContentDigest
swpui scans the directory (honoring .gitignore), shows you 14 files with 80 total matches, and opens a preview for each. You navigate through the list, confirm the source files, skip the auto-generated Cargo.lock entry, and press Enter on each file. The whole operation takes about two minutes and you saw every change before it landed.
The author built swpui after finding serpl — the nearest equivalent — stopped being maintained and required ripgrep and ast-grep as runtime dependencies. "The main feature I wanted to have is immediate feedback for the search query, which is also why I didn't stick with tools like fastmod and repgrep," Bersier wrote on Hacker News. 3

How it compares

ToolInteractive previewCase-aware replaceNo runtime depsNotes
swpui✓ per-file✓ 6 case variantsv0.9.0, MIT/Apache-2.0
sed -iscriptable, composable, no visual feedback
fastmod (Facebook)interactive confirm but no preview panel
repgreppartialripgrep-powered, no live diff preview
serplrequires ripgrep + ast-grep; maintenance stalled

Community signal and caveats

Honest answer: it's thin. The Show HN post in May 2026 got 3 points and one comment. 3 Reddit and Lobsters have zero threads. The star count jumped from 40 to 51 (+28%) in 24 hours, likely driven by the author's mention in "Ask HN: What are you working on? (June 2026)."
The one meaningful external signal: Orhun Parmaksız — ratatui co-maintainer and JetBrains Rust Developer Advocate — recommended swpui on X as an example of "ratatui apps as part of development workflow." That's not community consensus, but it's a credible technical signal from someone who reads a lot of ratatui code. 4
Cargando tarjeta de contenido…
The case-detection algorithm has known limits. Bersier notes it "will certainly have false positives" and covers common cases rather than claiming completeness. 2 For straightforward renames in well-structured codebases this is fine; for tightly coupled identifier systems with non-standard casing conventions, test on a branch first.
crates.io shows 328 total downloads across 14 published versions as of this writing — early adoption territory. 5

Quick-reference specs

All values from GitHub as of 2026-06-24. 1
Cargando tarjeta de contenido…
FieldValue
Repogithub.com/beeb/swpui
Versionv0.9.0 (released 2026-06-13)
LanguageRust (99.2%)
LicenseMIT OR Apache-2.0
Stars51 ★ (+11 in 24h)
Commits122
Binary nameswp
Install (Rust toolchain)cargo install swpui
Install (no compile)cargo binstall swpui
PlatformsLinux, macOS, Windows (pre-built binaries on Releases)
MSRVRust 1.94.1

Adopt / try / skip

Adopt if you do frequent cross-file renames in terminal-first workflows and find yourself reaching for sed + a manual review pass anyway. swpui collapses those two steps.
Try if you're skeptical — cargo binstall swpui gets you a binary in under 30 seconds, no compile time. Run it once on a non-critical rename and see if the preview workflow fits.
Skip if your IDE's find-and-replace already covers what you need, or if you're on a project where LSP-aware refactoring (symbol rename) is the right tool. swpui is text-based, not AST-aware — it won't know that hash in a string literal is different from hash as a type name.
Cover image: screenshot from beeb/swpui, MIT OR Apache-2.0

Contenido relacionado

Añade más opiniones o contexto en torno a este contenido.

  • Inicia sesión para comentar.