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

Please support more standard less keybindings #28

Open
hupfdule opened this issue Oct 21, 2020 · 10 comments
Open

Please support more standard less keybindings #28

hupfdule opened this issue Oct 21, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@hupfdule
Copy link

It would ease the use of ov if it would provide all the same keybindings as less. Currently only some of its keybindungs are supported. Currently unsupported are e.g. j and k for scrolling down and up or space and ctrl-f for pagewise scrolling.

@noborus
Copy link
Owner

noborus commented Oct 21, 2020

Thank you very much.
I'm thinking of adding standard keybindings, but I'd also like to have some patterns of configuration file (ov.yaml) templates(copy to ~ /.ov.yaml.).
If you send me an ov.yaml that I think is standard, I'll add it to the repository.
If you want to add your point to ov.yaml:

--- ov.yaml	2020-10-21 18:36:31.137016303 +0900
+++ ov.yaml.less	2020-10-21 18:50:31.726422973 +0900
@@ -28,41 +28,45 @@
         - "ctrl+l"
     help:
         - "h"
         - "ctrl+alt+c"
     logdoc:
         - "ctrl+alt+e"
     down:
         - "Enter"
         - "Down"
         - "ctrl+N"
+        - "j"
     up:
         - "Up"
         - "ctrl+p"
+        - "k"
     top:
         - "Home"
     bottom:
         - "End"
     left:
         - "left"
     right:
         - "right"
     half_left:
         - "ctrl+left"
     half_right:
         - "ctrl+right"
     page_up:
         - "PageUp"
         - "ctrl+b"
     page_down:
         - "PageDown"
         - "ctrl+v"
+        - "ctrl+f"
+        - "space"
     page_half_up:
         - "ctrl+u"
     page_half_down:
         - "ctrl+d"
     mark:
         - "m"
     next_mark:
         - ">"
     previous_mark:
         - "<"

@hupfdule
Copy link
Author

hupfdule commented Oct 22, 2020

Hello,

thank you for your fast answer.

As requested, here is a diff for the non-invasive change that only adds keybindings to the already existing ones. It doesn't add all of less's keybindings as some are quite obscure and other are used for functionality that isn't provided by ov (yet). For some others I think ov's binding is better than the one in less and will not really get in the way of less-aware users (e.g. the mapping of [ and ]).

As they don't change the existing ones, I think they can be added to the hardcoded ones in the source code. In fact, I already prepared a PR for that purpose. [1]

Here is the patch:

--- ov.yaml	2020-10-22 22:26:13.233478983 +0200
+++ ov-extended.yaml	2020-10-22 22:26:04.997440739 +0200
@@ -25,6 +25,9 @@
         - "Q"
     sync:
         - "ctrl+l"
+        - "r"
+        - "R"
+        - "ctrl+r"
     help:
         - "h"
         - "ctrl+alt+c"
@@ -34,9 +37,20 @@
         - "Enter"
         - "Down"
         - "ctrl+N"
+        - "e"
+        - "ctrl+e"
+        - "j"
+        - "J"
+        - "ctrl+j"
     up:
         - "Up"
         - "ctrl+p"
+        - "y"
+        - "Y"
+        - "ctrl+y"
+        - "k"
+        - "K"
+        - "ctrl-k"
     top:
         - "Home"
     bottom:
@@ -51,13 +65,21 @@
         - "ctrl+right"
     page_up:
         - "PageUp"
+        - "b"
         - "ctrl+b"
+        - "alt+v"
     page_down:
         - "PageDown"
         - "ctrl+v"
+        - "Space"
+        - "alt+Space"
+        - "f"
+        - "z"
     page_half_up:
+        - "u"
         - "ctrl+u"
     page_half_down:
+        - "d"
         - "ctrl+d"
     mark:
         - "m"

As this only adds to the existing keybindings, it is not perfect.
My main gripe is with G which I expect to jump to the end of the file. I could easily change this in my custom ov.yaml, but every other person expecting that keybinding (which should be all users familiar with less or vi) will expect that, too.
Therefore my suggestion is to also hardcode that as the default and use a different key for the current functionality of toggling line number mode.

That brings me to another point, I have described in #31. :-)

[1] That PR not only adds these keybindings that are configurable, but also some non-configurable keybindings for aborting user input.

@LamprosPitsillos
Copy link

LamprosPitsillos commented Apr 28, 2021

I second this , please make these key bindings or the actual vim/less key bindings the default for all users , so that you are not overshadowing the features of ov . A simple user trying this out wouldn't bother finding config files ( which I recommend having a command like ov --dump-conf to just make a default config not in $HOME but in the default config dir ).

@noborus
Copy link
Owner

noborus commented Apr 28, 2021

I recommend that you stop using less key bindings as much as possible.
The use of less key bindings will prevent future additions.

@LamprosPitsillos
Copy link

Ok I see , but what about the vim key bindings, at least these should be present . I think of them as necessary keybindings for any terminal application.

@noborus noborus added the enhancement New feature or request label Jun 19, 2022
@dylan-tock
Copy link

The use of less key bindings will prevent future additions.

Not providing less/vim keybindings will limit adoption of ov. I happened on this page trying to find configs with more vim/less-like keybindings since they are reflexes/habits to me. While I was able to find something to meet my immediate needs, the more friction there is in the interface, the less likely I will be to adopt the software long-term.

YMMV and this is simply feedback from one person's perspective. I am hopeful I'll be a long-term ov user and smoothing these (IMO) rough bits would help that long-term.

@noborus
Copy link
Owner

noborus commented Aug 2, 2023

I think it's unreasonable to adopt less's keybinding anymore.
For example, newer versions of less allow headers to be specified, but must be specified using --header or -h. I can't stand this.
There is no way to convince everyone of this. All you need is to customize your keybindings.

@dylan-tock
Copy link

First, thanks for your timely response and for ov. Both are much appreciated!

Second, Please don't misunderstand. I would never suggest you copy over every less/vim keybinding. But for the 95% of keybindings used (page-up, page-down, line-up, line-down, goto first line, goto n'th line, etc) which are the ones @hupfdule identified in their response, I think those would be good to add. If there is hesitance to making them default, perhaps having a link to an vim.ov.yaml file in github in the output of ov --help would be an acceptable compromise?

You are correct that customizing my keybindings allowed me to implement the set of navigation keys I used the most so they do not violate the "principle of least surprise/astonishment". I am hopeful this is enough to remove any surprise from my typical interactions with ov and it can become a part of my standard toolkit.

@noborus
Copy link
Owner

noborus commented Aug 2, 2023

I understand from this project that people already had a range of minimum interpretations.
I hope you understand that your minimum is different from the minimum of others.

@nkh
Copy link

nkh commented Aug 4, 2023

@dylan-tock @noborus

I've had ov installed for months, I tried it and didn't use it, it's not the good work you put in nor the functionality, I think you're onto something good, so good that tried it again this week and have added a few feature requests and maybe found one error.

Honestly it's not that vim-like bindings are better, well they are, it's that windows-like bindings are horrible because we just add bindings to keys that happen to be free and seldom reflect on them. Let me give you and example directly for your documentation

[c] | column mode toggle
[alt+o] | column width toggle
[ctrl+r] | column rainbow toggle

Of course it's up to us linux/vim users to help and we must do that in the constraints of the software or look somewhere else (or give a patch but let's not dream, users ask and seldom code).

If @dylan-tock wants to, I'd be happy to discuss with him what could be good bindings for all the functionality you already have and propose a config file you can add to your distribution.

If there is a possibility to have multi-key bindings then it would be great! And that will be good for the windows users too.

I faced the same dilemma in an project of mine, my co-author is on windows and we've had a few discussions about this.

https://github.com/nkh/P5-App-Asciio/blob/master/documentation/mdbook_asciio/src/bindings/vim-like.md

The current bindings:
https://github.com/nkh/P5-App-Asciio/blob/master/setup/actions/default_bindings.pl

another project:
https://github.com/nkh/ftl/blob/41259bba1118ac4c2c463be6b6bb33646a7fe03c/config/ftl/etc/ftlrc#L137

and the bindings that were used before I converted to vim-like bindings, and it was more difficult to use:
https://github.com/nkh/ftl/blob/main/config/ftl/etc/ftlrc_not_so_vim_like

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

No branches or pull requests

5 participants