diff --git a/keybinds.h b/keybinds.h index 4988bff..8803f17 100644 --- a/keybinds.h +++ b/keybinds.h @@ -39,6 +39,10 @@ static Key keys[] = { * * mode modifier key function argument */ { 1, 0, XK_Escape, switchmode, {0} }, + { 1, 0, XK_Up, move, {.i = 1 } }, + { 1, 0, XK_Down, move, {.i = 2 } }, + { 1, 0, XK_Left, move, {.i = 3 } }, + { 1, 0, XK_Right, move, {.i = 4 } }, /* normal mode * @@ -80,8 +84,10 @@ static Key keys[] = { { 0, SHIFT, XK_g, moveend, {0} }, { 0, 0, XK_Next, movenext, {0} }, { 0, 0, XK_Prior, moveprev, {0} }, - { 0, MODIFIER1, XK_b, moveword, {.i = -1 } }, - { 0, MODIFIER1, XK_f, moveword, {.i = +1 } }, + { 0, SHIFT, XK_Left, moveword, {.i = -1 } }, + { 0, SHIFT, XK_Right, moveword, {.i = +1 } }, + { 0, 0, XK_Left, movecursor, {.i = -1 } }, + { 0, 0, XK_Right, movecursor, {.i = +1 } }, { 0, MODIFIER1, XK_p, navhistory, {.i = -1 } }, { 0, MODIFIER1, XK_n, navhistory, {.i = +1 } }, @@ -92,9 +98,5 @@ static Key keys[] = { { -1, 0, XK_Tab, complete, {0} }, { -1, CONTROL, XK_v, paste, {.i = 1 } }, /* primary buffer */ { -1, CONTROL|SHIFT, XK_v, paste, {.i = 2 } }, - { -1, 0, XK_Up, move, {.i = 1 } }, - { -1, 0, XK_Down, move, {.i = 2 } }, - { -1, 0, XK_Left, move, {.i = 3 } }, - { -1, 0, XK_Right, move, {.i = 4 } }, { -1, 0, XK_BackSpace, backspace, {0} }, }; diff --git a/libs/arg.c b/libs/arg.c index 27a6920..409954b 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -200,6 +200,13 @@ moveword(const Arg *arg) drawmenu(); } +void +movecursor(const Arg *arg) +{ + cursor = arg->i ? nextrune(+1) : nextrune(-1); + drawmenu(); +} + void backspace(const Arg *arg) { diff --git a/libs/arg.h b/libs/arg.h index 888ac3e..4dd9023 100644 --- a/libs/arg.h +++ b/libs/arg.h @@ -16,6 +16,7 @@ static void restoresel(const Arg *arg); static void clear(const Arg *arg); static void viewhist(const Arg *arg); static void moveword(const Arg *arg); +static void movecursor(const Arg *arg); static void navhistory(const Arg *arg); static void backspace(const Arg *arg); static void selectitem(const Arg *arg);