ov icon indicating copy to clipboard operation
ov copied to clipboard

Please support more standard less keybindings

Open hupfdule opened this issue 5 years ago • 10 comments
trafficstars

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.

hupfdule avatar Oct 21 '20 07:10 hupfdule

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:
         - "<"

noborus avatar Oct 21 '20 09:10 noborus

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.

hupfdule avatar Oct 22 '20 20:10 hupfdule

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

LamprosPitsillos avatar Apr 28 '21 13:04 LamprosPitsillos

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

noborus avatar Apr 28 '21 14:04 noborus

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.

LamprosPitsillos avatar Apr 28 '21 14:04 LamprosPitsillos

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.

dylan-tock avatar Aug 02 '23 13:08 dylan-tock

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.

noborus avatar Aug 02 '23 14:08 noborus

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.

dylan-tock avatar Aug 02 '23 15:08 dylan-tock

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.

noborus avatar Aug 02 '23 15:08 noborus

@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

nkh avatar Aug 04 '23 14:08 nkh