Skip to content

Commit

Permalink
add cursor key bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
gokcehan committed Aug 13, 2016
1 parent bdee73b commit 84cf8e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Keys

down (default "j")
up (default "k")
updir (default "h")
open (default "l")
up (default "k" and "<up>")
down (default "j" and "<down>")
updir (default "h" and "<left>")
open (default "l" and "<right>")
quit (default "q")
bot (default "G")
top (default "gg")
Expand Down
6 changes: 5 additions & 1 deletion opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ func init() {

gOpts.keys = make(map[string]Expr)

gOpts.keys["j"] = &CallExpr{"down", nil}
gOpts.keys["k"] = &CallExpr{"up", nil}
gOpts.keys["<up>"] = &CallExpr{"up", nil}
gOpts.keys["j"] = &CallExpr{"down", nil}
gOpts.keys["<down>"] = &CallExpr{"down", nil}
gOpts.keys["h"] = &CallExpr{"updir", nil}
gOpts.keys["<left>"] = &CallExpr{"updir", nil}
gOpts.keys["l"] = &CallExpr{"open", nil}
gOpts.keys["<right>"] = &CallExpr{"open", nil}
gOpts.keys["q"] = &CallExpr{"quit", nil}
gOpts.keys["G"] = &CallExpr{"bot", nil}
gOpts.keys["gg"] = &CallExpr{"top", nil}
Expand Down
8 changes: 8 additions & 0 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ func (ui *UI) getExpr() Expr {
acc = append(acc, '<', 'b', 's', '2', '>')
case termbox.KeyTab:
acc = append(acc, '<', 't', 'a', 'b', '>')
case termbox.KeyArrowUp:
acc = append(acc, '<', 'u', 'p', '>')
case termbox.KeyArrowDown:
acc = append(acc, '<', 'd', 'o', 'w', 'n', '>')
case termbox.KeyArrowLeft:
acc = append(acc, '<', 'l', 'e', 'f', 't', '>')
case termbox.KeyArrowRight:
acc = append(acc, '<', 'r', 'i', 'g', 'h', 't', '>')
case termbox.KeyCtrlL:
acc = append(acc, '<', 'c', '-', 'l', '>')
case termbox.KeyEsc:
Expand Down

0 comments on commit 84cf8e1

Please sign in to comment.