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

Keybindings to less / vim #107

Open
inoperable opened this issue Nov 19, 2022 · 12 comments
Open

Keybindings to less / vim #107

inoperable opened this issue Nov 19, 2022 · 12 comments

Comments

@inoperable
Copy link

Any way to change default keybindings?
I very like the pager but im so used to less vimish keys i would love to set those in moar as well.

@walles
Copy link
Owner

walles commented Nov 21, 2022

Which key bindings are you missing specifically?

@inoperable
Copy link
Author

inoperable commented Nov 21, 2022 via email

@walles
Copy link
Owner

walles commented Nov 21, 2022

What you describe does not match less's behavior, at least not out of the box.

Do you have some specific less config to get these bindings?

@rbutoi
Copy link

rbutoi commented Nov 27, 2022

I very like the pager but im so used to less vimish keys i would love to set those in moar as well.

+1

Do you have some specific less config to get these bindings?

None, it's the out-of-the-box config - just that the usual readline(3) binds like Ctrl-N for next line, Ctrl-P for previous, Alt-< and Alt-> for beginning/end of file work in less, and not in moar (and they do in other replacements like most.

walles added a commit that referenced this issue Nov 28, 2022
walles added a commit that referenced this issue Nov 28, 2022
Those don't work in `less` either and they haven't been out in any
release.

Also, I don't get them raw, so it's hard for me to support properly.

Ref: #107 (comment)
@walles
Copy link
Owner

walles commented Nov 28, 2022

@rbutoi I just tried what you said in less and:

  • ^p and ^n worked as you describe, so I added them
  • ALT-< and ALT-> had no effect, and I also get them as and which probably won't work on all systems, so I don't see how to implement those reliably

Also, neither Alt-< nor Alt-> are documented on the help screen of less (press h to view it).

@rbutoi
Copy link

rbutoi commented Nov 28, 2022

ALT-< and ALT-> had no effect, and I also get them as ≤ and ≥ which probably won't work on all systems, so I don't see how to implement those reliably

It should be plain > or Alt-> (AKA ESC->).

Also, neither Alt-< nor Alt-> are documented on the help screen of less (press h to view it).

They are under ESC, since Alt becomes ESC in the terminal:

       g or < or ESC-<
              Go to line N in the file, default 1 (beginning of file).  (Warning: this may be slow if N is large.)

       G or > or ESC->
              Go to line N in the file, default the end of the file.  (Warning: this may be slow if N is large, or if  N  is
              not specified and standard input, rather than a file, is being read.)

@walles
Copy link
Owner

walles commented Nov 28, 2022

Esc (same as ESC, short for "Escape") it's used for exiting moar (and a lot of other things on different systems), so that's not something I'll be supporting as a prefix.

Alt becomes ESC in the terminal

Just out of curiosity, where did you get this information? In my mind they are totally different things and I don't understand how they could ever "become" each other?

@inoperable
Copy link
Author

inoperable commented Nov 28, 2022 via email

@rbutoi
Copy link

rbutoi commented Nov 29, 2022

Just out of curiosity, where did you get this information? In my mind they are totally different things and I don't understand how they could ever "become" each other?

I gave a handwavy explanation since I'm not too well-versed in it either--it has to to with encoding of keyboard sequences in virtual terminals. ESC is apparently also ^[, see https://wiki.archlinux.org/title/Xterm#Make_'Alt'_key_behave_as_on_other_terminal_emulators.

@Schweber
Copy link

Again, why not do a conf file moar can parse and users can map whatever they like to the keys and you won't be doing stuff that's wasting your time ;-)

@walles Could you please implement this option? I'm using a non-standard keyboard layout and this would help me out a lot.

@walles
Copy link
Owner

walles commented May 1, 2023

If somebody wants to make a PR for configurable key bindings I'd not be against that, but I won't be implementing this myself.

@GNOMES
Copy link

GNOMES commented Jun 6, 2023

So not Vim's "Shift + GG"/gg, but I have noticed that Moar performs identical to Less with "G" going to the bottom. The problem is that "g" doesn't go up to the top like it does in Less. Instead it brings up a "go to line:" bar.

As a drop in replacement shouldn't it follow Less's behavior?

I support the idea of Vim like bindings, but I am not familiar with Go to have a go (heh) at making a PR.

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

No branches or pull requests

5 participants