Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | helix-term/src/commands.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 6f0bc394..23d2b246 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -633,10 +633,17 @@ impl std::str::FromStr for MappableCommand { .collect::<Vec<String>>(); typed::TYPABLE_COMMAND_MAP .get(name) - .map(|cmd| MappableCommand::Typable { - name: cmd.name.to_owned(), - doc: format!(":{} {:?}", cmd.name, args), - args, + .map(|cmd| { + let doc = if args.is_empty() { + cmd.doc.to_string() + } else { + format!(":{} {:?}", cmd.name, args) + }; + MappableCommand::Typable { + name: cmd.name.to_owned(), + doc, + args, + } }) .ok_or_else(|| anyhow!("No TypableCommand named '{}'", s)) } else if let Some(suffix) = s.strip_prefix('@') { |