-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeybindings.go
99 lines (89 loc) · 3.51 KB
/
keybindings.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
package main
import (
"log"
ui "github.com/awesome-gocui/gocui"
)
func keybindings(g *ui.Gui) error {
if err := g.SetKeybinding(AllViews, ui.KeyTab, ui.ModNone, ChangeView); err != nil {
return err
}
// PROJECTS VIEW
if err := g.SetKeybinding(ProjectsView, 'a', ui.ModNone, AddProject); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, 'd', ui.ModNone, RemoveProject); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, 'j', ui.ModNone, ListDown); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, ui.KeyArrowDown, ui.ModNone, ListDown); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, 'k', ui.ModNone, ListUp); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, ui.KeyArrowUp, ui.ModNone, ListUp); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, ui.KeySpace, ui.ModNone, OnSelectProject); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(ProjectsView, ui.KeyEnter, ui.ModNone, SwitchProjectTab); err != nil {
log.Fatal("Failed to set keybindings", err)
}
// STATUSES VIEW
if err := g.SetKeybinding(StatusesView, 'b', ui.ModNone, SwitchProjectTab); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(StatusesView, ui.KeyEsc, ui.ModNone, SwitchProjectTab); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(StatusesView, 'j', ui.ModNone, ListDown); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(StatusesView, 'k', ui.ModNone, ListUp); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(StatusesView, ui.KeySpace, ui.ModNone, ToggleStatus); err != nil {
log.Fatal("Failed to set keybindings", err)
}
// PROMPT VIEW
if err := g.SetKeybinding(PromptView, ui.KeyEsc, ui.ModNone, CancelDialog); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(PromptView, ui.KeyEnter, ui.ModNone, SubmitPrompt); err != nil {
log.Fatal("Failed to set keybindings", err)
}
// ALERT VIEW
if err := g.SetKeybinding(AlertView, ui.KeyEsc, ui.ModNone, CancelDialog); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(AlertView, ui.KeyEnter, ui.ModNone, SubmitAlert); err != nil {
log.Fatal("Failed to set keybindings", err)
}
// ISSUES VIEW
if err := g.SetKeybinding(IssuesView, 'j', ui.ModNone, ListDown); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(IssuesView, ui.KeyArrowDown, ui.ModNone, ListDown); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(IssuesView, 'k', ui.ModNone, ListUp); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(IssuesView, ui.KeyArrowUp, ui.ModNone, ListUp); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(IssuesView, 'g', ui.ModNone, GitBranchPrompt); err != nil {
log.Fatal("Failed to set keybindings", err)
}
// ALL VIEWS
if err := g.SetKeybinding(AllViews, ui.KeyCtrlC, ui.ModNone, Quit); err != nil {
log.Fatal("Failed to set keybindings", err)
}
if err := g.SetKeybinding(AllViews, 'q', ui.ModNone, Quit); err != nil {
log.Fatal("Failed to set keybindings", err)
}
return nil
}