"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: [rfc] compound keymaps with prefixed count modifier like vi(1)
To:
Mikhail <mp39590@gmail.com>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 22 Jun 2022 02:27:27 +1000

Download raw body.

Thread
On 22-06-21 07:10pm, Mikhail wrote:
> On Wed, Jun 22, 2022 at 01:08:49AM +1000, Mark Jamsek wrote:
> > I got the idea from naddy the other day when he mentioned the behaviour
> > of less(1) in the discussion about C-d/C-u d/u. It's something I use in
> > vim a lot too, so I wanted to see how others feel about it.
> > 
> > I figured it'd be easier to explain with an example so the following
> > diff demonstrates the intended behaviour. Basically, for movement
> > keymaps, they can be prefixed with a count modifier, which determines
> > how many times the requested movement is performed.
> > 
> > For example, 123j will move down 123 lines, and 3f will scroll down
> > 3 pages. I like the diff context where n] will increase context by
> > n lines, which is like the ^v context buttons in Fossil and GitHub to
> > expand the diff in large chunks.
> > 
> > This is just a feeler. I added some hints to the docs but if you use
> > this in less or vim it's pretty much the same behaviour except with
> > C-d/C-u: in less(1) and vi(1), nC-d or nC-u will scroll n lines--not
> > half pages. In vi(1), nC-b and nC-f will scroll n pages, but in less(1)
> > it will scroll n lines. I think it's more useful and consistent to
> > modify the normal scroll amount because we can already move n lines with
> > the normal jk and up/down keys.
> > 
> > The only thing I'm not sure is whether I prefer massaging view->count at
> > each keymap case in the input handlers or if I'd rather validate in one
> > routine at input but I wanted to get comments first.
> 
> I see how it can be useful in editor, like go to line 123 (123G), to see
> what compiler complains about, but in pager-like mode, personally, I see
> not much use of scrolling by arbitrary number of lines or pages.
> 
> Do you think there will be a lot of users for such approach?

My first thought for the diff was much the same; that is, how much would
I use it. And I think I'd use the count mod for the context lines the
most tbh, and then f/b. But I think it'll be useful for blame the most.
More often than not I want to annotate a specific (set of) line(s), and
with this you can jump straight to it. But I guess even if you don't
want to use it, it doesn't impact existing behaviour so you can use it
if you like or continue like it doesn't exist.

That said, is it worth the code cost? I'm not sold, that's why I thought
I'd post an RFC.

-- 
Mark Jamsek <fnc.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68