@@ -3074,11 +3074,19 @@ fn command_mode(cx: &mut Context) {
30743074 // simple heuristic: if there's no just one part, complete command name.
30753075 // if there's a space, per command completion kicks in.
30763076 if parts.len() <= 1 {
3077− let end = 0..;
3078− cmd::TYPABLE_COMMAND_LIST
3077+ let mut matches: Vec<_> = cmd::TYPABLE_COMMAND_LIST
30793078 .iter()
3080− .filter(|command| FUZZY_MATCHER.fuzzy_match(command.name, input).is_some())
3081− .map(|command| (end.clone(), Cow::Borrowed(command.name)))
3079+ .filter_map(|command| {
3080+ FUZZY_MATCHER
3081+ .fuzzy_match(command.name, input)
3082+ .map(|score| (command.name, score))
3083+ })
3084+ .collect();
3085+
3086+ matches.sort_unstable_by_key(|(_file, score)| std::cmp::Reverse(*score));
3087+ matches
3088+ .into_iter()
3089+ .map(|(name, _)| (0.., name.into()))
30823090 .collect()
30833091 } else {
30843092 let part = parts.last().unwrap();