fe
terminal file explorer and picker
git clone https://9o.is/git/fe.git
commit b9abf791c0354bcb043daaa1c9aeccc0b1e3892c parent cdd103570585a634786b99d119206e1655fba659 Author: Jul <jul@9o.is> Date: Fri, 6 Feb 2026 11:28:05 -0500 save personal config.h Diffstat:
| M | .gitignore | | | 1 | - |
| M | Makefile | | | 2 | +- |
| A | config.h | | | 77 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -1,5 +1,4 @@ *.d *.o -config.h compats.h fe diff --git a/Makefile b/Makefile @@ -26,7 +26,7 @@ all: fe fe: config.h $(OBJS) $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJS) -config.h: config.def.h +config.h: cp config.def.h config.h install: fe diff --git a/config.h b/config.h @@ -0,0 +1,77 @@ +#include "tty.h" +#include "tty_interface.h" +#include "options.h" + +#define TTY_COLOR_BLACK 0 +#define TTY_COLOR_RED 1 +#define TTY_COLOR_GREEN 2 +#define TTY_COLOR_YELLOW 3 +#define TTY_COLOR_BLUE 4 +#define TTY_COLOR_MAGENTA 5 +#define TTY_COLOR_CYAN 6 +#define TTY_COLOR_WHITE 7 +#define TTY_COLOR_NORMAL 9 + +#define COLOR_DIRECTORY TTY_COLOR_BLUE +#define COLOR_LINK TTY_COLOR_CYAN +#define COLOR_SOCK TTY_COLOR_YELLOW +#define COLOR_FIFO TTY_COLOR_MAGENTA +#define COLOR_EXEC TTY_COLOR_GREEN +#define COLOR_REGULAR TTY_COLOR_NORMAL + +#define KEY(key) ((const char[]){key, '\0'}) +#define KEY_CTRL(key) ((const char[]){((key) - ('@')), '\0'}) + +static const keybinding_t keybindings[] = { + {"\x1b", action_exit, NULL}, /* ESC */ + {KEY_CTRL('C'), action_exit, NULL}, /* C-C */ + {KEY_CTRL('M'), action_select, NULL}, /* CR */ + {KEY_CTRL('P'), action_prev, NULL}, /* C-P */ + {KEY_CTRL('N'), action_next, NULL}, /* C-N */ + {KEY_CTRL('K'), action_prev, NULL}, /* C-K */ + {KEY_CTRL('J'), action_next, NULL}, /* C-J */ + {KEY_CTRL('U'), action_halfpageup, NULL}, /* C-U */ + {KEY_CTRL('D'), action_halfpagedown, NULL}, /* C-D */ + {KEY('q'), action_exit, NULL}, /* q */ + {KEY('r'), action_reload, NULL}, /* r */ + {KEY('g'), action_first, NULL}, /* g */ + {KEY('G'), action_last, NULL}, /* G */ + {KEY('~'), action_home, NULL}, /* ~ */ + {KEY('.'), action_togglehidden, NULL}, /* . */ + {KEY('%'), action_create, NULL}, /* % (create) */ + {KEY('D'), action_mkdir, NULL}, /* D (mkdir) */ + {KEY('d'), action_remove, NULL}, /* d (delete/remove) */ + {KEY('x'), action_cut, NULL}, /* x (cut) */ + {KEY('y'), action_copy, NULL}, /* y */ + {KEY('p'), action_paste, NULL}, /* p */ + {KEY('l'), action_run, "less %s/%s"}, /* l (less/look) */ + {KEY('t'), action_run, "tmux new-window -b 'vis %s/%s'"}, /* edit new tab */ + {KEY('f'), action_setpath, "ag -g . %s | fzy"}, /* s (search) */ + {KEY('-'), action_parent, NULL}, /* - */ + {"\x1bOD", action_parent, NULL}, /* LEFT */ + {"\x1b[D", action_parent, NULL}, /* LEFT */ + {"\x1bOC", action_select, NULL}, /* RIGHT */ + {"\x1b[C", action_select, NULL}, /* RIGHT */ + {"\x1b[A", action_prev, NULL}, /* UP */ + {"\x1bOA", action_prev, NULL}, /* UP */ + {"\x1b[B", action_next, NULL}, /* DOWN */ + {"\x1bOB", action_next, NULL}, /* DOWN */ + {"\x1b[5~", action_pageup, NULL}, + {"\x1b[6~", action_pagedown, NULL}, + {"\x1b[200~", action_ignore, NULL}, + {"\x1b[201~", action_ignore, NULL}, + {NULL, NULL, NULL}}; + +static const options_t default_options = { + .num_files = 25, + .tty_filename = "/dev/tty", + .keytimeout = 25, + .sort_dir = 1, + .sort_icase = 1, + .sort_mtime = 0, + .show_hidden = 1, + .keybindings = keybindings, +}; + +#undef KEY_CTRL +#undef KEY