@@ -26,6 +26,7 @@ use helix_view::{
28use anyhow::{anyhow, bail, ensure, Context as _};
28use anyhow::{anyhow, bail, ensure, Context as _};
29+use fuzzy_matcher::FuzzyMatcher;
29use helix_lsp::{
30use helix_lsp::{
30 block_on, lsp,
31 block_on, lsp,
31 util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
32 util::{lsp_pos_to_pos, lsp_range_to_range, pos_to_lsp_pos, range_to_lsp_range},
@@ -3064,6 +3065,9 @@ fn command_mode(cx: &mut Context) {
3064 ":".into(),
3065 ":".into(),
3065 Some(':'),
3066 Some(':'),
3066 |input: &str| {
3067 |input: &str| {
3068+ static FUZZY_MATCHER: Lazy<fuzzy_matcher::skim::SkimMatcherV2> =
3069+ Lazy::new(fuzzy_matcher::skim::SkimMatcherV2::default);
3067 // we use .this over split_whitespace() because we care about empty segments
3071 // we use .this over split_whitespace() because we care about empty segments
3068 let parts = input.split(' ').collect::<Vec<&str>>();
3072 let parts = input.split(' ').collect::<Vec<&str>>();
@@ -3073,7 +3077,7 @@ fn command_mode(cx: &mut Context) {
3073 let end = 0..;
3077 let end = 0..;
3074 cmd::TYPABLE_COMMAND_LIST
3078 cmd::TYPABLE_COMMAND_LIST
3076− .filter(|command| command.name.contains(input))
3080+ .filter(|command| FUZZY_MATCHER.fuzzy_match(command.name, input).is_some())
3077 .map(|command| (end.clone(), Cow::Borrowed(command.name)))
3081 .map(|command| (end.clone(), Cow::Borrowed(command.name)))
3078 .collect()
3082 .collect()
3079 } else {
3083 } else {