vim: Add highlighting to set commands (#28600)

|Before|After|
|--|--|

|![image](https://github.com/user-attachments/assets/fb965e1f-658c-4ecd-a51f-821881b8001a)|![image](https://github.com/user-attachments/assets/f05f73bf-6661-406a-a5d6-e121e5b6fd1a)|

Release Notes:

- N/A
This commit is contained in:
5brian 2025-04-11 18:03:05 -04:00 committed by GitHub
parent 141ad72d97
commit 730f2e7083
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -963,7 +963,15 @@ pub fn command_interceptor(mut input: &str, cx: &App) -> Vec<CommandInterceptRes
.boxed_clone(),
)
} else if query.starts_with("se ") || query.starts_with("set ") {
return VimOption::possible_commands(query.split_once(" ").unwrap().1);
let (prefix, option) = query.split_once(' ').unwrap();
let mut commands = VimOption::possible_commands(option);
if !commands.is_empty() {
let query = prefix.to_string() + " " + option;
for command in &mut commands {
command.positions = generate_positions(&command.string, &query);
}
}
return commands;
} else if query.starts_with('s') {
let mut substitute = "substitute".chars().peekable();
let mut query = query.chars().peekable();