feat(cli): add display.vim_mode config and register /vim command

Introduces the opt-in surface for vi editing in the input composer:

- display.vim_mode config default (False, so existing users are
  unaffected and prompt_toolkit keeps its standard emacs bindings)
- /vim command registered with on|off|status subcommands, matching
  the established /battery and /timestamps pattern

Part of #4254.
This commit is contained in:
Sam Foreman
2026-08-28 14:12:33 -05:00
committed by Teknium
parent 63584da036
commit 2a5373da2c
2 changed files with 6 additions and 0 deletions

View File

@@ -163,6 +163,9 @@ COMMAND_REGISTRY: list[CommandDef] = [
CommandDef("battery", "Toggle a color-coded battery indicator in the status bar",
"Configuration", cli_only=True, args_hint="[on|off|status]",
subcommands=("on", "off", "status")),
CommandDef("vim", "Toggle vim keybindings in the input composer",
"Configuration", cli_only=True, args_hint="[on|off|status]",
subcommands=("on", "off", "status")),
CommandDef("timestamps", "Toggle [HH:MM] timestamps on messages and /history", "Configuration",
cli_only=True, args_hint="[on|off|status]",
subcommands=("on", "off", "status"), aliases=("ts",)),

View File

@@ -837,6 +837,9 @@ DEFAULT_CONFIG = {
# fights terminal auto-scroll in non-fullscreen mode.
# See #45592.
"cli_refresh_interval": 1.0,
# Vi/vim keybindings in the CLI input composer (toggled by /vim).
# Off by default, preserving prompt_toolkit's standard emacs bindings.
"vim_mode": False,
"user_message_preview": { # CLI: submitted user-message lines echoed to scrollback
"first_lines": 2,
"last_lines": 2,