fix(tui): support more Vim normal commands

This commit is contained in:
Jinghan Xu
2026-06-09 17:58:06 -07:00
parent 4a3eac2144
commit 1be1b7beb1
13 changed files with 1260 additions and 77 deletions
+18 -4
View File
@@ -224,6 +224,20 @@ pub struct TuiVimNormalKeymap {
pub move_line_start: Option<KeybindingsSpec>,
/// Move cursor to end of line (`$`).
pub move_line_end: Option<KeybindingsSpec>,
/// Begin a goto sequence (`g`, then `g` jumps to the top).
pub start_goto_sequence: Option<KeybindingsSpec>,
/// Move cursor to the end of the text (`G`).
pub jump_bottom: Option<KeybindingsSpec>,
/// Enter visual mode (`v`).
pub enter_visual: Option<KeybindingsSpec>,
/// Enter linewise visual mode (`V`).
pub enter_visual_line: Option<KeybindingsSpec>,
/// Undo the previous text edit (`u`).
pub undo: Option<KeybindingsSpec>,
/// Redo the previous undone edit (`Ctrl-R`).
pub redo: Option<KeybindingsSpec>,
/// Repeat the previous Vim normal-mode edit (`.`).
pub repeat_last_edit: Option<KeybindingsSpec>,
/// Delete character under cursor (`x`).
pub delete_char: Option<KeybindingsSpec>,
/// Delete character under cursor and enter insert mode (`s`).
@@ -248,10 +262,10 @@ pub struct TuiVimNormalKeymap {
/// Vim operator-pending keybindings for modal editing inside text areas.
///
/// This context is active only while waiting for a motion after `d` or `y`.
/// Repeating the operator key (`dd`, `yy`) targets the entire line. Pressing
/// `Esc` cancels the pending operator and returns to normal mode without
/// modifying text.
/// This context is active only while waiting for a motion after `d`, `y`, or
/// `c`. Repeating delete/yank (`dd`, `yy`) targets the entire line; change uses
/// the normal-mode change key (`cc`). Pressing `Esc` cancels the pending
/// operator and returns to normal mode without modifying text.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct TuiVimOperatorKeymap {
+71 -1
View File
@@ -2888,7 +2888,10 @@
"delete_char": null,
"delete_to_line_end": null,
"enter_insert": null,
"enter_visual": null,
"enter_visual_line": null,
"insert_line_start": null,
"jump_bottom": null,
"move_down": null,
"move_left": null,
"move_line_end": null,
@@ -2901,10 +2904,14 @@
"open_line_above": null,
"open_line_below": null,
"paste_after": null,
"redo": null,
"repeat_last_edit": null,
"start_change_operator": null,
"start_delete_operator": null,
"start_goto_sequence": null,
"start_yank_operator": null,
"substitute_char": null,
"undo": null,
"yank_line": null
},
"vim_operator": {
@@ -3579,7 +3586,10 @@
"delete_char": null,
"delete_to_line_end": null,
"enter_insert": null,
"enter_visual": null,
"enter_visual_line": null,
"insert_line_start": null,
"jump_bottom": null,
"move_down": null,
"move_left": null,
"move_line_end": null,
@@ -3592,10 +3602,14 @@
"open_line_above": null,
"open_line_below": null,
"paste_after": null,
"redo": null,
"repeat_last_edit": null,
"start_change_operator": null,
"start_delete_operator": null,
"start_goto_sequence": null,
"start_yank_operator": null,
"substitute_char": null,
"undo": null,
"yank_line": null
}
},
@@ -3895,6 +3909,22 @@
],
"description": "Enter insert mode at cursor (`i`)."
},
"enter_visual": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Enter visual mode (`v`)."
},
"enter_visual_line": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Enter linewise visual mode (`V`)."
},
"insert_line_start": {
"allOf": [
{
@@ -3903,6 +3933,14 @@
],
"description": "Enter insert mode at first non-blank of line (`I`)."
},
"jump_bottom": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Move cursor to the end of the text (`G`)."
},
"move_down": {
"allOf": [
{
@@ -3999,6 +4037,22 @@
],
"description": "Paste after cursor (`p`)."
},
"redo": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Redo the previous undone edit (`Ctrl-R`)."
},
"repeat_last_edit": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Repeat the previous Vim normal-mode edit (`.`)."
},
"start_change_operator": {
"allOf": [
{
@@ -4015,6 +4069,14 @@
],
"description": "Begin delete operator; next key selects motion (`d`)."
},
"start_goto_sequence": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Begin a goto sequence (`g`, then `g` jumps to the top)."
},
"start_yank_operator": {
"allOf": [
{
@@ -4031,6 +4093,14 @@
],
"description": "Delete character under cursor and enter insert mode (`s`)."
},
"undo": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Undo the previous text edit (`u`)."
},
"yank_line": {
"allOf": [
{
@@ -4044,7 +4114,7 @@
},
"TuiVimOperatorKeymap": {
"additionalProperties": false,
"description": "Vim operator-pending keybindings for modal editing inside text areas.\n\nThis context is active only while waiting for a motion after `d` or `y`. Repeating the operator key (`dd`, `yy`) targets the entire line. Pressing `Esc` cancels the pending operator and returns to normal mode without modifying text.",
"description": "Vim operator-pending keybindings for modal editing inside text areas.\n\nThis context is active only while waiting for a motion after `d`, `y`, or `c`. Repeating delete/yank (`dd`, `yy`) targets the entire line; change uses the normal-mode change key (`cc`). Pressing `Esc` cancels the pending operator and returns to normal mode without modifying text.",
"properties": {
"cancel": {
"allOf": [
+5 -2
View File
@@ -722,8 +722,11 @@ async fn wait_for_single_request(mock: &ResponseMock) -> ResponsesRequest {
async fn wait_for_file_removed(path: &Path) -> anyhow::Result<()> {
let deadline = Instant::now() + Duration::from_secs(10);
loop {
if !tokio::fs::try_exists(path).await? {
return Ok(());
match tokio::fs::try_exists(path).await {
Ok(false) => return Ok(()),
Ok(true) => {}
Err(err) if err.kind() == std::io::ErrorKind::PermissionDenied => {}
Err(err) => return Err(err.into()),
}
assert!(
Instant::now() < deadline,
@@ -1080,6 +1080,8 @@ impl ChatComposer {
.vim_mode_label()
.map(|label| match label {
"Normal" => "Vim: Normal".magenta(),
"Visual" => "Vim: Visual".cyan(),
"Visual Line" => "Vim: Visual Line".cyan(),
"Insert" => "Vim: Insert".green(),
_ => unreachable!(),
})
@@ -1643,6 +1645,17 @@ impl ChatComposer {
return self.handle_history_search_key(key_event);
}
if matches!(self.popups.active, ActivePopup::None)
&& self.draft.textarea.is_vim_normal_mode()
&& self.vim_normal_keymap.redo.is_pressed(key_event)
&& self.draft.textarea.can_redo_last_undo()
{
let result = self.handle_key_event_without_popup(key_event);
self.reset_vim_mode_after_successful_dispatch(&result.0);
self.sync_popups();
return result;
}
if Self::is_history_search_key(&key_event, &self.history_search_previous_keys) {
return self.begin_history_search();
}
@@ -3118,6 +3131,8 @@ impl ChatComposer {
self.vim_normal_keymap.move_down.is_pressed(key_event),
)
}
} else if self.draft.textarea.is_vim_modal_mode() {
(false, false)
} else {
(
self.editor_keymap.move_up.is_pressed(key_event),
@@ -5413,6 +5428,34 @@ mod tests {
assert!(!composer.footer.esc_backtrack_hint);
}
#[test]
fn vim_visual_mode_indicator_renders_without_panic() {
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
use crossterm::event::KeyModifiers;
let (tx, _rx) = unbounded_channel::<AppEvent>();
let sender = AppEventSender::new(tx);
let mut composer = ChatComposer::new(
/*has_input_focus*/ true,
sender,
/*enhanced_keys_supported*/ true,
"Ask Codex to do anything".to_string(),
/*disable_paste_burst*/ false,
);
composer.set_vim_enabled(/*enabled*/ true);
let (result, needs_redraw) =
composer.handle_key_event(KeyEvent::new(KeyCode::Char('v'), KeyModifiers::NONE));
assert!(matches!(result, InputResult::None));
assert!(needs_redraw);
assert_eq!(
composer.vim_mode_indicator_span(),
Some("Vim: Visual".cyan())
);
}
#[test]
fn slash_opens_command_popup_in_vim_normal_mode() {
use crossterm::event::KeyCode;
@@ -9596,6 +9639,57 @@ mod tests {
);
}
#[test]
fn vim_normal_ctrl_r_redoes_instead_of_opening_history_search() {
let (tx, _rx) = unbounded_channel::<AppEvent>();
let sender = AppEventSender::new(tx);
let mut composer = ChatComposer::new(
/*has_input_focus*/ true,
sender,
/*enhanced_keys_supported*/ false,
"Ask Codex to do anything".to_string(),
/*disable_paste_burst*/ false,
);
composer.draft.textarea.set_text_clearing_elements("abcd");
composer.draft.textarea.set_cursor(/*pos*/ 0);
composer.set_vim_enabled(/*enabled*/ true);
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char('x'), KeyModifiers::NONE));
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char('u'), KeyModifiers::NONE));
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char('r'), KeyModifiers::CONTROL));
assert_eq!(composer.draft.textarea.text(), "bcd");
assert!(composer.history_search.is_none());
}
#[test]
fn vim_visual_arrow_keys_do_not_navigate_history() {
let (tx, _rx) = unbounded_channel::<AppEvent>();
let sender = AppEventSender::new(tx);
let mut composer = ChatComposer::new(
/*has_input_focus*/ true,
sender,
/*enhanced_keys_supported*/ false,
"Ask Codex to do anything".to_string(),
/*disable_paste_burst*/ false,
);
type_chars_humanlike(&mut composer, &['f', 'i', 'r', 's', 't']);
let (result, _needs_redraw) =
composer.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
assert!(matches!(result, InputResult::Submitted { .. }));
composer.set_vim_enabled(/*enabled*/ true);
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char('k'), KeyModifiers::NONE));
assert_eq!(composer.draft.textarea.text(), "first");
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char('v'), KeyModifiers::NONE));
let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
assert_eq!(composer.draft.textarea.text(), "first");
assert_eq!(composer.draft.textarea.vim_mode_label(), Some("Visual"));
}
#[test]
fn remapped_vim_normal_history_navigation_does_not_fall_back_to_j_k() {
use crate::key_hint;
File diff suppressed because it is too large Load Diff
@@ -8,6 +8,10 @@ use std::ops::Range;
pub(super) enum VimMode {
/// Normal mode routes printable keys to movement, operators, and mode transitions.
Normal,
/// Visual mode extends a characterwise selection with normal-mode motions.
Visual,
/// Visual line mode extends a linewise selection with normal-mode motions.
VisualLine,
/// Insert mode routes input through the regular editor keymap until Escape is pressed.
Insert,
}
@@ -22,7 +26,9 @@ pub(super) enum VimOperator {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) enum VimPending {
None,
Goto,
Operator(VimOperator),
OperatorGoto(VimOperator),
TextObject {
operator: VimOperator,
scope: VimTextObjectScope,
@@ -40,6 +46,16 @@ pub(super) enum VimMotion {
WordEnd,
LineStart,
LineEnd,
BufferStart,
BufferEnd,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(super) enum VimRepeatEdit {
DeleteChar,
DeleteLine,
DeleteMotion(VimMotion),
PasteAfter,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+216 -5
View File
@@ -159,6 +159,13 @@ pub(crate) struct VimNormalKeymap {
pub(crate) move_word_end: Vec<KeyBinding>,
pub(crate) move_line_start: Vec<KeyBinding>,
pub(crate) move_line_end: Vec<KeyBinding>,
pub(crate) start_goto_sequence: Vec<KeyBinding>,
pub(crate) jump_bottom: Vec<KeyBinding>,
pub(crate) enter_visual: Vec<KeyBinding>,
pub(crate) enter_visual_line: Vec<KeyBinding>,
pub(crate) undo: Vec<KeyBinding>,
pub(crate) redo: Vec<KeyBinding>,
pub(crate) repeat_last_edit: Vec<KeyBinding>,
pub(crate) delete_char: Vec<KeyBinding>,
pub(crate) substitute_char: Vec<KeyBinding>,
pub(crate) delete_to_line_end: Vec<KeyBinding>,
@@ -171,12 +178,13 @@ pub(crate) struct VimNormalKeymap {
pub(crate) cancel_operator: Vec<KeyBinding>,
}
/// Vim operator-pending keybindings active after `d` or `y` in normal mode.
/// Vim operator-pending keybindings active after `d`, `y`, or `c` in normal mode.
///
/// When an operator (`start_delete_operator` or `start_yank_operator`) is
/// pressed, the next keypress is matched against this context to determine the
/// motion range. Repeating the operator key (`dd`, `yy`) acts on the whole
/// line. `Esc` cancels the pending operator and returns to normal mode.
/// When an operator (`start_delete_operator`, `start_yank_operator`, or
/// `start_change_operator`) is pressed, the next keypress is matched against
/// this context to determine the motion range. Repeating delete/yank (`dd`,
/// `yy`) acts on the whole line; change uses the normal-mode change key
/// (`cc`). `Esc` cancels the pending operator and returns to normal mode.
#[derive(Clone, Debug, Default)]
pub(crate) struct VimOperatorKeymap {
pub(crate) delete_line: Vec<KeyBinding>,
@@ -496,6 +504,13 @@ impl RuntimeKeymap {
move_word_end: resolve_local!(keymap, defaults, vim_normal, move_word_end),
move_line_start: resolve_local!(keymap, defaults, vim_normal, move_line_start),
move_line_end: resolve_local!(keymap, defaults, vim_normal, move_line_end),
start_goto_sequence: resolve_local!(keymap, defaults, vim_normal, start_goto_sequence),
jump_bottom: resolve_local!(keymap, defaults, vim_normal, jump_bottom),
enter_visual: resolve_local!(keymap, defaults, vim_normal, enter_visual),
enter_visual_line: resolve_local!(keymap, defaults, vim_normal, enter_visual_line),
undo: resolve_local!(keymap, defaults, vim_normal, undo),
redo: resolve_local!(keymap, defaults, vim_normal, redo),
repeat_last_edit: resolve_local!(keymap, defaults, vim_normal, repeat_last_edit),
delete_char: resolve_local!(keymap, defaults, vim_normal, delete_char),
substitute_char: resolve_local!(keymap, defaults, vim_normal, substitute_char),
delete_to_line_end: resolve_local!(keymap, defaults, vim_normal, delete_to_line_end),
@@ -579,10 +594,36 @@ impl RuntimeKeymap {
keymap.vim_normal.move_line_end.as_ref(),
vim_normal.move_line_end.as_slice(),
),
(
keymap.vim_normal.start_goto_sequence.as_ref(),
vim_normal.start_goto_sequence.as_slice(),
),
(
keymap.vim_normal.jump_bottom.as_ref(),
vim_normal.jump_bottom.as_slice(),
),
(
keymap.vim_normal.enter_visual.as_ref(),
vim_normal.enter_visual.as_slice(),
),
(
keymap.vim_normal.enter_visual_line.as_ref(),
vim_normal.enter_visual_line.as_slice(),
),
(keymap.vim_normal.undo.as_ref(), vim_normal.undo.as_slice()),
(keymap.vim_normal.redo.as_ref(), vim_normal.redo.as_slice()),
(
keymap.vim_normal.repeat_last_edit.as_ref(),
vim_normal.repeat_last_edit.as_slice(),
),
(
keymap.vim_normal.delete_char.as_ref(),
vim_normal.delete_char.as_slice(),
),
(
keymap.vim_normal.substitute_char.as_ref(),
vim_normal.substitute_char.as_slice(),
),
(
keymap.vim_normal.change_to_line_end.as_ref(),
vim_normal.change_to_line_end.as_slice(),
@@ -627,6 +668,41 @@ impl RuntimeKeymap {
.substitute_char
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.start_goto_sequence.is_none() {
vim_normal
.start_goto_sequence
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.jump_bottom.is_none() {
vim_normal
.jump_bottom
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.enter_visual.is_none() {
vim_normal
.enter_visual
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.enter_visual_line.is_none() {
vim_normal
.enter_visual_line
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.undo.is_none() {
vim_normal
.undo
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.redo.is_none() {
vim_normal
.redo
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
if keymap.vim_normal.repeat_last_edit.is_none() {
vim_normal
.repeat_last_edit
.retain(|binding| !configured_vim_normal_bindings_to_preserve.contains(binding));
}
let mut vim_operator = VimOperatorKeymap {
delete_line: resolve_local!(keymap, defaults, vim_operator, delete_line),
@@ -1028,6 +1104,19 @@ impl RuntimeKeymap {
plain(KeyCode::Char('$')),
shift(KeyCode::Char('$'))
],
start_goto_sequence: default_bindings![plain(KeyCode::Char('g'))],
jump_bottom: default_bindings![
shift(KeyCode::Char('g')),
plain(KeyCode::Char('G'))
],
enter_visual: default_bindings![plain(KeyCode::Char('v'))],
enter_visual_line: default_bindings![
shift(KeyCode::Char('v')),
plain(KeyCode::Char('V'))
],
undo: default_bindings![plain(KeyCode::Char('u'))],
redo: default_bindings![ctrl(KeyCode::Char('r'))],
repeat_last_edit: default_bindings![plain(KeyCode::Char('.'))],
delete_char: default_bindings![plain(KeyCode::Char('x'))],
substitute_char: default_bindings![plain(KeyCode::Char('s'))],
delete_to_line_end: default_bindings![
@@ -1473,6 +1562,22 @@ impl RuntimeKeymap {
self.vim_normal.move_line_start.as_slice(),
),
("move_line_end", self.vim_normal.move_line_end.as_slice()),
(
"start_goto_sequence",
self.vim_normal.start_goto_sequence.as_slice(),
),
("jump_bottom", self.vim_normal.jump_bottom.as_slice()),
("enter_visual", self.vim_normal.enter_visual.as_slice()),
(
"enter_visual_line",
self.vim_normal.enter_visual_line.as_slice(),
),
("undo", self.vim_normal.undo.as_slice()),
("redo", self.vim_normal.redo.as_slice()),
(
"repeat_last_edit",
self.vim_normal.repeat_last_edit.as_slice(),
),
("delete_char", self.vim_normal.delete_char.as_slice()),
(
"substitute_char",
@@ -2462,6 +2567,93 @@ mod tests {
expect_conflict(&keymap, "move_left", "substitute_char");
}
#[test]
fn configured_vim_substitute_binding_prunes_new_undo_default() {
let mut keymap = TuiKeymap::default();
keymap.vim_normal.substitute_char = Some(one("u"));
let runtime = RuntimeKeymap::from_config(&keymap).expect("config should parse");
assert_eq!(
runtime.vim_normal.substitute_char,
vec![key_hint::plain(KeyCode::Char('u'))]
);
assert_eq!(runtime.vim_normal.undo, Vec::new());
}
#[test]
fn configured_legacy_vim_normal_bindings_prune_new_jump_defaults() {
let mut keymap = TuiKeymap::default();
keymap.vim_normal.move_left = Some(one("g"));
keymap.vim_normal.move_right = Some(one("shift-g"));
let runtime = RuntimeKeymap::from_config(&keymap).expect("config should parse");
assert_eq!(
runtime.vim_normal.move_left,
vec![key_hint::plain(KeyCode::Char('g'))]
);
assert_eq!(
runtime.vim_normal.move_right,
vec![key_hint::shift(KeyCode::Char('g'))]
);
assert_eq!(runtime.vim_normal.start_goto_sequence, Vec::new());
assert_eq!(
runtime.vim_normal.jump_bottom,
vec![key_hint::plain(KeyCode::Char('G'))]
);
}
#[test]
fn explicit_new_vim_normal_jump_bindings_still_conflict_with_legacy_binding() {
let mut keymap = TuiKeymap::default();
keymap.vim_normal.move_left = Some(one("g"));
keymap.vim_normal.start_goto_sequence = Some(one("g"));
expect_conflict(&keymap, "move_left", "start_goto_sequence");
keymap.vim_normal.start_goto_sequence = None;
keymap.vim_normal.move_left = Some(one("shift-g"));
keymap.vim_normal.jump_bottom = Some(one("shift-g"));
expect_conflict(&keymap, "move_left", "jump_bottom");
}
#[test]
fn configured_legacy_vim_normal_bindings_prune_new_visual_and_undo_defaults() {
let mut keymap = TuiKeymap::default();
keymap.vim_normal.move_left = Some(one("v"));
keymap.vim_normal.move_right = Some(one("u"));
let runtime = RuntimeKeymap::from_config(&keymap).expect("config should parse");
assert_eq!(
runtime.vim_normal.move_left,
vec![key_hint::plain(KeyCode::Char('v'))]
);
assert_eq!(
runtime.vim_normal.move_right,
vec![key_hint::plain(KeyCode::Char('u'))]
);
assert_eq!(runtime.vim_normal.enter_visual, Vec::new());
assert_eq!(runtime.vim_normal.undo, Vec::new());
}
#[test]
fn explicit_new_vim_normal_visual_and_undo_bindings_still_conflict_with_legacy_binding() {
let mut keymap = TuiKeymap::default();
keymap.vim_normal.move_left = Some(one("v"));
keymap.vim_normal.enter_visual = Some(one("v"));
expect_conflict(&keymap, "move_left", "enter_visual");
keymap.vim_normal.enter_visual = None;
keymap.vim_normal.move_left = Some(one("u"));
keymap.vim_normal.undo = Some(one("u"));
expect_conflict(&keymap, "move_left", "undo");
}
#[test]
fn configured_legacy_vim_operator_bindings_prune_new_text_object_defaults() {
let mut keymap = TuiKeymap::default();
@@ -2530,6 +2722,25 @@ mod tests {
key_hint::plain(KeyCode::Down)
]
);
assert_eq!(
runtime.vim_normal.start_goto_sequence,
vec![key_hint::plain(KeyCode::Char('g'))]
);
assert_eq!(
runtime.vim_normal.jump_bottom,
vec![
key_hint::shift(KeyCode::Char('g')),
key_hint::plain(KeyCode::Char('G'))
]
);
assert_eq!(
runtime.vim_normal.enter_visual,
vec![key_hint::plain(KeyCode::Char('v'))]
);
assert_eq!(
runtime.vim_normal.undo,
vec![key_hint::plain(KeyCode::Char('u'))]
);
}
#[test]
+21
View File
@@ -134,6 +134,13 @@ pub(super) const KEYMAP_ACTIONS: &[KeymapActionDescriptor] = &[
action("vim_normal", "Vim normal", "move_word_end", "Move to the end of the current or next word."),
action("vim_normal", "Vim normal", "move_line_start", "Move to the start of the line."),
action("vim_normal", "Vim normal", "move_line_end", "Move to the end of the line."),
action("vim_normal", "Vim normal", "start_goto_sequence", "Begin a goto sequence; pressing it again jumps to the top."),
action("vim_normal", "Vim normal", "jump_bottom", "Move to the end of the text."),
action("vim_normal", "Vim normal", "enter_visual", "Enter characterwise visual mode."),
action("vim_normal", "Vim normal", "enter_visual_line", "Enter linewise visual mode."),
action("vim_normal", "Vim normal", "undo", "Undo the previous text edit."),
action("vim_normal", "Vim normal", "redo", "Redo the previous undone text edit."),
action("vim_normal", "Vim normal", "repeat_last_edit", "Repeat the previous Vim edit."),
action("vim_normal", "Vim normal", "delete_char", "Delete the character under the cursor."),
action("vim_normal", "Vim normal", "substitute_char", "Delete the character under the cursor and enter insert mode."),
action("vim_normal", "Vim normal", "delete_to_line_end", "Delete from cursor to end of line."),
@@ -277,6 +284,13 @@ pub(super) fn binding_slot<'a>(
("vim_normal", "move_word_end") => Some(&mut keymap.vim_normal.move_word_end),
("vim_normal", "move_line_start") => Some(&mut keymap.vim_normal.move_line_start),
("vim_normal", "move_line_end") => Some(&mut keymap.vim_normal.move_line_end),
("vim_normal", "start_goto_sequence") => Some(&mut keymap.vim_normal.start_goto_sequence),
("vim_normal", "jump_bottom") => Some(&mut keymap.vim_normal.jump_bottom),
("vim_normal", "enter_visual") => Some(&mut keymap.vim_normal.enter_visual),
("vim_normal", "enter_visual_line") => Some(&mut keymap.vim_normal.enter_visual_line),
("vim_normal", "undo") => Some(&mut keymap.vim_normal.undo),
("vim_normal", "redo") => Some(&mut keymap.vim_normal.redo),
("vim_normal", "repeat_last_edit") => Some(&mut keymap.vim_normal.repeat_last_edit),
("vim_normal", "delete_char") => Some(&mut keymap.vim_normal.delete_char),
("vim_normal", "substitute_char") => Some(&mut keymap.vim_normal.substitute_char),
("vim_normal", "delete_to_line_end") => Some(&mut keymap.vim_normal.delete_to_line_end),
@@ -402,6 +416,13 @@ pub(super) fn bindings_for_action<'a>(
("vim_normal", "move_word_end") => Some(runtime_keymap.vim_normal.move_word_end.as_slice()),
("vim_normal", "move_line_start") => Some(runtime_keymap.vim_normal.move_line_start.as_slice()),
("vim_normal", "move_line_end") => Some(runtime_keymap.vim_normal.move_line_end.as_slice()),
("vim_normal", "start_goto_sequence") => Some(runtime_keymap.vim_normal.start_goto_sequence.as_slice()),
("vim_normal", "jump_bottom") => Some(runtime_keymap.vim_normal.jump_bottom.as_slice()),
("vim_normal", "enter_visual") => Some(runtime_keymap.vim_normal.enter_visual.as_slice()),
("vim_normal", "enter_visual_line") => Some(runtime_keymap.vim_normal.enter_visual_line.as_slice()),
("vim_normal", "undo") => Some(runtime_keymap.vim_normal.undo.as_slice()),
("vim_normal", "redo") => Some(runtime_keymap.vim_normal.redo.as_slice()),
("vim_normal", "repeat_last_edit") => Some(runtime_keymap.vim_normal.repeat_last_edit.as_slice()),
("vim_normal", "delete_char") => Some(runtime_keymap.vim_normal.delete_char.as_slice()),
("vim_normal", "substitute_char") => Some(runtime_keymap.vim_normal.substitute_char.as_slice()),
("vim_normal", "delete_to_line_end") => Some(runtime_keymap.vim_normal.delete_to_line_end.as_slice()),
@@ -5,7 +5,7 @@ expression: "render_picker(params, 120)"
Keymap
All configurable shortcuts.
108 actions, 1 customized, 2 unbound.
115 actions, 1 customized, 2 unbound.
[All] Common Customized (1) Unbound (2) App Composer Editor Vim Navigation Approval Debug
@@ -5,7 +5,7 @@ expression: "render_picker(params, 120)"
Keymap
All configurable shortcuts.
109 actions, 0 customized, 3 unbound.
116 actions, 0 customized, 3 unbound.
[All] Common Customized (0) Unbound (3) App Composer Editor Vim Navigation Approval Debug
@@ -2,14 +2,14 @@
source: tui/src/keymap_setup.rs
expression: snapshot
---
tab: All (108 selectable)
tab: All (115 selectable)
tab: Common (20 selectable)
tab: Customized (0) (0 selectable)
tab: Unbound (2) (2 selectable)
tab: App (10 selectable)
tab: Composer (5 selectable)
tab: Editor (17 selectable)
tab: Vim (48 selectable)
tab: Vim (55 selectable)
tab: Navigation (20 selectable)
tab: Approval (8 selectable)
tab: Debug (1 selectable)
@@ -5,7 +5,7 @@ expression: "render_picker(params, 78)"
Keymap
All configurable shortcuts.
108 actions, 0 customized, 2 unbound.
115 actions, 0 customized, 2 unbound.
[All] Common Customized (0) Unbound (2) App Composer Editor Vim
Navigation Approval Debug
@@ -5,7 +5,7 @@ expression: "render_picker(params, 120)"
Keymap
All configurable shortcuts.
108 actions, 0 customized, 2 unbound.
115 actions, 0 customized, 2 unbound.
[All] Common Customized (0) Unbound (2) App Composer Editor Vim Navigation Approval Debug