MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / vim_command_call

Function vim_command_call

src/command_system/vim_command.py:29–47  ·  view source on GitHub ↗
(args: str, context: CommandContext)

Source from the content-addressed store, hash-verified

27
28
29def 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
50VIM_COMMAND = LocalCommand(

Callers

nothing calls this directly

Calls 5

load_configFunction · 0.90
_get_default_managerFunction · 0.90
LocalCommandResultClass · 0.85
getMethod · 0.45
set_globalMethod · 0.45

Tested by

no test coverage detected