aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
authorKirawi2024-03-19 16:26:32 +0000
committerGitHub2024-03-19 16:26:32 +0000
commitd9de809a573e28c425b5da9da8c77340d2a0174e (patch)
treed384998a5a8c97348728e2dd87d01b33f87039d0 /helix-term/src/ui/mod.rs
parent1d1806c85af37bfb2c8e972bd6e07df08fab61dc (diff)
add register completion (#9936)
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs14
1 files changed, 14 insertions, 0 deletions
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<Completion> {
+ 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()
+ }
}