Use functions instead of enum for config

This commit is contained in:
Night Kaly 2024-11-21 17:33:22 +00:00
parent 6f976e9ede
commit 825eb2b9de
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM
2 changed files with 616 additions and 725 deletions

1237
ccc.c

File diff suppressed because it is too large Load diff

104
config.h
View file

@ -53,57 +53,57 @@ static char last_d[PATH_MAX] = "~/.cache/ccc/.ccc_d";
static char trash_dir[PATH_MAX] = "~/.cache/ccc/trash/"; static char trash_dir[PATH_MAX] = "~/.cache/ccc/trash/";
static Key keybindings[] = { static Key keybindings[] = {
{'q', ACT_QUIT}, {'q', quit, {0}},
{'z', ACT_RELOAD}, {'z', reload, {0}},
{BACKSPACE, ACT_BACK}, {BACKSPACE, nav_back, {0}},
{ARROW_LEFT, ACT_BACK}, {ARROW_LEFT, nav_back, {0}},
{'h', ACT_BACK}, {'h', nav_back, {0}},
{ENTER, ACT_ENTER}, {ENTER, nav_enter, {0}},
{ARROW_RIGHT, ACT_ENTER}, {ARROW_RIGHT, nav_enter, {0}},
{'l', ACT_ENTER}, {'l', nav_enter, {0}},
{CTRLU, ACT_JUMP_UP}, {CTRLU, nav_jump_up, {0}},
{CTRLD, ACT_JUMP_DOWN}, {CTRLD, nav_jump_down, {0}},
{ARROW_DOWN, ACT_DOWN}, {ARROW_UP, nav_up, {0}},
{ARROW_UP, ACT_UP}, {'k', nav_up, {0}},
{'k', ACT_UP}, {ARROW_DOWN, nav_down, {0}},
{'j', ACT_DOWN}, {'j', nav_down, {0}},
{'G', ACT_BOTTOM}, {'G', nav_bottom, {0}},
{'g', ACT_TOP}, {'g', nav_top, {0}},
{'~', ACT_HOME}, {'~', goto_home_dir, {0}},
{'t', ACT_TRASH_DIR}, {'t', goto_trash_dir, {0}},
{'u', ACT_SORT}, {'u', sort_files, {0}},
{'A', ACT_SHOW_DIR_SIZE}, {'A', show_dir_size, {0}},
{'-', ACT_PREV_DIR}, {'-', prev_dir, {0}},
{'?', ACT_SHOW_HELP}, {'?', show_help, {0}},
{'.', ACT_HIDDEN_FILES}, {'.', toggle_hidden_files, {0}},
{'i', ACT_FILE_DETAILS}, {'i', toggle_file_details, {0}},
{'w', ACT_SHOW_ICONS}, {'w', toggle_show_icons, {0}},
{'f', ACT_CREATE_FILE}, {'f', create_file, {0}},
{'n', ACT_CREATE_DIR}, {'n', create_dir, {0}},
{'r', ACT_RENAME_FILE}, {'r', rename_file, {0}},
{':', ACT_GOTO_DIR}, {':', goto_dir, {0}},
{'X', ACT_TOGGLE_EXE}, {'X', toggle_executable, {0}},
{'!', ACT_START_SHELL}, {'!', start_shell, {0}},
{'y', ACT_COPY_FILENAME}, {'y', yank_clipboard, {0}},
{'o', ACT_OPEN_FILE}, {'o', open_with, {0}},
{'O', ACT_OPEN_FILE_DETACHED}, {'O', open_detached, {0}},
{'x', ACT_VIEW_FILE_ATTR}, {'x', view_file_attr, {0}},
{'e', ACT_SHOW_HIST}, {'e', show_history, {0}},
{'1', ACT_FAV1}, {'1', open_fav, {.i = 1}},
{'2', ACT_FAV2}, {'2', open_fav, {.i = 2}},
{'3', ACT_FAV3}, {'3', open_fav, {.i = 3}},
{'4', ACT_FAV4}, {'4', open_fav, {.i = 4}},
{'5', ACT_FAV5}, {'5', open_fav, {.i = 5}},
{'6', ACT_FAV6}, {'6', open_fav, {.i = 6}},
{'7', ACT_FAV7}, {'7', open_fav, {.i = 7}},
{'8', ACT_FAV8}, {'8', open_fav, {.i = 8}},
{'9', ACT_FAV9}, {'9', open_fav, {.i = 9}},
{' ', ACT_MARK_FILE}, {' ', mark_file, {0}},
{'a', ACT_MARK_ALL}, {'a', mark_all, {0}},
{'d', ACT_DELETE}, {'d', delete_files, {0}},
{'m', ACT_MOVE}, {'m', move_files, {0}},
{'c', ACT_COPY}, {'c', copy_files, {0}},
{'s', ACT_SYM_LINK}, {'s', symbolic_link, {0}},
{'b', ACT_BULK_RENAME}, {'b', bulk_rename, {0}},
}; };