diff --git a/keybinds.h b/keybinds.h index dc9216a..dd39994 100644 --- a/keybinds.h +++ b/keybinds.h @@ -15,7 +15,8 @@ static Shortcut shortcuts[] = { { ControlMask, XK_y, clipcopy, {.i = 0} }, { ControlMask, XK_p, clippaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { ControlMask|ShiftMask, XK_k, kscrollup, {.i = +1} }, - { ControlMask|ShiftMask, XK_j, kscrolldown, {.i = +1} }, - { ControlMask|ShiftMask, XK_U, externalpipe, { .v = listurl } }, + { ControlMask|ShiftMask, XK_E, kexec, {.ca = "nvim" } }, + { ControlMask|ShiftMask, XK_K, kscrollup, {.i = +1} }, + { ControlMask|ShiftMask, XK_J, kscrolldown, {.i = +1} }, + { ControlMask|ShiftMask, XK_U, externalpipe, {.v = listurl } }, }; diff --git a/st.c b/st.c index d0a057e..0f2b9af 100644 --- a/st.c +++ b/st.c @@ -834,6 +834,23 @@ execsh(char *cmd, char **args) _exit(1); } +void +kexec(const Arg *a) +{ + char buf[strlen(a->ca) + 2]; + snprintf(buf, sizeof buf, "%s%s", a->ca, "\n"); + ttywrite(buf, sizeof buf, 0); +} + + +void +kwrite(const Arg *a) +{ + char buf[strlen(a->ca) + 1]; + snprintf(buf, sizeof buf, "%s", a->ca); + ttywrite(buf, sizeof buf, 0); +} + void sigusr1(int unused) { diff --git a/st.h b/st.h index a8638f3..b6149cc 100644 --- a/st.h +++ b/st.h @@ -83,6 +83,7 @@ typedef union { int i; uint ui; float f; + char *ca; const void *v; const char *s; } Arg; @@ -95,6 +96,8 @@ void kscrolldown(const Arg *); void kscrollup(const Arg *); void externalpipe(const Arg *); void externalpipein(const Arg *); +void kexec(const Arg *); +void kwrite(const Arg *); void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *);