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

Add new key bindings to view mode #2803

Merged
merged 2 commits into from
Jul 1, 2022

Conversation

benjaminrich
Copy link
Contributor

The idea is to make view mode more pager-like, and to make (half-)page-wise scrolling easier.

In particular, I suggest space to scroll down, like most pagers. Unfortunately, shift-space cannot be used to scroll up due to terminal limitations, so I suggest backspace as an alternative. I also suggest J and K for downwards and upwards scrolling, respectively. I also added search commands to view mode.

Addresses #2721

@benjaminrich benjaminrich changed the title Add new key binding to view mode Add new key bindings to view mode Jun 18, 2022
@the-mikedavis
Copy link
Member

I'm ok with space and backspace but I think the search bindings and J and K should also go. J and K are not actually improvents on C-u/C-d (shift and control both count as one keystroke) and duplicate keybindings are not good for the default keymap. You can add these to your own keymap with config:

# ~/.config/helix/config.toml
[keys.normal]
Z = { J = "half_page_down", K = "half_page_up" }

@benjaminrich
Copy link
Contributor Author

benjaminrich commented Jun 18, 2022

That's fair. It was just a suggestion. Default key bindings are obviously a tricky issue. I personally feel that J and K are logical and much more comfortable and intuitive to type because of their proximity to each other and the fact that they are on the home row, but as you point out I can always make the decision for myself if I want.

I don't see why I shouldn't be able to search in view mode though. That seems kind of unnecessarily restrictive (unless I am missing the point of view mode - I thought it was to provide a more pager-like experience).

EDIT: in fact, I don't see the point of non-sticky view mode. Is there a use case for that?

EDIT 2: I think I can answer my own question: the point of non-sticky view mode is simply to access the "align view (center|top|bottom|middle)" functions - these have no other key bindings by default. I guess one could question whether that is important enough to warrant its own mode, but at least it makes sense.

@the-mikedavis
Copy link
Member

Hmm yeah actually I agree, search bindings should be ok to make the pager-like experience better 👍

@sbromberger
Copy link
Contributor

FWIW, I'm against binding space. I use it all the time - even (especially?) in view mode, with k, to ensure that the thing I'm selecting is really the thing I want to be doing something with.

@the-mikedavis
Copy link
Member

How are you using space currenty? It isn't bound in view mode at the moment so it's a no-op

@sbromberger
Copy link
Contributor

How are you using space currenty? It isn't bound in view mode at the moment so it's a no-op

Sorry, this may be my misunderstanding. Is "view mode" the same as select mode (v), or is it something else?

@the-mikedavis
Copy link
Member

View mode is a minor mode you can use with z or a sticky minor mode (you stay in the mode even after pressing keys) with Z that lets you move the view of the document.

@sbromberger
Copy link
Contributor

Ah, then my apologies. I withdraw my concern :)

@the-mikedavis the-mikedavis linked an issue Jun 20, 2022 that may be closed by this pull request
@archseer archseer merged commit 15d96c8 into helix-editor:master Jul 1, 2022
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

Successfully merging this pull request may close these issues.

Suggestion: use <space> to scroll in view mode
4 participants