Repository navigation
Expand file tree
/
Copy pathkeymap.go
More file actions
220 lines (215 loc) · 6.6 KB
/
Copy pathkeymap.go
File metadata and controls
220 lines (215 loc) · 6.6 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package main
import "charm.land/bubbles/v2/key"
type KeyMap struct {
Up key.Binding `category:"Navigation"`
Down key.Binding `category:"Navigation"`
PageUp key.Binding `category:"Navigation"`
PageDown key.Binding `category:"Navigation"`
HalfPageUp key.Binding `category:"Navigation"`
HalfPageDown key.Binding `category:"Navigation"`
ScrollUp key.Binding `category:"Navigation"`
ScrollDown key.Binding `category:"Navigation"`
GotoTop key.Binding `category:"Navigation"`
GotoBottom key.Binding `category:"Navigation"`
NextSibling key.Binding `category:"Navigation"`
PrevSibling key.Binding `category:"Navigation"`
MatchBracket key.Binding `category:"Navigation"`
Expand key.Binding `category:"Expand / Collapse"`
Collapse key.Binding `category:"Expand / Collapse"`
ExpandRecursively key.Binding `category:"Expand / Collapse"`
CollapseRecursively key.Binding `category:"Expand / Collapse"`
ExpandAll key.Binding `category:"Expand / Collapse"`
CollapseAll key.Binding `category:"Expand / Collapse"`
CollapseLevel key.Binding `category:"Expand / Collapse"`
Search key.Binding `category:"Search"`
SearchNext key.Binding `category:"Search"`
SearchPrev key.Binding `category:"Search"`
GotoSymbol key.Binding `category:"Search"`
GotoRef key.Binding `category:"Search"`
Yank key.Binding `category:"Actions"`
Delete key.Binding `category:"Actions"`
Preview key.Binding `category:"Actions"`
Print key.Binding `category:"Actions"`
Reload key.Binding `category:"Actions"`
ToggleWrap key.Binding `category:"View"`
ShowSelector key.Binding `category:"View"`
GoBack key.Binding `category:"Navigation"`
GoForward key.Binding `category:"Navigation"`
Query key.Binding `category:"Other"`
Help key.Binding `category:"Other"`
CommandLine key.Binding `category:"Other"`
Quit key.Binding `category:"Other"`
Suspend key.Binding `category:"Other"`
}
var keyMap KeyMap
func init() {
keyMap = KeyMap{
Quit: key.NewBinding(
key.WithKeys("q", "ctrl+c"),
key.WithHelp("", "exit program"),
),
Suspend: key.NewBinding(
key.WithKeys("ctrl+z"),
key.WithHelp("", "suspend program"),
),
PageDown: key.NewBinding(
key.WithKeys("pgdown", "space", "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("ctrl+u"),
key.WithHelp("", "half page up"),
),
HalfPageDown: key.NewBinding(
key.WithKeys("ctrl+d"),
key.WithHelp("", "half page down"),
),
ScrollUp: key.NewBinding(
key.WithKeys("ctrl+y"),
key.WithHelp("", "scroll view up one line"),
),
ScrollDown: key.NewBinding(
key.WithKeys("ctrl+e"),
key.WithHelp("", "scroll view down one line"),
),
GotoTop: key.NewBinding(
key.WithKeys("g", "home"),
key.WithHelp("", "goto top"),
),
GotoBottom: key.NewBinding(
key.WithKeys("G", "end"),
key.WithHelp("", "goto bottom"),
),
GotoSymbol: key.NewBinding(
key.WithKeys("@"),
key.WithHelp("", "goto symbol"),
),
GotoRef: key.NewBinding(
key.WithKeys("ctrl+g"),
key.WithHelp("", "goto ref"),
),
Down: key.NewBinding(
key.WithKeys("down", "j"),
key.WithHelp("", "down"),
),
Up: key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("", "up"),
),
Query: key.NewBinding(
key.WithKeys("."),
key.WithHelp("", "open query input (tab completes keys)"),
),
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"),
),
MatchBracket: key.NewBinding(
key.WithKeys("%"),
key.WithHelp("", "jump to matching bracket"),
),
ToggleWrap: key.NewBinding(
key.WithKeys("z"),
key.WithHelp("", "toggle strings wrap"),
),
ShowSelector: key.NewBinding(
key.WithKeys("s"),
key.WithHelp("", "show sizes/line numbers"),
),
Yank: key.NewBinding(
key.WithKeys("y"),
key.WithHelp("", "yank/copy"),
),
Delete: key.NewBinding(
key.WithKeys("d"),
key.WithHelp("", "delete node"),
),
CommandLine: key.NewBinding(
key.WithKeys(":"),
key.WithHelp("", "open command line"),
),
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 node"),
),
Print: key.NewBinding(
key.WithKeys("P"),
key.WithHelp("", "print to stdout"),
),
Reload: key.NewBinding(
key.WithKeys("r"),
key.WithHelp("", "reload file"),
),
GoBack: key.NewBinding(
key.WithKeys("["),
key.WithHelp("", "go back"),
),
GoForward: key.NewBinding(
key.WithKeys("]"),
key.WithHelp("", "go forward"),
),
}
}
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"))
yankKeyValue = key.NewBinding(key.WithKeys("b"))
showSizes = key.NewBinding(key.WithKeys("s"))
showLineNumbers = key.NewBinding(key.WithKeys("l"))
ctrlC = key.NewBinding(key.WithKeys("ctrl+c"))
escKey = key.NewBinding(key.WithKeys("esc"))
)