Add vim style exec

Thanks to bashseb for the patch.

Closes: #423

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-09-27 01:37:31 +02:00
parent 735b31e2a5
commit 9a403458fe
2 changed files with 11 additions and 4 deletions

View file

@ -524,8 +524,14 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
GIRARA_LIST_FOREACH(argument_list, char*, iter, value) GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
char* r = girara_replace_substring(value, "$FILE", path); char* r = girara_replace_substring(value, "$FILE", path);
if (r != NULL) { if (r != NULL) {
girara_list_iterator_set(iter, r); char* s = girara_replace_substring(r, "%", path);
g_free(r);
if (s != NULL) {
girara_list_iterator_set(iter, s);
}
} }
GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value); GIRARA_LIST_FOREACH_END(argument_list, char*, iter, value);
} }

View file

@ -422,6 +422,7 @@ config_load_default(zathura_t* zathura)
girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file")); girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file"));
girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information")); girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information"));
girara_inputbar_command_add(gsession, "exec", NULL, cmd_exec, NULL, _("Execute a command")); girara_inputbar_command_add(gsession, "exec", NULL, cmd_exec, NULL, _("Execute a command"));
girara_inputbar_command_add(gsession, "!", NULL, cmd_exec, NULL, _("Execute a command")); /* like vim */
girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help")); girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help"));
girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document")); girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document"));
girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura")); girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura"));