Browse Source

feat: add emacs-like up and down navigation

pull/3/head
Sergio Guillen 1 year ago
parent
commit
41fa34307e
2 changed files with 8 additions and 2 deletions
  1. +2
    -2
      Readme.md
  2. +6
    -0
      mdr.go

+ 2
- 2
Readme.md View File

@ -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
- 0
mdr.go View File

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