support vim replace command with range (#10709)
Release Notes: - Added support for line ranges in vim replace commands #9428 - not supporting anything other than bare line numbers right now - ~need to figure out how to show range in question in search bar~ @ConradIrwin implemented showing a highlight of the selected range for a short direction instead - ~tests lol~
This commit is contained in:
parent
0697b417a0
commit
bc736265be
6 changed files with 160 additions and 12 deletions
|
@ -8,7 +8,7 @@ use crate::{
|
|||
motion::{EndOfDocument, Motion, StartOfDocument},
|
||||
normal::{
|
||||
move_cursor,
|
||||
search::{FindCommand, ReplaceCommand},
|
||||
search::{range_regex, FindCommand, ReplaceCommand},
|
||||
JoinLines,
|
||||
},
|
||||
state::Mode,
|
||||
|
@ -340,6 +340,14 @@ pub fn command_interceptor(mut query: &str, cx: &AppContext) -> Option<CommandIn
|
|||
)
|
||||
} else if let Ok(line) = query.parse::<u32>() {
|
||||
(query, GoToLine { line }.boxed_clone())
|
||||
} else if range_regex().is_match(query) {
|
||||
(
|
||||
query,
|
||||
ReplaceCommand {
|
||||
query: query.to_string(),
|
||||
}
|
||||
.boxed_clone(),
|
||||
)
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue