Create a different object operator rather than pushing two operators on one input
This commit is contained in:
parent
11cfb88b36
commit
ec621c60e0
4 changed files with 24 additions and 20 deletions
|
@ -528,7 +528,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"context": "vim_operator == a || vim_operator == i || vim_operator == cs",
|
"context": "vim_operator == a || vim_operator == i || vim_operator == cs || vim_operator == helix_next || vim_operator == helix_previous",
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"w": "vim::Word",
|
"w": "vim::Word",
|
||||||
"shift-w": ["vim::Word", { "ignore_punctuation": true }],
|
"shift-w": ["vim::Word", { "ignore_punctuation": true }],
|
||||||
|
|
|
@ -498,14 +498,16 @@ impl Vim {
|
||||||
Some(Operator::HelixMatch) => {
|
Some(Operator::HelixMatch) => {
|
||||||
self.select_current_object(object, around, window, cx)
|
self.select_current_object(object, around, window, cx)
|
||||||
}
|
}
|
||||||
Some(Operator::SelectNext) => self.select_next_object(object, around, window, cx),
|
|
||||||
Some(Operator::SelectPrevious) => {
|
|
||||||
self.select_previous_object(object, around, window, cx)
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
// Can't do anything for namespace operators. Ignoring
|
// Can't do anything for namespace operators. Ignoring
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Some(Operator::HelixNext { around }) => {
|
||||||
|
self.select_next_object(object, around, window, cx);
|
||||||
|
}
|
||||||
|
Some(Operator::HelixPrevious { around }) => {
|
||||||
|
self.select_previous_object(object, around, window, cx);
|
||||||
|
}
|
||||||
Some(Operator::DeleteSurrounds) => {
|
Some(Operator::DeleteSurrounds) => {
|
||||||
waiting_operator = Some(Operator::DeleteSurrounds);
|
waiting_operator = Some(Operator::DeleteSurrounds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,12 @@ pub enum Operator {
|
||||||
ReplaceWithRegister,
|
ReplaceWithRegister,
|
||||||
Exchange,
|
Exchange,
|
||||||
HelixMatch,
|
HelixMatch,
|
||||||
SelectNext,
|
HelixNext {
|
||||||
SelectPrevious,
|
around: bool,
|
||||||
|
},
|
||||||
|
HelixPrevious {
|
||||||
|
around: bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
#[derive(Default, Clone, Debug)]
|
||||||
|
@ -1028,8 +1032,8 @@ impl Operator {
|
||||||
Operator::ReplayRegister => "@",
|
Operator::ReplayRegister => "@",
|
||||||
Operator::ToggleComments => "gc",
|
Operator::ToggleComments => "gc",
|
||||||
Operator::HelixMatch => "helix_m",
|
Operator::HelixMatch => "helix_m",
|
||||||
Operator::SelectNext { .. } => "helix_]",
|
Operator::HelixNext { .. } => "helix_next",
|
||||||
Operator::SelectPrevious { .. } => "helix_[",
|
Operator::HelixPrevious { .. } => "helix_previous",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,8 +1048,8 @@ impl Operator {
|
||||||
Operator::AutoIndent => "=".to_string(),
|
Operator::AutoIndent => "=".to_string(),
|
||||||
Operator::ShellCommand => "=".to_string(),
|
Operator::ShellCommand => "=".to_string(),
|
||||||
Operator::HelixMatch => "m".to_string(),
|
Operator::HelixMatch => "m".to_string(),
|
||||||
Operator::SelectNext => "]".to_string(),
|
Operator::HelixNext { .. } => "]".to_string(),
|
||||||
Operator::SelectPrevious => "[".to_string(),
|
Operator::HelixPrevious { .. } => "[".to_string(),
|
||||||
_ => self.id().to_string(),
|
_ => self.id().to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1086,8 +1090,8 @@ impl Operator {
|
||||||
| Operator::OppositeCase
|
| Operator::OppositeCase
|
||||||
| Operator::ToggleComments
|
| Operator::ToggleComments
|
||||||
| Operator::HelixMatch
|
| Operator::HelixMatch
|
||||||
| Operator::SelectNext { .. }
|
| Operator::HelixNext { .. }
|
||||||
| Operator::SelectPrevious { .. } => false,
|
| Operator::HelixPrevious { .. } => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,8 +1116,8 @@ impl Operator {
|
||||||
| Operator::ChangeSurrounds { target: None }
|
| Operator::ChangeSurrounds { target: None }
|
||||||
| Operator::DeleteSurrounds
|
| Operator::DeleteSurrounds
|
||||||
| Operator::Exchange
|
| Operator::Exchange
|
||||||
| Operator::SelectNext { .. }
|
| Operator::HelixNext { .. }
|
||||||
| Operator::SelectPrevious { .. } => true,
|
| Operator::HelixPrevious { .. } => true,
|
||||||
Operator::Yank
|
Operator::Yank
|
||||||
| Operator::Object { .. }
|
| Operator::Object { .. }
|
||||||
| Operator::FindForward { .. }
|
| Operator::FindForward { .. }
|
||||||
|
|
|
@ -785,19 +785,17 @@ impl Vim {
|
||||||
vim.push_operator(Operator::HelixMatch, window, cx)
|
vim.push_operator(Operator::HelixMatch, window, cx)
|
||||||
});
|
});
|
||||||
Vim::action(editor, cx, |vim, action: &PushHelixNext, window, cx| {
|
Vim::action(editor, cx, |vim, action: &PushHelixNext, window, cx| {
|
||||||
vim.push_operator(Operator::SelectNext, window, cx);
|
|
||||||
vim.push_operator(
|
vim.push_operator(
|
||||||
Operator::Object {
|
Operator::HelixNext {
|
||||||
around: action.around,
|
around: action.around,
|
||||||
},
|
},
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
);
|
||||||
});
|
});
|
||||||
Vim::action(editor, cx, |vim, action: &PushHelixPrevious, window, cx| {
|
Vim::action(editor, cx, |vim, action: &PushHelixPrevious, window, cx| {
|
||||||
vim.push_operator(Operator::SelectPrevious, window, cx);
|
|
||||||
vim.push_operator(
|
vim.push_operator(
|
||||||
Operator::Object {
|
Operator::HelixPrevious {
|
||||||
around: action.around,
|
around: action.around,
|
||||||
},
|
},
|
||||||
window,
|
window,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue