Skip to content

Stef16Robbe/rgtui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rgtui

I wanted to learn Rust & Ratatui so I made a simple TUI wrapper around ripgrep, inspired by VSCode's project search

Showcase

Screenshot showcase of rgtui

Usage

  1. Download a binary from the releases section.
  2. Add the binary to your $PATH
  3. 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

Setup

It's written with:

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

TODO's

General features:

  • 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

Possible rg options to support:

  • -g or --glob-case-insensitive: glob searching, for including files (prepend ! to ignore the pattern)
  • --json if necessary
  • --sort
  • --hidden
  • --no-ignore