Skip to content

fix: use a bindable chord in keymap.conf's starter examples - #411

Merged
umputun merged 3 commits into
masterfrom
fix/keymap-starter-example
Aug 9, 2026
Merged

fix: use a bindable chord in keymap.conf's starter examples#411
umputun merged 3 commits into
masterfrom
fix/keymap-starter-example

Conversation

@umputun

@umputun umputun commented Aug 9, 2026

Copy link
Copy Markdown
Owner

the starter keymap.conf told the user to uncomment map cmd+shift+d toggle_split, and that line can never apply. cmd+shift+d is BuiltinAction.dashboard's default, so resolveBuiltinOverrides drops the override with chord conflicts with built-in 'dashboard'; map skipped. The example was fine when it was written and rotted when dashboard claimed the chord.

it is not a reserved chord, despite what the issue infers from strings: isReservedMonitorChord covers only Ctrl-Tab and Ctrl-1/2. The symptom is as reported, the cause is a plain built-in collision.

changes:

  • both map examples in ConfigPaths.starterKeymapConf() now use cmd+shift+l, the chord README already uses
  • one header sentence points at where a skipped line is reported, Settings ▸ Key Mapping and agtermctl keymap list
  • ConfigPathsTests.starterKeymapExamplesApplyWhenUncommented uncomments every starter map and command example, requires each to parse without diagnostics, and pins the number of surviving chords at 4. command examples rot the same way: validateCommands clears a custom shortcut a built-in has claimed
  • .claude/rules/keymap.md notes the rot class and the test that pins it

the guard was checked against all three failure shapes: the shipped cmd+shift+d, a built-in stealing a command example's chord, and an unparseable command chord (parseCommandLine absorbs that one as shell text with no diagnostic, so the test counts surviving shortcuts rather than parsed commands).

on the second half of the issue, the diagnostic text is already reachable. agtermctl keymap list prints every diagnostic with its line number, Settings ▸ Key Mapping lists them, and a reload posts a banner. Putting them in keymap.reload's own JSON is a control-API response change with skill and site mirrors, so it is not in this PR.

Fix #405

umputun added 3 commits August 9, 2026 04:10
cmd+shift+d is dashboard's default, so uncommenting the starter file's own
`map cmd+shift+d toggle_split` line lost the built-in collision and bound
nothing. Switch the examples to cmd+shift+l, the chord README already uses, and
pin every starter `map` example with a test that uncomments it and requires it
to parse clean and bind, so a future built-in claiming one fails there.

Also point the header at where a skipped line is reported: Settings > Key
Mapping and `agtermctl keymap list`.

Fix #405
A custom command's shortcut rots the same way a built-in map does:
validateCommands clears it when a built-in has claimed the chord. Collect
command examples too, match the verb by token so a tab-separated line still
counts, and pin the example count so one silently dropped from the guard fails.
parseCommandLine absorbs an unparseable first token as shell text with no
diagnostic, so a command example could satisfy the guard while binding
nothing. Count the shortcuts that survive instead, pinned at the two map
examples plus the two chorded command ones.
Copilot AI lite review requested due to automatic review settings August 9, 2026 17:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the shipped keymap.conf starter examples so they use a bindable chord (avoiding collisions with built-in defaults like dashboard), and adds a regression test to prevent starter examples from silently rotting as built-ins evolve.

Changes:

  • Update ConfigPaths.starterKeymapConf() starter map examples to use cmd+shift+l and add a header hint pointing users to where skipped/rejected lines are reported.
  • Add a test that uncomments and validates all starter map/command examples, and asserts the expected number of surviving bound chords.
  • Document the “starter example rot” class and the new guard test in .claude/rules/keymap.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
agtermCore/Sources/agtermCore/ConfigPaths.swift Updates starter keymap examples to a bindable chord and points users to diagnostics visibility (Settings ▸ Key Mapping, agtermctl keymap list).
agtermCore/Tests/agtermCoreTests/ConfigPathsTests.swift Adds a regression test to ensure starter examples parse cleanly and remain bindable when uncommented.
.claude/rules/keymap.md Notes the starter-example rot class and references the regression test that pins it.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +89 to +92
let verb = text.prefix { !$0.isWhitespace }
// `<` skips the two verb-syntax lines, which state a grammar rather than an example.
guard verb == "map" || verb == "command", !text.contains("<") else { return nil }
return String(text)
@umputun
umputun merged commit 9846869 into master Aug 9, 2026
9 checks passed
@umputun
umputun deleted the fix/keymap-starter-example branch August 9, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keymap.conf's own starter example (cmd+shift+d) is a reserved chord and is skipped

2 participants