Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/commands/typed.rs')
| -rw-r--r-- | helix-term/src/commands/typed.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 6354e68f..85cf6b1d 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -4261,6 +4261,9 @@ pub fn complete_command_args( complete_variable_expansion(&token.content, offset + token.content_start) } TokenKind::Expansion(ExpansionKind::Unicode) => Vec::new(), + TokenKind::Expansion(ExpansionKind::Register) => { + complete_register_expansion(editor, &token.content, offset + token.content_start) + } TokenKind::ExpansionKind => { complete_expansion_kind(&token.content, offset + token.content_start) } @@ -4386,6 +4389,22 @@ fn complete_variable_expansion(content: &str, offset: usize) -> Vec<ui::prompt:: .collect() } +fn complete_register_expansion( + editor: &Editor, + content: &str, + offset: usize, +) -> Vec<ui::prompt::Completion> { + let register_names: Vec<String> = editor + .registers + .iter_preview() + .map(|(ch, _)| ch.to_string()) + .collect(); + fuzzy_match(content, register_names, false) + .into_iter() + .map(|(name, _)| (offset.., name.to_string().into())) + .collect() +} + fn complete_expansion_kind(content: &str, offset: usize) -> Vec<ui::prompt::Completion> { use command_line::ExpansionKind; |