@@ -22,8 +22,13 @@ import (
2222 // ---------------------------------------------------------------------------
2323
2424 func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
25+
2526 m.frameLines = nil // invalidate per-frame wrap cache
2627
28+ // Keybinds modal intercepts all input when open.
29+ if mdl, cmd, handled := m.updateKeybindsModal(msg); handled {
30+ return mdl, cmd
31+ }
2732 // File finder modal intercepts all input when open.
2833 if mdl, cmd, handled := m.updateFileModal(msg); handled {
2934 return mdl, cmd
@@ -206,6 +211,7 @@ func (m *Model) keyPressHandlers() map[string]func(*Model) (Model, tea.Cmd, bool
206211 "esc": (*Model).handleEsc,
207212 "enter": (*Model).handleEnter,
208213 "ctrl+f": (*Model).handleCtrlF,
214+ "ctrl+h": (*Model).handleCtrlH,
209215 }
210216 }
211217
@@ -262,6 +268,12 @@ func (m *Model) handleCtrlF() (Model, tea.Cmd, bool) {
262268 return Model{}, nil, false
263269 }
264270
271+func (m *Model) handleCtrlH() (Model, tea.Cmd, bool) {
272+ m.openKeybindsModal()
273+ return *m, nil, true
274+}
275+
276+
265277 // handleUserMsg records a user message in the DB and conversation display.
266278 func (m *Model) handleUserMsg(msg llmUserMsg) Model {
267279 now := time.Now()
@@ -844,9 +856,82 @@ func (m *Model) openFileModal() {
844856 SelBg: palette.Fg,
845857 Border: palette.Border,
846858 })
859+ md.WidthPct = 80
860+
847861 m.fileModal = &md
848862 }
849863
864+func (m *Model) openKeybindsModal() {
865+ items := []modal.Item{
866+ {Name: "ctrl+h", Desc: "keybinds"},
867+ {Name: "ctrl+f", Desc: "file search"},
868+ {Name: "ctrl+s", Desc: "send diff"},
869+ {Name: "ctrl+shift+c", Desc: "copy selection"},
870+ {Name: "ctrl+shift+v", Desc: "paste"},
871+ {Name: "ctrl+c", Desc: "quit"},
872+ {Name: "esc", Desc: "cancel/blur"},
873+ {Name: "enter", Desc: "send message"},
874+ {Name: "shift+enter", Desc: "newline in input"},
875+ {Name: "tab", Desc: "indent"},
876+ {Name: "backspace/ctrl+h", Desc: "delete backward"},
877+ {Name: "delete/ctrl+d", Desc: "delete forward"},
878+ {Name: "up/down/left/right", Desc: "move cursor"},
879+ {Name: "shift+arrows", Desc: "extend selection"},
880+ {Name: "home/end/ctrl+a/ctrl+e", Desc: "line start/end"},
881+ {Name: "pgup/pgdown", Desc: "page scroll"},
882+ {Name: "shift+pgup/shift+pgdown", Desc: "extend selection by page"},
883+ {Name: "ctrl+home/ctrl+end", Desc: "file start/end"},
884+ }
885+ searchFn := func(query string) []modal.Item {
886+ if query == "" {
887+ return items
888+ }
889+ q := strings.ToLower(query)
890+ var filtered []modal.Item
891+ for _, item := range items {
892+ name := strings.ToLower(item.Name)
893+ desc := strings.ToLower(item.Desc)
894+ if strings.Contains(name, q) || strings.Contains(desc, q) {
895+ filtered = append(filtered, item)
896+ }
897+ }
898+ return filtered
899+ }
900+ md := modal.New(searchFn, "Keys: ", modal.Colors{
901+ Fg: palette.Fg,
902+ Bg: palette.Bg,
903+ Dim: palette.Dim,
904+ SelFg: palette.Bg,
905+ SelBg: palette.Fg,
906+ Border: palette.Border,
907+ })
908+ md.WidthPct = 60
909+ m.keybindsModal = &md
910+}
911+
912+func (m *Model) updateKeybindsModal(msg tea.Msg) (Model, tea.Cmd, bool) {
913+ if m.keybindsModal == nil {
914+ return *m, nil, false
915+ }
916+ action, cmd := m.keybindsModal.HandleMsg(msg)
917+ switch action.(type) {
918+ case modal.ActionClose:
919+ m.keybindsModal = nil
920+ return *m, nil, true
921+ case modal.ActionSelect:
922+ return *m, nil, true
923+ }
924+ if cmd != nil {
925+ return *m, cmd, true
926+ }
927+ switch msg.(type) {
928+ case tea.KeyPressMsg, tea.MouseMsg:
929+ return *m, nil, true
930+ }
931+ return *m, nil, false
932+}
933+
934+
850935 func (m *Model) updateFileModal(msg tea.Msg) (Model, tea.Cmd, bool) {
851936 if m.fileModal == nil {
852937 return *m, nil, false