Browse Source

feat: add emacs-like up and down navigation

pull/3/head
Sergio Guillen 2 years ago
parent
commit
41fa34307e
  1. 4
      Readme.md
  2. 6
      mdr.go

4
Readme.md

@ -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> |

6
mdr.go

@ -97,6 +97,9 @@ 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
}
@ -104,6 +107,9 @@ func newUi(g *gocui.Gui) (*ui, error) {
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
}

Loading…
Cancel
Save