From 1d9245f9d8d7e0055af860ba317391c0e471b2ac Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Mon, 30 Jan 2023 10:34:27 +0100 Subject: [PATCH] feat: add history suggestions --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index e79b195..2b9ae7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use execute::interpret; use rustyline::completion::FilenameCompleter; use rustyline::config::Configurer; use rustyline::error::ReadlineError; +use rustyline::hint::HistoryHinter; use rustyline::{CompletionType, Config, Editor, Result}; use rustyline_derive::{Completer, Helper, Highlighter, Hinter, Validator}; use whoami::username; @@ -20,6 +21,8 @@ mod prompt; struct EditorHelper { #[rustyline(Completer)] completer: FilenameCompleter, + #[rustyline(Hinter)] + hinter: HistoryHinter, } fn main() -> Result<()> { @@ -34,6 +37,7 @@ fn main() -> Result<()> { let helper = EditorHelper { completer: FilenameCompleter::new(), + hinter: HistoryHinter {}, }; let mut rl = Editor::with_config(config)?;