-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkeybinds.go
50 lines (47 loc) · 953 Bytes
/
keybinds.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
package main
import (
"github.com/charmbracelet/bubbles/key"
)
type keyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Quit key.Binding
Back key.Binding
Top key.Binding
Enter key.Binding
}
var keys = keyMap{
Up: key.NewBinding(
key.WithKeys("up", "k"),
key.WithHelp("↑/k", "move up"),
),
Down: key.NewBinding(
key.WithKeys("down", "j"),
key.WithHelp("↓/j", "move down"),
),
Left: key.NewBinding(
key.WithKeys("left", "h"),
key.WithHelp("←/h", "move left"),
),
Right: key.NewBinding(
key.WithKeys("right", "l"),
key.WithHelp("→/l", "move right"),
),
Quit: key.NewBinding(
key.WithKeys("q", "ctrl+c"),
key.WithHelp("q", "quit"),
),
Back: key.NewBinding(
key.WithKeys("esc", "left"),
key.WithHelp("←/esc", "go back"),
),
Top: key.NewBinding(
key.WithKeys("t"),
key.WithHelp("t", "go to top"),
),
Enter: key.NewBinding(
key.WithKeys("enter"),
),
}