Commit 9a403458 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add vim style exec

Thanks to bashseb for the patch.

Closes: #423
Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 735b31e2
...@@ -523,10 +523,16 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list) ...@@ -523,10 +523,16 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
const char* path = zathura_document_get_path(zathura->document); const char* path = zathura_document_get_path(zathura->document);
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) {
girara_list_iterator_set(iter, r); if (r != NULL) {
} 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);
} }
......
...@@ -422,6 +422,7 @@ config_load_default(zathura_t* zathura) ...@@ -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"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment