-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeybindings.go
121 lines (91 loc) · 3.17 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package main
import (
"log"
"github.com/jroimartin/gocui"
)
func SetKeyBindings(g *gocui.Gui) {
if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'q', gocui.ModNone, quit); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'r', gocui.ModNone, RefreshContent); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", gocui.KeyArrowUp, gocui.ModNone, GoUp); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'w', gocui.ModNone, GoUp); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'k', gocui.ModNone, GoUp); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", gocui.KeyArrowDown, gocui.ModNone, GoDown); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 's', gocui.ModNone, GoDown); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'j', gocui.ModNone, GoDown); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", gocui.KeyTab, gocui.ModNone, nextView); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", '1', gocui.ModNone, LoadRelevant); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", '2', gocui.ModNone, LoadRecent); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding("", 'i', gocui.ModNone, ShowInfo); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, gocui.KeyArrowLeft, gocui.ModNone, LoadPreviewsPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, 'a', gocui.ModNone, LoadPreviewsPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, 'h', gocui.ModNone, LoadPreviewsPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, gocui.KeyArrowRight, gocui.ModNone, LoadNextPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, 'd', gocui.ModNone, LoadNextPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, 'l', gocui.ModNone, LoadNextPage); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(LIST_VIEW, gocui.MouseLeft, gocui.ModNone, SelectListItem); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(READER_VIEW, gocui.MouseLeft, gocui.ModNone, selectReaderView); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(READER_VIEW, gocui.MouseWheelUp, gocui.ModNone, ScrollUp); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(READER_VIEW, gocui.MouseWheelDown, gocui.ModNone, ScrollDown); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(VERSION_VIEW, gocui.MouseLeft, gocui.ModNone, HandleClickVersion); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(RELEVANT_ITEMS_VIEW, gocui.MouseLeft, gocui.ModNone, LoadRelevant); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(RECENT_ITEMS_VIEW, gocui.MouseLeft, gocui.ModNone, LoadRecent); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(OPEN_ARTICLE_VIEW, gocui.MouseLeft, gocui.ModNone, OpenArticleWeb); err != nil {
log.Panicln(err)
}
if err := g.SetKeybinding(READER_VIEW, 'a', gocui.ModNone, OpenArticleWeb); err != nil {
log.Panicln(err)
}
}