diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 717a951c390be..f07c4d50ecb15 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -3055,7 +3055,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ aliases: &[], doc: "Clear given register. If no argument is provided, clear all registers.", fun: clear_register, - signature: CommandSignature::none(), + signature: CommandSignature::all(completers::register), }, TypableCommand { name: "redraw", @@ -3076,7 +3076,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ aliases: &[], doc: "Yank diagnostic(s) under primary cursor to register, or clipboard by default", fun: yank_diagnostic, - signature: CommandSignature::none(), + signature: CommandSignature::all(completers::register), }, TypableCommand { name: "echo", diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index ebfad2bc26c04..82ece5a2bf53f 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -516,4 +516,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() + } }