Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagedown and Pageup to scroll the diff window #25

Closed
itsheng opened this issue Aug 6, 2018 · 7 comments
Closed

Pagedown and Pageup to scroll the diff window #25

itsheng opened this issue Aug 6, 2018 · 7 comments

Comments

@itsheng
Copy link

itsheng commented Aug 6, 2018

Took me a while to figure it out. In case someone is looking for this.
On mac, fn + down or fn + up.

@OGKevin
Copy link

OGKevin commented Aug 6, 2018

Would be nice if you can focus on the diff window and then not use FN tho.

@jesseduffield
Copy link
Owner

@OGKevin agreed. If somebody could put up a PR having a go at that, would be much appreciated!

@jon-grangien
Copy link
Contributor

jon-grangien commented Aug 12, 2018

I tried ctrl + u and ctrl + d for scrolling up and down in a vim fashion, would love to have that but I don't have any experience with go. Configurable key bindings would solve it though!

@jon-grangien
Copy link
Contributor

@jesseduffield I forked and did this for my own use but I take it you wouldn't accept a PR with just a duplicate key binding?

diff --git a/keybindings.go b/keybindings.go
index afaa095..e789dc8 100644
--- a/keybindings.go
+++ b/keybindings.go
@@ -16,6 +16,8 @@ func keybindings(g *gocui.Gui) error {
        bindings := []Binding{
                {ViewName: "", Key: 'q', Modifier: gocui.ModNone, Handler: quit},
                {ViewName: "", Key: gocui.KeyCtrlC, Modifier: gocui.ModNone, Handler: quit},
+               {ViewName: "", Key: gocui.KeyCtrlU, Modifier: gocui.ModNone, Handler: scrollUpMain},
+               {ViewName: "", Key: gocui.KeyCtrlD, Modifier: gocui.ModNone, Handler: scrollDownMain},
                {ViewName: "", Key: gocui.KeyPgup, Modifier: gocui.ModNone, Handler: scrollUpMain},
                {ViewName: "", Key: gocui.KeyPgdn, Modifier: gocui.ModNone, Handler: scrollDownMain},
                {ViewName: "", Key: 'P', Modifier: gocui.ModNone, Handler: pushFiles},

@jesseduffield
Copy link
Owner

god DAMN I did not know you could do ctrl keys like that, I assumed you could only add that via the modifier part which only supports cmd.

Given that we already have vim hjkl keybindings by default I'm happy to merge this in as well. But just before I do, Are we sure that c-u and c-d are the most appropriate vim keys? This comment states that c-p and c-n make sense. If you think so, I'm happy to merge the PR

@jon-grangien
Copy link
Contributor

Haha nice!

I haven't mastered vim but Ctrl+n and Ctrl+p are often for going up and down a list of selectables, and the author of that other issue suggests it for scrolling through the list of files, for which you already put in h j k l.

The biggest pitch for Ctrl+d and Ctrl+u I should've mentioned is that those keybindings can be used to scroll when you type git diff in the terminal :)

Alright I'll make a PR but it would also be nice if we could mimic the git diff behavior even better by making it scroll several lines per key stroke instead of just one. I couldn't figure out the handlers when I messed around. But this doesn't go for just Ctrl+d and Ctrl+u but fn+up and fn+down as well.

@jesseduffield
Copy link
Owner

I'm gonna close this issue because we now support scrolling with ctrl+u/d and configurable scroll distance, but I'll open a new issue for your comment @OGKevin because I agree we should have that as a feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants