Added vim like keybindings

This commit is contained in:
Marco Raber 2021-12-14 16:17:26 +01:00
parent 705316fabe
commit 34302812fe

12
xmenu.c
View File

@ -1345,8 +1345,8 @@ enteritem:
break;
}
/* esc closes xmenu when current menu is the root menu */
if (ksym == XK_Escape && currmenu->parent == NULL)
/* esc (or h) closes xmenu when current menu is the root menu */
if ( (ksym == XK_h || ksym == XK_Escape) && currmenu->parent == NULL)
return;
/* Shift-Tab = ISO_Left_Tab */
@ -1372,7 +1372,7 @@ enteritem:
break;
}
/* FALLTHROUGH */
case XK_Up:
case XK_Up: case XK_k:
select = itemcycle(currmenu, ITEMPREV);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
@ -1383,7 +1383,7 @@ enteritem:
break;
}
/* FALLTHROUGH */
case XK_Down:
case XK_Down: case XK_j:
select = itemcycle(currmenu, ITEMNEXT);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
@ -1397,13 +1397,13 @@ enteritem:
select = item;
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_Return: case XK_Right:
case XK_Return: case XK_Right: case XK_l:
if (currmenu->selected) {
item = currmenu->selected;
goto enteritem;
}
break;
case XK_Escape: case XK_Left:
case XK_Escape: case XK_Left: case XK_h:
if (currmenu->parent) {
select = currmenu->parent->selected;
currmenu = currmenu->parent;