keys.go

 1package chat
 2
 3import (
 4	"github.com/charmbracelet/bubbles/v2/key"
 5)
 6
 7type KeyMap struct {
 8	NewSession     key.Binding
 9	AddAttachment  key.Binding
10	AddMCPResource key.Binding
11	Cancel         key.Binding
12	Tab            key.Binding
13	Details        key.Binding
14}
15
16func DefaultKeyMap() KeyMap {
17	return KeyMap{
18		NewSession: key.NewBinding(
19			key.WithKeys("ctrl+n"),
20			key.WithHelp("ctrl+n", "new session"),
21		),
22		AddAttachment: key.NewBinding(
23			key.WithKeys("ctrl+f"),
24			key.WithHelp("ctrl+f", "add attachment"),
25		),
26		AddMCPResource: key.NewBinding(
27			key.WithKeys("ctrl+r"),
28			key.WithHelp("ctrl+r", "add mcp resource"),
29		),
30		Cancel: key.NewBinding(
31			key.WithKeys("esc", "alt+esc"),
32			key.WithHelp("esc", "cancel"),
33		),
34		Tab: key.NewBinding(
35			key.WithKeys("tab"),
36			key.WithHelp("tab", "change focus"),
37		),
38		Details: key.NewBinding(
39			key.WithKeys("ctrl+d"),
40			key.WithHelp("ctrl+d", "toggle details"),
41		),
42	}
43}