Add support for resizing panes using vim motions (#21038)
Closes #8628 Release Notes: - Added support for resizing the current pane using vim keybinds with the intention to follow the functionality of vim - "ctrl-w +" to make a pane taller - "ctrl-w -" to make the pane shorter - "ctrl-w >" to make a pane wider - "ctrl-w <" to make the pane narrower - Changed vim pre_count and post_count to globals to allow for other crates to use the vim count. In this case, it allows for resizing by more than one unit. For example, "10 ctrl-w -" will decrease the height of the pane 10 times more than "ctrl-w -" - This pr does **not** add keybinds for making all panes in an axis equal size and does **not** add support for resizing docks. This is mentioned because these could be implied by the original issue --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
d75d34576a
commit
f702575255
25 changed files with 251 additions and 68 deletions
|
@ -538,9 +538,8 @@ impl Vim {
|
|||
}
|
||||
|
||||
pub fn select_next(&mut self, _: &SelectNext, cx: &mut ViewContext<Self>) {
|
||||
let count = self
|
||||
.take_count(cx)
|
||||
.unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });
|
||||
let count =
|
||||
Vim::take_count(cx).unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });
|
||||
self.update_editor(cx, |_, editor, cx| {
|
||||
editor.set_clip_at_line_ends(false, cx);
|
||||
for _ in 0..count {
|
||||
|
@ -556,9 +555,8 @@ impl Vim {
|
|||
}
|
||||
|
||||
pub fn select_previous(&mut self, _: &SelectPrevious, cx: &mut ViewContext<Self>) {
|
||||
let count = self
|
||||
.take_count(cx)
|
||||
.unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });
|
||||
let count =
|
||||
Vim::take_count(cx).unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });
|
||||
self.update_editor(cx, |_, editor, cx| {
|
||||
for _ in 0..count {
|
||||
if editor
|
||||
|
@ -573,7 +571,7 @@ impl Vim {
|
|||
}
|
||||
|
||||
pub fn select_match(&mut self, direction: Direction, cx: &mut ViewContext<Self>) {
|
||||
let count = self.take_count(cx).unwrap_or(1);
|
||||
let count = Vim::take_count(cx).unwrap_or(1);
|
||||
let Some(pane) = self.pane(cx) else {
|
||||
return;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue