forked from kisielk/vigo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.go
38 lines (32 loc) · 809 Bytes
/
window.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
package mode
import (
cmd "github.com/kisielk/vigo/commands"
"github.com/kisielk/vigo/editor"
"github.com/nsf/termbox-go"
)
type WindowMode struct {
editor *editor.Editor
count int
}
func NewWindowMode(editor *editor.Editor, count int) WindowMode {
return WindowMode{editor: editor, count: count}
}
func (m WindowMode) Enter(e *editor.Editor) {
}
func (m WindowMode) OnKey(ev *termbox.Event) {
switch ev.Ch {
case 'h':
m.editor.Commands <- cmd.NearestVSplit{cmd.Backward}
case 'j':
m.editor.Commands <- cmd.NearestHSplit{cmd.Forward}
case 'k':
m.editor.Commands <- cmd.NearestHSplit{cmd.Backward}
case 'l':
m.editor.Commands <- cmd.NearestVSplit{cmd.Forward}
case '=':
// TODO viewTree.normalizeSplit
}
m.editor.SetMode(NewNormalMode(m.editor))
}
func (m WindowMode) Exit() {
}