refactor(cli): vim mode is a config key only — drop the /vim slash command

Maintainer ruling: no new slash command for this. `display.vim_mode: true`
in config.yaml enables vi keybindings in the composer at startup; the
NORMAL/INSERT/REPLACE status-bar label stays. Removes the CommandDef, the
handler, its dispatch-table entry and slash-command docs; documents the key
under Display Settings.
This commit is contained in:
teknium1
2026-09-12 19:18:24 -07:00
committed by Teknium
parent 4f03480787
commit 08a2e7dbcc
8 changed files with 16 additions and 87 deletions
-1
View File
@@ -18,7 +18,6 @@ OLD_CHAIN_COMMANDS = [
"blueprint", "curator", "kanban", "skills", "learn", "init", "memory",
"platforms", "status", "context", "egress", "statusbar", "diff", "battery",
"timestamps", "verbose", "focus", "footer", "yolo", "approvals", "reasoning",
"vim",
"fast", "compress", "usage", "subscription", "topup", "insights", "copy",
"debug", "update", "version", "paste", "image", "reload", "reload-mcp",
"reload-skills", "bundles", "browser", "plugins", "rollback", "snapshot",
+10 -44
View File
@@ -1,8 +1,7 @@
"""Tests for the /vim CLI command and display.vim_mode config handling."""
"""display.vim_mode: config-only vi keybindings for the CLI composer."""
import unittest
from types import SimpleNamespace
from unittest.mock import patch
from prompt_toolkit.enums import EditingMode
@@ -13,48 +12,6 @@ def _import_cli():
return cli_mod
class TestHandleVimCommand(unittest.TestCase):
"""/vim toggles vi editing mode, persists it, and applies it live."""
def _make_cli(self, vim_mode=False, app=None):
return SimpleNamespace(
_vim_mode=vim_mode,
_app=app,
_console_print=lambda *a, **k: None,
)
def test_toggle_persists_and_applies_to_running_app(self):
cli_mod = _import_cli()
app = SimpleNamespace(editing_mode=EditingMode.EMACS)
stub = self._make_cli(vim_mode=False, app=app)
with patch.object(cli_mod, "save_config_value") as mock_save:
cli_mod.HermesCLI._handle_vim_command(stub, "/vim")
self.assertTrue(stub._vim_mode)
self.assertEqual(app.editing_mode, EditingMode.VI)
mock_save.assert_called_once_with("display.vim_mode", True)
with patch.object(cli_mod, "save_config_value") as mock_save:
cli_mod.HermesCLI._handle_vim_command(stub, "/vim off")
self.assertFalse(stub._vim_mode)
self.assertEqual(app.editing_mode, EditingMode.EMACS)
mock_save.assert_called_once_with("display.vim_mode", False)
def test_status_and_invalid_args_change_nothing(self):
cli_mod = _import_cli()
printed = []
stub = self._make_cli(vim_mode=True)
stub._console_print = lambda msg: printed.append(str(msg))
with patch.object(cli_mod, "save_config_value") as mock_save:
cli_mod.HermesCLI._handle_vim_command(stub, "/vim status")
cli_mod.HermesCLI._handle_vim_command(stub, "/vim sideways")
mock_save.assert_not_called()
self.assertTrue(stub._vim_mode)
self.assertIn("Usage", " ".join(printed))
class TestVimModeLabel(unittest.TestCase):
"""The status-bar label reflects the live vi input mode; off/no-app yields empty."""
@@ -76,5 +33,14 @@ class TestVimModeLabel(unittest.TestCase):
self.assertEqual(cli_mod.HermesCLI._vim_mode_label(stub), "REPLACE")
class TestNoSlashCommand(unittest.TestCase):
"""vim_mode is a config key only: no /vim command is registered."""
def test_vim_not_in_command_registry(self):
from hermes_cli.commands import COMMAND_REGISTRY
self.assertNotIn("vim", {c.name for c in COMMAND_REGISTRY})
if __name__ == "__main__":
unittest.main()