mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 06:06:00 +01:00
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:
parent
735b31e2a5
commit
9a403458fe
2 changed files with 11 additions and 4 deletions
14
commands.c
14
commands.c
|
@ -523,10 +523,16 @@ cmd_exec(girara_session_t* session, girara_list_t* argument_list)
|
|||
const char* path = zathura_document_get_path(zathura->document);
|
||||
|
||||
GIRARA_LIST_FOREACH(argument_list, char*, iter, value)
|
||||
char* r = girara_replace_substring(value, "$FILE", path);
|
||||
if (r != NULL) {
|
||||
girara_list_iterator_set(iter, r);
|
||||
}
|
||||
char* r = girara_replace_substring(value, "$FILE", path);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
1
config.c
1
config.c
|
@ -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, "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, "!", 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, "open", "o", cmd_open, cc_open, _("Open document"));
|
||||
girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura"));
|
||||
|
|
Loading…
Reference in a new issue