diff --git a/crates/nu-cli/src/completions/completer.rs b/crates/nu-cli/src/completions/completer.rs index a5a7700572..da276fd3d7 100644 --- a/crates/nu-cli/src/completions/completer.rs +++ b/crates/nu-cli/src/completions/completer.rs @@ -37,7 +37,10 @@ impl NuCompleter { ) -> Vec { let config = self.engine_state.get_config(); - let mut options = CompletionOptions::default(); + let mut options = CompletionOptions { + case_sensitive: config.case_sensitive_completions, + ..Default::default() + }; if config.completion_algorithm == "fuzzy" { options.match_algorithm = MatchAlgorithm::Fuzzy; diff --git a/crates/nu-protocol/src/config.rs b/crates/nu-protocol/src/config.rs index 25792ad290..3d69c38a99 100644 --- a/crates/nu-protocol/src/config.rs +++ b/crates/nu-protocol/src/config.rs @@ -75,6 +75,7 @@ pub struct Config { pub buffer_editor: String, pub disable_table_indexes: bool, pub cd_with_abbreviations: bool, + pub case_sensitive_completions: bool, } impl Default for Config { @@ -105,6 +106,7 @@ impl Default for Config { buffer_editor: String::new(), disable_table_indexes: false, cd_with_abbreviations: false, + case_sensitive_completions: false, } } } @@ -311,7 +313,14 @@ impl Value { if let Ok(b) = value.as_bool() { config.cd_with_abbreviations = b; } else { - eprintln!("$config.disable_table_indexes is not a bool") + eprintln!("$config.cd_with_abbreviations is not a bool") + } + } + "case_sensitive_completions" => { + if let Ok(b) = value.as_bool() { + config.case_sensitive_completions = b; + } else { + eprintln!("$config.case_sensitive_completions is not a bool") } } x => { diff --git a/docs/sample_config/default_config.nu b/docs/sample_config/default_config.nu index cae01621b0..502afc8f52 100644 --- a/docs/sample_config/default_config.nu +++ b/docs/sample_config/default_config.nu @@ -199,6 +199,8 @@ let-env config = { shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue disable_table_indexes: false # set to true to remove the index column from tables cd_with_abbreviations: false # set to true to allow you to do things like cd s/o/f and nushell expand it to cd some/other/folder + case_sensitive_completions: false # set to true to enable case-sensitive completions + hooks: { pre_prompt: [{ $nothing # replace with source code to run before the prompt is shown