Add command aliases (#14826)
Co-Authored-By: <tobbe@tlundberg.com> Release Notes: - Added `"command_aliases"` setting to let you abbreviate commands
This commit is contained in:
parent
b22718e643
commit
1dc4d4200f
5 changed files with 47 additions and 3 deletions
|
@ -4,15 +4,18 @@ mod vim_test_context;
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use collections::HashMap;
|
||||
use command_palette::CommandPalette;
|
||||
use editor::{display_map::DisplayRow, DisplayPoint};
|
||||
use futures::StreamExt;
|
||||
use gpui::{KeyBinding, Modifiers, MouseButton, TestAppContext};
|
||||
pub use neovim_backed_test_context::*;
|
||||
use settings::SettingsStore;
|
||||
pub use vim_test_context::*;
|
||||
|
||||
use indoc::indoc;
|
||||
use search::BufferSearchBar;
|
||||
use workspace::WorkspaceSettings;
|
||||
|
||||
use crate::{insert::NormalBefore, motion, state::Mode, ModeIndicator};
|
||||
|
||||
|
@ -1298,3 +1301,19 @@ async fn test_plus_minus(cx: &mut gpui::TestAppContext) {
|
|||
cx.simulate_shared_keystrokes("+").await;
|
||||
cx.shared_state().await.assert_matches();
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_command_alias(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
cx.update_global(|store: &mut SettingsStore, cx| {
|
||||
store.update_user_settings::<WorkspaceSettings>(cx, |s| {
|
||||
let mut aliases = HashMap::default();
|
||||
aliases.insert("Q".to_string(), "upper".to_string());
|
||||
s.command_aliases = Some(aliases)
|
||||
});
|
||||
});
|
||||
|
||||
cx.set_state("ˇhello world", Mode::Normal);
|
||||
cx.simulate_keystrokes(": Q");
|
||||
cx.set_state("ˇHello world", Mode::Normal);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue