mirror of
https://github.com/nushell/reedline.git
synced 2024-09-11 15:55:50 +03:00
Vi mode add support for d0, d^, c0, and c^ (#459)
* Vi mode add support for d0, d^, c0, and c^ Also changes d$ to delete just current line for multiline inputs * Make `d0` line aware * Make `c0` line aware Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
parent
f4aa6921b4
commit
b750db6516
@ -278,7 +278,7 @@ impl Command {
|
|||||||
) -> Option<Vec<ReedlineOption>> {
|
) -> Option<Vec<ReedlineOption>> {
|
||||||
let edits = match self {
|
let edits = match self {
|
||||||
Self::Delete => match motion {
|
Self::Delete => match motion {
|
||||||
Motion::End => Some(vec![ReedlineOption::Edit(EditCommand::CutToEnd)]),
|
Motion::End => Some(vec![ReedlineOption::Edit(EditCommand::CutToLineEnd)]),
|
||||||
Motion::Line => Some(vec![ReedlineOption::Edit(EditCommand::CutCurrentLine)]),
|
Motion::Line => Some(vec![ReedlineOption::Edit(EditCommand::CutCurrentLine)]),
|
||||||
Motion::NextWord => {
|
Motion::NextWord => {
|
||||||
Some(vec![ReedlineOption::Edit(EditCommand::CutWordRightToNext)])
|
Some(vec![ReedlineOption::Edit(EditCommand::CutWordRightToNext)])
|
||||||
@ -306,7 +306,7 @@ impl Command {
|
|||||||
Motion::LeftBefore(c) => {
|
Motion::LeftBefore(c) => {
|
||||||
Some(vec![ReedlineOption::Edit(EditCommand::CutLeftBefore(*c))])
|
Some(vec![ReedlineOption::Edit(EditCommand::CutLeftBefore(*c))])
|
||||||
}
|
}
|
||||||
Motion::Start => None,
|
Motion::Start => Some(vec![ReedlineOption::Edit(EditCommand::CutFromLineStart)]),
|
||||||
},
|
},
|
||||||
Self::Change => match motion {
|
Self::Change => match motion {
|
||||||
Motion::End => Some(vec![
|
Motion::End => Some(vec![
|
||||||
@ -358,7 +358,10 @@ impl Command {
|
|||||||
ReedlineOption::Edit(EditCommand::CutLeftBefore(*c)),
|
ReedlineOption::Edit(EditCommand::CutLeftBefore(*c)),
|
||||||
ReedlineOption::Event(ReedlineEvent::Repaint),
|
ReedlineOption::Event(ReedlineEvent::Repaint),
|
||||||
]),
|
]),
|
||||||
Motion::Start => None,
|
Motion::Start => Some(vec![
|
||||||
|
ReedlineOption::Edit(EditCommand::CutFromLineStart),
|
||||||
|
ReedlineOption::Event(ReedlineEvent::Repaint),
|
||||||
|
]),
|
||||||
},
|
},
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ where
|
|||||||
let _ = input.next();
|
let _ = input.next();
|
||||||
Some(Motion::Line)
|
Some(Motion::Line)
|
||||||
}
|
}
|
||||||
Some('0') => {
|
Some('0' | '^') => {
|
||||||
let _ = input.next();
|
let _ = input.next();
|
||||||
Some(Motion::Start)
|
Some(Motion::Start)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user