(args: str, context: CommandContext)
| 27 | |
| 28 | |
| 29 | def vim_command_call(args: str, context: CommandContext) -> LocalCommandResult: |
| 30 | from src.config import _get_default_manager, load_config |
| 31 | |
| 32 | current = load_config().get("editorMode") or "normal" |
| 33 | if current == "emacs": # TS back-compat: treat 'emacs' as 'normal' |
| 34 | current = "normal" |
| 35 | new_mode = "vim" if current == "normal" else "normal" |
| 36 | _get_default_manager().set_global("editorMode", new_mode) |
| 37 | |
| 38 | if new_mode == "vim": |
| 39 | suffix = "Use Escape key to toggle between INSERT and NORMAL modes." |
| 40 | else: |
| 41 | suffix = "Using standard (readline) keyboard bindings." |
| 42 | # Divergence from TS (which applies the toggle live): the trailing note keeps the |
| 43 | # mid-session instruction honest — the seed is read at PromptInput construction. |
| 44 | return LocalCommandResult( |
| 45 | type="text", |
| 46 | value=f"Editor mode set to {new_mode}. {suffix} Takes effect on next TUI launch.", |
| 47 | ) |
| 48 | |
| 49 | |
| 50 | VIM_COMMAND = LocalCommand( |
nothing calls this directly
no test coverage detected