walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

Keybindings to less / vim #107

Open inoperable opened 1 year ago

inoperable commented 1 year ago

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 commented 1 year ago

Which key bindings are you missing specifically?

inoperable commented 1 year ago

Vi/m hjkl style defaults: h - left, j - down, k - up, l - right, G - bottom, gg - top alternative: hjkl as above but instead of G/gg: y - page down, u - end, i - home, p - page up / - search, n - next match, N - previous match

a lot of term utils use vim style by default or let you easily fall back to that style (incl. shells) moar shouldn't reinvent a proven concept and become a muscle memory irritant :-)

Implementing a Keybinding settings with some default layouts as an example, that would be the optimal solution - so users can configure it to their needs.

On Mon, Nov 21, 2022 at 11:00 AM Johan Walles @.***> wrote:

Which key bindings are you missing specifically?

— Reply to this email directly, view it on GitHub https://github.com/walles/moar/issues/107#issuecomment-1321796445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL7SAQLCMGM6XWFZBDZ2ZTWJNB3LANCNFSM6AAAAAASFKGH4Q . You are receiving this because you authored the thread.Message ID: @.***>

walles commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

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

rbutoi commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 ;-)

On Mon, Nov 28, 2022 at 6:50 PM Johan Walles @.***> wrote:

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?

— Reply to this email directly, view it on GitHub https://github.com/walles/moar/issues/107#issuecomment-1329508847, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL7SAXYS2T62IK62TV4WZ3WKTWHFANCNFSM6AAAAAASFKGH4Q . You are receiving this because you authored the thread.Message ID: @.***>

rbutoi commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.