vim lifecycle (#7647)
Release Notes: - Fixed :0 and :% in vim mode ([#4303](https://github.com/zed-industries/zed/issues/4303)). - Improved keymap loading to not load vim key bindings unless vim is enabled **or** - N/A
This commit is contained in:
parent
a159183f52
commit
bd882c66d6
7 changed files with 103 additions and 118 deletions
|
@ -1,5 +1,4 @@
|
|||
use gpui::{div, Element, Render, Subscription, ViewContext};
|
||||
use settings::SettingsStore;
|
||||
use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView};
|
||||
|
||||
use crate::{state::Mode, Vim};
|
||||
|
@ -7,20 +6,16 @@ use crate::{state::Mode, Vim};
|
|||
/// The ModeIndicator displays the current mode in the status bar.
|
||||
pub struct ModeIndicator {
|
||||
pub(crate) mode: Option<Mode>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
_subscription: Subscription,
|
||||
}
|
||||
|
||||
impl ModeIndicator {
|
||||
/// Construct a new mode indicator in this window.
|
||||
pub fn new(cx: &mut ViewContext<Self>) -> Self {
|
||||
let _subscriptions = vec![
|
||||
cx.observe_global::<Vim>(|this, cx| this.update_mode(cx)),
|
||||
cx.observe_global::<SettingsStore>(|this, cx| this.update_mode(cx)),
|
||||
];
|
||||
|
||||
let _subscription = cx.observe_global::<Vim>(|this, cx| this.update_mode(cx));
|
||||
let mut this = Self {
|
||||
mode: None,
|
||||
_subscriptions,
|
||||
_subscription,
|
||||
};
|
||||
this.update_mode(cx);
|
||||
this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue