-
-
Notifications
You must be signed in to change notification settings - Fork 441
/
Copy pathkeymap.go
157 lines (152 loc) · 3.96 KB
/
keymap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package main
import "github.com/charmbracelet/bubbles/key"
type KeyMap struct {
Quit key.Binding
PageDown key.Binding
PageUp key.Binding
HalfPageUp key.Binding
HalfPageDown key.Binding
GotoTop key.Binding
GotoBottom key.Binding
Down key.Binding
Up key.Binding
Help key.Binding
Expand key.Binding
Collapse key.Binding
ExpandRecursively key.Binding
CollapseRecursively key.Binding
ExpandAll key.Binding
CollapseAll key.Binding
CollapseLevel key.Binding
NextSibling key.Binding
PrevSibling key.Binding
ToggleWrap key.Binding
Yank key.Binding
Search key.Binding
SearchNext key.Binding
SearchPrev key.Binding
Preview key.Binding
Print key.Binding
Dig key.Binding
}
var keyMap KeyMap
func init() {
keyMap = KeyMap{
Quit: key.NewBinding(
key.WithKeys("q", "ctrl+c", "esc"),
key.WithHelp("", "exit program"),
),
PageDown: key.NewBinding(
key.WithKeys("pgdown", " ", "f"),
key.WithHelp("pgdown, space, f", "page down"),
),
PageUp: key.NewBinding(
key.WithKeys("pgup", "b"),
key.WithHelp("pgup, b", "page up"),
),
HalfPageUp: key.NewBinding(
key.WithKeys("u", "ctrl+u"),
key.WithHelp("", "half page up"),
),
HalfPageDown: key.NewBinding(
key.WithKeys("d", "ctrl+d"),
key.WithHelp("", "half page down"),
),
GotoTop: key.NewBinding(
key.WithKeys("g", "home"),
key.WithHelp("", "goto top"),
),
GotoBottom: key.NewBinding(
key.WithKeys("G", "end"),
key.WithHelp("", "goto bottom"),
),
Down: key.NewBinding(
key.WithKeys("down", "j"),
key.WithHelp("", "down"),
),
Up: key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("", "up"),
),
Help: key.NewBinding(
key.WithKeys("?"),
key.WithHelp("", "show help"),
),
Expand: key.NewBinding(
key.WithKeys("right", "l", "enter"),
key.WithHelp("", "expand"),
),
Collapse: key.NewBinding(
key.WithKeys("left", "h", "backspace"),
key.WithHelp("", "collapse"),
),
ExpandRecursively: key.NewBinding(
key.WithKeys("L", "shift+right"),
key.WithHelp("", "expand recursively"),
),
CollapseRecursively: key.NewBinding(
key.WithKeys("H", "shift+left"),
key.WithHelp("", "collapse recursively"),
),
ExpandAll: key.NewBinding(
key.WithKeys("e"),
key.WithHelp("", "expand all"),
),
CollapseAll: key.NewBinding(
key.WithKeys("E"),
key.WithHelp("", "collapse all"),
),
CollapseLevel: key.NewBinding(
key.WithKeys("1", "2", "3", "4", "5", "6", "7", "8", "9"),
key.WithHelp("", "collapse to nth level"),
),
NextSibling: key.NewBinding(
key.WithKeys("J", "shift+down"),
key.WithHelp("", "next sibling"),
),
PrevSibling: key.NewBinding(
key.WithKeys("K", "shift+up"),
key.WithHelp("", "previous sibling"),
),
ToggleWrap: key.NewBinding(
key.WithKeys("z"),
key.WithHelp("", "toggle strings wrap"),
),
Yank: key.NewBinding(
key.WithKeys("y"),
key.WithHelp("", "yank/copy"),
),
Search: key.NewBinding(
key.WithKeys("/"),
key.WithHelp("", "search regexp"),
),
SearchNext: key.NewBinding(
key.WithKeys("n"),
key.WithHelp("", "next search result"),
),
SearchPrev: key.NewBinding(
key.WithKeys("N"),
key.WithHelp("", "prev search result"),
),
Preview: key.NewBinding(
key.WithKeys("p"),
key.WithHelp("", "preview"),
),
Print: key.NewBinding(
key.WithKeys("P"),
key.WithHelp("", "print"),
),
Dig: key.NewBinding(
key.WithKeys("."),
key.WithHelp("", "dig"),
),
}
}
var (
yankValueY = key.NewBinding(key.WithKeys("y"))
yankValueV = key.NewBinding(key.WithKeys("v"))
yankKey = key.NewBinding(key.WithKeys("k"))
yankPath = key.NewBinding(key.WithKeys("p"))
arrowUp = key.NewBinding(key.WithKeys("up"))
arrowDown = key.NewBinding(key.WithKeys("down"))
)