onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

enhancement: bind h,j,k,l to scroll the browser split #1952

Open akinsho opened 6 years ago

akinsho commented 6 years ago

Because of the amazing sneakability already available one of my first thoughts was to try and figure out how to scroll the browser without having to move my mouse.

I wonder if it'd be possible to bind the vim navigation keys to scrolling left right up and down, not sure if the webview api gives access to that sort of functionality

bryphe commented 6 years ago

@Akin909 - yep! I was thinking about this too in the context of g and GG (to go to the top and bottom).

Lots of possibilities looking at the webview documentation: https://electronjs.org/docs/api/webview-tag

You could use the sendInputEvent to simulate a scroll event (like a mouseWheel event)

Lots of other possibilities on the API too. For example, you can start a search session (maybe binding / would be a good starting point for that?), take a screenshot, etc.

What we'd probably want to do to start is create commands for each of the gestures we want to support, like:

A good place to look is here: https://github.com/onivim/oni/blob/5678f045df06acdb80a3ff6e26c1f8a9c082c648/browser/src/Services/Browser/index.tsx#L131

Then we could add default bindings for them. These commands already have an enabled filter, so we could bind keys to them without conflicting with other bindings.