I wanted to learn Rust & Ratatui so I made a simple TUI wrapper around ripgrep, inspired by VSCode's project search
- Download a binary from the releases section.
- Add the binary to your
$PATH
- open
rgtui
in any directory you want to search in :)
wget -P $HOME/.local/bin https://github.com/Stef16Robbe/rgtui/releases/latest/download/rgtui-x86_64-unknown-linux-gnu
chmod u+x $HOME/.local/bin/rgtui
It's written with:
- ratatui, crossterm & tui-textarea for the TUI elements
- log and simplelog.rs for logging
App layout (generated with ratatui templates):
src/
├── app.rs -> holds the state and application logic
├── event.rs -> handles the terminal events (key press, mouse click, resize, etc.)
├── handler.rs -> handles the key press events and updates the application
├── lib.rs -> module definitions
├── main.rs -> entry-point
├── tui.rs -> initializes/exits the terminal interface
└── ui.rs -> renders the widgets / UI
- support excluding/including files based on path & glob patterns
- support scrolling up/down in rg result
- add logging
- add vertical scroll bar
- either wrap lines or add horizontal scroll bar
- use JSON output and color-code based on that
- move config to struct, allow configuration of settings in UI
- enable opening default editor from selected line in search result
- support multi-line search
- add tests
- add search/replace
- make use of ripgrep's internal crate's instead of issuing a
Command
- fix
clone()
's: https://rust-unofficial.github.io/patterns/anti_patterns/borrow_clone.html
-
-g
or--glob-case-insensitive
: glob searching, for including files (prepend!
to ignore the pattern) -
--json
if necessary -
--sort
-
--hidden
-
--no-ignore