A readline replacement written in Rust
Introduction
Reedline is a project to create a readline-style crate for Rust that supports many of the modern conveniences of CLIs, including syntax highlighting, completions, multiline support, Unicode support, and more.
Examples
Basic example
// Create a default reedline object to handle user input
use ;
Integrate with custom Keybindings
// Configure reedline with custom keybindings
//Cargo.toml
// [dependencies]
// crossterm = "*"
use ;
let mut keybindings = default_emacs_keybindings;
keybindings.add_binding;
let mut line_editor = create?.with_keybindings;
Integrate with custom History
// Create a reedline object with history support, including history size limits
use ;
let history = Box new;
let mut line_editor = create?
.with_history
.expect;
Integrate with custom Highlighter
// Create a reedline object with highlighter support
use ;
let commands = vec!;
let mut line_editor =
create?.with_highlighter;
Integrate with custom Tab-Handler
// Create a reedline object with tab completions support
use ;
let commands = vec!;
let completer = Box new;
let mut line_editor = create?.with_completion_action_handler;
Integrate with custom Hinter
// Create a reedline object with in-line hint support
//Cargo.toml
// [dependencies]
// nu-ansi-term = "*"
use ;
let commands = vec!;
let completer = Box new;
let mut line_editor = create?.with_hinter;
Integrate with custom line completion Validator
// Create a reedline object with line completion validation support
use ;
let validator = Box new;
let mut line_editor = create?.with_validator;
Integrate with custom Edit Mode
// Create a reedline object with custom edit mode
use ;
let mut line_editor = create?.with_edit_mode;
Are we prompt yet? (Development status)
This crate is currently under active development in JT's live-coding streams. If you want to see a feature, jump by the streams, file an issue or contribute a PR!
- Basic unicode grapheme aware cursor editing.
- Configurable prompt
- Basic EMACS-style editing shortcuts.
- Configurable keybindings.
- Basic system integration with clipboard or optional stored history file.
- Content aware highlighting.
- Autocompletion.
- Undo support.
- Multiline aware editing with line completion validation.
For a more detailed roadmap check out TODO.txt.
Join the vision discussion in the vision milestone list by contributing suggestions or voting.
Alternatives
For currently more mature Rust line editing check out: