2013-07-05 11:36:53

by Ramkumar Ramachandra

[permalink] [raw]
Subject: [PATCH] menuconfig: Allow j/k to move down/up the menu

Like in Vim.

Cc: Michal Marek <[email protected]>
Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
Unsure why nobody has done this yet.

scripts/kconfig/lxdialog/menubox.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 38cd69c..17fd936 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -307,11 +307,12 @@ do_resize:
(i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
+ key == 'j' || key == 'k' ||
key == KEY_PPAGE || key == KEY_NPAGE)) {
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);

- if (key == KEY_UP || key == '-') {
+ if (key == KEY_UP || key == '-' || key == 'k') {
if (choice < 2 && scroll) {
/* Scroll menu down */
do_scroll(menu, &scroll, -1);
@@ -320,7 +321,7 @@ do_resize:
} else
choice = MAX(choice - 1, 0);

- } else if (key == KEY_DOWN || key == '+') {
+ } else if (key == KEY_DOWN || key == '+' || key == 'j') {
print_item(scroll+choice, choice, FALSE);

if ((choice > max_choice - 3) &&
--
1.8.3.2.722.g3244e19.dirty


2013-07-07 18:27:06

by Rob Landley

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

On 07/05/2013 06:32:59 AM, Ramkumar Ramachandra wrote:
> Like in Vim.
>
> Cc: Michal Marek <[email protected]>
> Signed-off-by: Ramkumar Ramachandra <[email protected]>
> ---
> Unsure why nobody has done this yet.

While you're at it, why don't you add the ws up and down bindings from
World of Warcraft?

The reason nobody has done this yet is that vi predates the invention
of cursor keys. They keyboards Bill Joy was using in the 1970's did not
have standardized cursor keys, in large part because you can't cursor
around on a teletype printer. Once people started using "glass tty"
devices (vt100 and such) cursor keys got standardized within a few
years. They were reasonably ubiquitous by the time the IBM PC showed up
(the vic 20 and commodore 64 and such all had them; anything that
displayed to a television instead of through a daisy wheel).

They also didn't have ALT or control keys. The vi modal interface is a
legacy of not having any standardized keys on the keyboard except
letters, numbers, and (for 8 bit machines) shift. (There's a song
"double bucky" to the tune of "Rubber Ducky" that commemorates a
particular bespoke keyboard design from MIT in the 1970's.) Even the
punctuation was potluck for a while there, although they could copy
manual typewriters and the IBM selectric and such for some of that.

And now you know _why_ Linux is over 20 years old and has never needed
this.

Rob-

2013-07-07 18:30:54

by Ramkumar Ramachandra

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

Rob Landley wrote:
>> Unsure why nobody has done this yet.
>
> [...]
> And now you know _why_ Linux is over 20 years old and has never needed this.

I was just asking out of curiosity: I'm not old enough to know that
much history. Isn't it a nice convenience to have _now_? Or do you
have something against it?

2013-07-08 23:08:47

by Soren Brinkmann

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

On Sat, Jul 06, 2013 at 06:00:05PM -0500, Rob Landley wrote:
> On 07/05/2013 06:32:59 AM, Ramkumar Ramachandra wrote:
> >Like in Vim.
> >
> >Cc: Michal Marek <[email protected]>
> >Signed-off-by: Ramkumar Ramachandra <[email protected]>
> >---
> > Unsure why nobody has done this yet.
>
> While you're at it, why don't you add the ws up and down bindings
> from World of Warcraft?
>
> The reason nobody has done this yet is that vi predates the
> invention of cursor keys. They keyboards Bill Joy was using in the
> 1970's did not have standardized cursor keys, in large part because
> you can't cursor around on a teletype printer. Once people started
> using "glass tty" devices (vt100 and such) cursor keys got
> standardized within a few years. They were reasonably ubiquitous by
> the time the IBM PC showed up (the vic 20 and commodore 64 and such
> all had them; anything that displayed to a television instead of
> through a daisy wheel).
>
> They also didn't have ALT or control keys. The vi modal interface is
> a legacy of not having any standardized keys on the keyboard except
> letters, numbers, and (for 8 bit machines) shift. (There's a song
> "double bucky" to the tune of "Rubber Ducky" that commemorates a
> particular bespoke keyboard design from MIT in the 1970's.) Even the
> punctuation was potluck for a while there, although they could copy
> manual typewriters and the IBM selectric and such for some of that.
>
> And now you know _why_ Linux is over 20 years old and has never
> needed this.
Well, one advantage of these key bindings is, that you don't have to
move your hands away from the base line. And as vim user I find myself
using vim key sequences in all tools. I cannot even count how many
processes I accidentally killed because I tried to scroll using 'k' in
htop where it does 'kill'.

In a nutshell: I'm all for vim key bindings everywhere!

But on the other hand, I can see that it might lead straight to chaos when
everybody pushes his favorite key bindings.

Sören

2013-07-09 16:36:18

by Rob Landley

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

On 07/08/2013 06:08:41 PM, S?ren Brinkmann wrote:
> On Sat, Jul 06, 2013 at 06:00:05PM -0500, Rob Landley wrote:
> > On 07/05/2013 06:32:59 AM, Ramkumar Ramachandra wrote:
> > >Like in Vim.
> > >
> > >Cc: Michal Marek <[email protected]>
> > >Signed-off-by: Ramkumar Ramachandra <[email protected]>
> > >---
> > > Unsure why nobody has done this yet.
> >
> > While you're at it, why don't you add the ws up and down bindings
> > from World of Warcraft?
> >
> > The reason nobody has done this yet is that vi predates the
> > invention of cursor keys. They keyboards Bill Joy was using in the
...
> > And now you know _why_ Linux is over 20 years old and has never
> > needed this.
>
> Well, one advantage of these key bindings is, that you don't have to
> move your hands away from the base line. And as vim user I find myself
> using vim key sequences in all tools. I cannot even count how many
> processes I accidentally killed because I tried to scroll using 'k' in
> htop where it does 'kill'.

A ringing endorsement.

Rob-

2013-07-09 17:00:36

by Heimo Stranner

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu


> Well, one advantage of these key bindings is, that you don't have to
> move your hands away from the base line. And as vim user I find myself
> using vim key sequences in all tools. I cannot even count how many
> processes I accidentally killed because I tried to scroll using 'k' in
> htop where it does 'kill'.
>
> In a nutshell: I'm all for vim key bindings everywhere!
>
I can't agree more!

Because vim key bindings are rather common I can't see a problem if this
patch is applied.

2013-07-09 17:07:47

by Steven Noonan

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

On Tue, Jul 9, 2013 at 9:55 AM, Heimo Stranner <[email protected]> wrote:
>
>> Well, one advantage of these key bindings is, that you don't have to
>> move your hands away from the base line. And as vim user I find myself
>> using vim key sequences in all tools. I cannot even count how many
>> processes I accidentally killed because I tried to scroll using 'k' in
>> htop where it does 'kill'.
>>
>> In a nutshell: I'm all for vim key bindings everywhere!
>>
> I can't agree more!
>
> Because vim key bindings are rather common I can't see a problem if this
> patch is applied.

The biggest problem I see is the conflict between j/k and the letter
shortcuts used to jump to specific menu items (the letter highlighted
in blue on each item). But I haven't ever used that functionality in
practice, so who knows.

2013-07-09 17:16:03

by Heimo Stranner

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

On 2013-07-09 19:07, Steven Noonan wrote:
> On Tue, Jul 9, 2013 at 9:55 AM, Heimo Stranner <[email protected]> wrote:
>>> Well, one advantage of these key bindings is, that you don't have to
>>> move your hands away from the base line. And as vim user I find myself
>>> using vim key sequences in all tools. I cannot even count how many
>>> processes I accidentally killed because I tried to scroll using 'k' in
>>> htop where it does 'kill'.
>>>
>>> In a nutshell: I'm all for vim key bindings everywhere!
>>>
>> I can't agree more!
>>
>> Because vim key bindings are rather common I can't see a problem if this
>> patch is applied.
> The biggest problem I see is the conflict between j/k and the letter
> shortcuts used to jump to specific menu items (the letter highlighted
> in blue on each item). But I haven't ever used that functionality in
> practice, so who knows.
I haven't thought about that. Obviously you are right, "Kernel hacking"
and "Kernel compression mode" just being two examples that use k which I
found in a very quick search.

2013-07-10 14:56:09

by Michal Marek

[permalink] [raw]
Subject: Re: [PATCH] menuconfig: Allow j/k to move down/up the menu

Dne 9.7.2013 01:08, Sören Brinkmann napsal(a):
> On Sat, Jul 06, 2013 at 06:00:05PM -0500, Rob Landley wrote:
>> On 07/05/2013 06:32:59 AM, Ramkumar Ramachandra wrote:
>>> Like in Vim.
>>>
>>> Cc: Michal Marek <[email protected]>
>>> Signed-off-by: Ramkumar Ramachandra <[email protected]>
>>> ---
>>> Unsure why nobody has done this yet.
>>
>> While you're at it, why don't you add the ws up and down bindings
>> from World of Warcraft?
>>
[...]
> Well, one advantage of these key bindings is, that you don't have to
> move your hands away from the base line. And as vim user I find myself
> using vim key sequences in all tools.

One issue here is that j and k are already taken. Letters other than
h/m/n/y are used as hotkeys in menuconfig/nconf, if there is a menu item
starting with the respective letter. So at a minimum, the patch would
have to add j and k to the reserved set.

Michal