MCPcopy Index your code
hub / github.com/codeaashu/claude-code / filterReservedShortcuts

Function filterReservedShortcuts

src/keybindings/template.ts:18–34  ·  view source on GitHub ↗

* Filter out reserved shortcuts that cannot be rebound. * These would cause /doctor to warn, so we exclude them from the template.

(blocks: KeybindingBlock[])

Source from the content-addressed store, hash-verified

16 * These would cause /doctor to warn, so we exclude them from the template.
17 */
18function filterReservedShortcuts(blocks: KeybindingBlock[]): KeybindingBlock[] {
19 const reservedKeys = new Set(
20 NON_REBINDABLE.map(r => normalizeKeyForComparison(r.key)),
21 )
22
23 return blocks
24 .map(block => {
25 const filteredBindings: Record<string, string | null> = {}
26 for (const [key, action] of Object.entries(block.bindings)) {
27 if (!reservedKeys.has(normalizeKeyForComparison(key))) {
28 filteredBindings[key] = action
29 }
30 }
31 return { context: block.context, bindings: filteredBindings }
32 })
33 .filter(block => Object.keys(block.bindings).length > 0)
34}
35
36/**
37 * Generate a template keybindings.json file content.

Callers 1

Calls 4

entriesMethod · 0.80
keysMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected