From d9de809a573e28c425b5da9da8c77340d2a0174e Mon Sep 17 00:00:00 2001 From: Kirawi Date: Tue, 19 Mar 2024 12:26:32 -0400 Subject: add register completion (#9936) --- helix-term/src/ui/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index a4b148af..b5969818 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -509,4 +509,18 @@ pub mod completers { files } } + + pub fn register(editor: &Editor, input: &str) -> Vec { + let iter = editor + .registers + .iter_preview() + // Exclude special registers that shouldn't be written to + .filter(|(ch, _)| !matches!(ch, '%' | '#' | '.')) + .map(|(ch, _)| ch.to_string()); + + fuzzy_match(input, iter, false) + .into_iter() + .map(|(name, _)| ((0..), name.into())) + .collect() + } } -- cgit v1.2.3-70-g09d2