opencode
opencode copied to clipboard
Document keybind implementation architecture
The codebase lacked documentation on keybind implementation locations and architecture. This adds comprehensive technical documentation.
Changes
-
KEYBINDS.md: Documents the three-layer keybind architecture
- Utility layer (
src/util/keybind.ts): Parsing/matching logic for keybind strings - Context layer (
src/cli/cmd/tui/context/keybind.tsx): Solid.js provider with leader key state management - Configuration layer (
src/config/config.ts): Zod schema defining 40+ configurable keybinds
- Utility layer (
-
Includes architecture diagram, usage patterns, all available keybinds with defaults, and guide for adding new keybinds
-
README.md: Added reference link to documentation
Example usage pattern documented:
import { useKeybind } from "@tui/context/keybind"
const keybind = useKeybind()
// Match keyboard events
if (keybind.match("app_exit", event)) {
// handle exit
}
// Display to user
const exitKey = keybind.print("app_exit") // "ctrl+c"
Original prompt
where are keybinds implemented?
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.