Skip to contentSkip to conversation

menuconfig: Allow j/k to move down/up the menu

PATCH In review Ramkumar Ramachandra 6 participants 9 messages Jul 5, 2013 – Jul 10, 2013 Kconfig

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 menuconfig: Allow j/k to move down/up the menu

Like in Vim.

---
Unsure why nobody has done this yet.

 scripts/kconfig/lxdialog/menubox.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/kconfig/lxdialog/menubox.c +3 -2
index 38cd69c..17fd936 100644
@@ -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) &&
Signature · 1 line
1.8.3.2.722.g3244e19.dirty
#1 lore raw
Quoted 6 lines · Ramkumar Ramachandra

Like in Vim.

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

#2 lore raw
Quoted 4 lines · Rob Landley
Quoted 1 line

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?

#3 lore raw
In reply to Rob Landley
Quoted 29 lines · Rob Landley
Quoted 6 lines · Ramkumar Ramachandra

Like in Vim.

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

Quoted 2 lines

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

#4 lore raw
Quoted 14 lines · Sören Brinkmann
Quoted 13 lines · Rob Landley
Quoted 6 lines · Ramkumar Ramachandra

Like in Vim.

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

...

Quoted 8 lines
Quoted 2 lines

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

#5 lore raw
In reply to Sören Brinkmann
Quoted 9 lines

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.

#6 lore raw
Quoted 7 lines · Heimo Stranner
Quoted 7 lines

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

Quoted 6 lines
Quoted 2 lines

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.

#7 lore raw
Quoted 9 lines · Steven Noonan
Quoted 8 lines · Heimo Stranner
Quoted 8 lines

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!

Quoted 8 lines
Quoted 4 lines

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.

#8 lore raw
In reply to Sören Brinkmann

Dne 9.7.2013 01:08, Sören Brinkmann napsal(a):

Quoted 12 lines · Rob Landley
Quoted 11 lines · Ramkumar Ramachandra
Quoted 6 lines

Like in Vim.

---
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?

[...]

Quoted 3 lines

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