diff --git a/client/common/common.c b/client/common/common.c index b005cf3..e539d79 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -188,6 +188,7 @@ usage(FILE *out, const char *name) " --scrollbar display scrollbar. (none (default), always, autohide)\n" " --counter display a matched/total items counter. (none (default), always)\n" " -e, --vim-esc-exits exit bemenu when pressing escape in normal mode for vim bindings\n" + " -N, --vim-normal-mode start in normal mode for vim bindings\n" " --accept-single immediately return if there is only one item.\n" " --ifne only display menu if there are items.\n" " --single-instance force a single menu instance.\n" @@ -283,6 +284,7 @@ do_getopt(struct client *client, int *argc, char **argv[]) { "scrollbar", required_argument, 0, 0x100 }, { "counter", required_argument, 0, 0x10a }, { "vim-esc-exits",no_argument, 0, 'e' }, + { "vim-normal-mode",no_argument, 0, 'N'}, { "accept-single",no_argument, 0, 0x11a }, { "auto-select", no_argument, 0, 0x11b }, { "ifne", no_argument, 0, 0x117 }, @@ -388,6 +390,9 @@ do_getopt(struct client *client, int *argc, char **argv[]) case 'e': client->vim_esc_exits = true; break; + case 'N': + client->vim_init_mode_normal = true; + break; case 0x11a: client->accept_single = true; break; @@ -559,6 +564,10 @@ menu_with_options(struct client *client) if (!(menu = bm_menu_new(NULL))) return NULL; + if (client->vim_init_mode_normal) { + menu->vim_mode = 'n'; + } + client->fork = (client->force_fork || (bm_renderer_get_priorty(bm_menu_get_renderer(menu)) != BM_PRIO_TERMINAL)); bm_menu_set_font(menu, client->font); diff --git a/client/common/common.h b/client/common/common.h index 7899f30..e5ed9ab 100644 --- a/client/common/common.h +++ b/client/common/common.h @@ -31,6 +31,7 @@ struct client { bool fixed_height; bool counter; bool vim_esc_exits; + bool vim_init_mode_normal; bool accept_single; bool auto_select; bool ifne; diff --git a/man/bemenu.1.scd.in b/man/bemenu.1.scd.in index a9ad263..a4ae249 100644 --- a/man/bemenu.1.scd.in +++ b/man/bemenu.1.scd.in @@ -117,6 +117,9 @@ list of executables under PATH and the selected items are executed. *-e, --vim-esc-exits* Exit bemenu when pressing escape in normal mode for vim bindings. +*-N, --vim-normal-mode* + Start in normal mode for vim bindings. + *-F, --filter* Filter items for a given string before showing the menu. Affects *--ifne* and *--accept-single*