Skip to content

Commit

Permalink
Merge pull request #3 from sguillen-proyectos/add-keybindings
Browse files Browse the repository at this point in the history
feat: add emacs-like up and down navigation
  • Loading branch information
MichaelMure authored Dec 31, 2019
2 parents 51c6ca0 + 41fa343 commit 883bbd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ You can grab a [pre-compiled binary](https://github.com/MichaelMure/mdr/releases
| Action | Key |
|--------|-----|
| Quit | <kbd>ctrl+C</kbd>, <kbd>Q</kbd>|
| Up | <kbd>↑</kbd>, <kbd>K</kbd> |
| Down | <kbd>↓</kbd>, <kbd>J</kbd> |
| Up | <kbd>↑</kbd>, <kbd>K</kbd>, <kbd>ctrl+P</kbd>|
| Down | <kbd>↓</kbd>, <kbd>J</kbd>, <kbd>ctrl+N</kbd> |
| Page Up | <kbd>⇞</kbd> |
| Page Down | <kbd>⇟</kbd>, <kbd>space</kbd> |

Expand Down
6 changes: 6 additions & 0 deletions mdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,19 @@ func newUi(g *gocui.Gui) (*ui, error) {
if err := g.SetKeybinding(renderView, 'k', gocui.ModNone, result.up); err != nil {
return nil, err
}
if err := g.SetKeybinding(renderView, gocui.KeyCtrlP, gocui.ModNone, result.up); err != nil {
return nil, err
}
if err := g.SetKeybinding(renderView, gocui.KeyArrowUp, gocui.ModNone, result.up); err != nil {
return nil, err
}
// Down
if err := g.SetKeybinding(renderView, 'j', gocui.ModNone, result.down); err != nil {
return nil, err
}
if err := g.SetKeybinding(renderView, gocui.KeyCtrlN, gocui.ModNone, result.down); err != nil {
return nil, err
}
if err := g.SetKeybinding(renderView, gocui.KeyArrowDown, gocui.ModNone, result.down); err != nil {
return nil, err
}
Expand Down

0 comments on commit 883bbd1

Please sign in to comment.