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
|
@ -2,7 +2,7 @@ use gpui::{div, Element, Render, Subscription, View, ViewContext, WeakView};
|
|||
use itertools::Itertools;
|
||||
use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView};
|
||||
|
||||
use crate::{Vim, VimEvent};
|
||||
use crate::{Vim, VimEvent, VimGlobals};
|
||||
|
||||
/// The ModeIndicator displays the current mode in the status bar.
|
||||
pub struct ModeIndicator {
|
||||
|
@ -68,14 +68,22 @@ impl ModeIndicator {
|
|||
|
||||
let vim = vim.read(cx);
|
||||
recording
|
||||
.chain(vim.pre_count.map(|count| format!("{}", count)))
|
||||
.chain(
|
||||
cx.global::<VimGlobals>()
|
||||
.pre_count
|
||||
.map(|count| format!("{}", count)),
|
||||
)
|
||||
.chain(vim.selected_register.map(|reg| format!("\"{reg}")))
|
||||
.chain(
|
||||
vim.operator_stack
|
||||
.iter()
|
||||
.map(|item| item.status().to_string()),
|
||||
)
|
||||
.chain(vim.post_count.map(|count| format!("{}", count)))
|
||||
.chain(
|
||||
cx.global::<VimGlobals>()
|
||||
.post_count
|
||||
.map(|count| format!("{}", count)),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.join("")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue