diff --git a/commands.c b/commands.c index c98c10b..8443f63 100644 --- a/commands.c +++ b/commands.c @@ -265,3 +265,19 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list) return true; } + +bool +cmd_search(girara_session_t* session, char* input, girara_argument_t* argument) +{ + g_return_val_if_fail(session != NULL, false); + g_return_val_if_fail(input != NULL, false); + g_return_val_if_fail(argument != NULL, false); + g_return_val_if_fail(session->global.data != NULL, false); + zathura_t* zathura = session->global.data; + + if (zathura->document == NULL) { + return false; + } + + return true; +} diff --git a/commands.h b/commands.h index 1f09318..3a80125 100644 --- a/commands.h +++ b/commands.h @@ -96,5 +96,14 @@ bool cmd_save(girara_session_t* session, girara_list_t* argument_list); */ bool cmd_savef(girara_session_t* session, girara_list_t* argument_list); +/** + * Search the current file + * + * @param session The used girara session + * @param input The current input + * @param argument Passed argument + * @return true if no error occured + */ +bool cmd_search(girara_session_t* session, char* input, girara_argument_t* argument); #endif // COMMANDS_H diff --git a/config.c b/config.c index 5cf1475..72f314f 100644 --- a/config.c +++ b/config.c @@ -122,6 +122,9 @@ config_load_default(zathura_t* zathura) girara_inputbar_command_add(gsession, "write", NULL, cmd_save, NULL, "Save document"); girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, NULL, "Save document (and force overwriting)"); + girara_special_command_add(gsession, '/', cmd_search, true, FORWARD, NULL); + girara_special_command_add(gsession, '?', cmd_search, true, BACKWARD, NULL); + /* add shortcut mappings */ girara_shortcut_mapping_add(gsession, "abort", sc_abort); girara_shortcut_mapping_add(gsession, "adjust_window", sc_adjust_window);