diff --git a/config.def.h b/config.def.h index a9c3456..aaab998 100644 --- a/config.def.h +++ b/config.def.h @@ -459,6 +459,7 @@ static KeyBinding vis_mode_prompt[] = { { { CONTROL('J') }, prompt_enter, { NULL } }, { { KEY(UP) }, prompt_up, { NULL } }, { { KEY(DOWN) }, prompt_down, { NULL } }, + { { KEY(BACKSPACE) }, prompt_backspace, { .i = MOVE_CHAR_PREV } }, { { KEY(HOME) }, movement, { .i = MOVE_FILE_BEGIN } }, { { CONTROL('B') }, movement, { .i = MOVE_FILE_BEGIN } }, { { KEY(END) }, movement, { .i = MOVE_FILE_END } }, diff --git a/vis.c b/vis.c index 17b7cf2..a0ff6a1 100644 --- a/vis.c +++ b/vis.c @@ -416,6 +416,7 @@ static void prompt_enter(const Arg *arg); /* cycle through past user inputs */ static void prompt_up(const Arg *arg); static void prompt_down(const Arg *arg); /* exit cmd if deleting the cmd prompt */ +static void prompt_backspace(const Arg *arg); /* blocks to read 3 consecutive digits and inserts the corresponding byte value */ static void insert_verbatim(const Arg *arg); /* scroll window content according to arg->i which can be either PAGE, PAGE_HALF, @@ -848,6 +849,14 @@ static void prompt_down(const Arg *arg) { } +static void prompt_backspace(const Arg *arg) { + char *s = editor_prompt_get(vis); + if (strcmp(s, "") == 0) + prompt_enter(arg); + else + delete(arg); +} + static void insert_verbatim(const Arg *arg) { int value = 0; for (int i = 0; i < 3; i++) {