#include "defines.h" #include "interactions.h" static mimetype mimetype_default_cmd[] = { /* mimetype shell command * ^ substring of "file --mime-type -b ./hovered" * this does mean that this list is checked for completely linear. * Example: * file --mime-type -b ./image.gif * gives us "image/gif", thusly if we want to open gif in mpv rather than feh, * we need to define "gif" before "image" */ { "text", "$EDITOR" }, { "gif", "mpv --loop-file=\"inf\"" }, { "image", "feh" }, { "video", "mpv" }, { "audio", "mpv" } }; static binding key_binding[] = { /*key action */ /*you cannot add bindings that include other bindings in its entirety * possible: mk, mf * not possible: gg, ggg * trying to use ggg will always fail as it will execute gg first instead, resetting the input buffer, thus never * reaching ggg */ { "q", quit_program }, { " ", toggle_selection }, /* on hovered file/directory */ { "u", update }, /* executes the entire backend and redrawing of the screen */ { "h", move_right }, /* moves one dir up */ { "t", move_down }, { "n", move_up }, { "s", move_left }, /* if a dir is hovered, cd into it, if a file is selected, see mimetype_default_cmd */ { "\n", open_with }, /* opens the hovered file with an arbitrary command */ { "r", rename_hovered }, /* renames currently hovered file/directory */ { "d", delete }, /* deletes currently hovered OR selected file/directory * this means that it does not delete the hovered files if files are already selected */ { "gg", jump_top }, { "G", jump_bottom }, { "mk", makedir }, { "mf", makefile }, { "a", toggle_hidden_files }, }; static unsigned long binding_count = sizeof(key_binding) / sizeof(binding); static unsigned long mimetype_default_count = sizeof(mimetype_default_cmd) / sizeof(mimetype);