sfm

simple file manager
git clone https://git.afify.dev/sfm.git
Log | Files | Refs | README | LICENSE

commit c0daf1560f35287554b3976ac35558b6b378e553
parent b4e5238b89196c65487ce261920dff322fd810b3
Author: afify <hassan@afify.dev>
Date:   Sat, 10 Apr 2021 13:49:57 +0300

[ref] rename mvfor -> mvfwd, skeys -> vkeys

- mvfwd is more readable
- visual mode use visual keys (vkeys)

Diffstat:
Mconfig.def.h | 10++++++----
Msfm.c | 6+++---
2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -35,7 +35,7 @@ static const char *libreoffice[] = { "libreoffice", NULL }; static const char *gimp[] = { "gimp", NULL }; static const char *r2[] = { "r2", "-c", "vv", NULL }; -/* extension */ +/* extensions*/ static const char *images[] = { "bmp", "jpg", "jpeg", "png", "gif", "xpm" }; static const char *web[] = { "htm", "html" }; static const char *pdf[] = { "epub", "pdf" }; @@ -57,10 +57,11 @@ static Rule rules[] = { {obj, LEN(obj), r2}, }; +/* normal keys */ static Key nkeys[] = { { {.ch = 'j'}, mvdwn }, { {.ch = 'k'}, mvup }, - { {.ch = 'l'}, mvfor }, + { {.ch = 'l'}, mvfwd }, { {.ch = 'h'}, mvbk }, { {.ch = 'g'}, mvtop }, { {.ch = 'G'}, mvbtm }, @@ -81,7 +82,8 @@ static Key nkeys[] = { { {.key = TB_KEY_SPACE}, switch_pane }, }; -static Key skeys[] = { +/* visual keys */ +static Key vkeys[] = { { {.ch = 'j'}, seldwn }, { {.ch = 'k'}, selup }, { {.ch = 'a'}, selall }, @@ -93,7 +95,7 @@ static Key skeys[] = { }; static const size_t nkeyslen = LEN(nkeys); -static const size_t skeyslen = LEN(skeys); +static const size_t vkeyslen = LEN(vkeys); static const mode_t ndir_perm = S_IRWXU; static const mode_t nf_perm = S_IRUSR | S_IWUSR; diff --git a/sfm.c b/sfm.c @@ -131,7 +131,7 @@ static void mvbk(void); static void mvbtm(void); static void mvdwn(void); static void mvdwns(void); -static void mvfor(void); +static void mvfwd(void); static void mvmid(void); static void mvtop(void); static void mvup(void); @@ -853,7 +853,7 @@ mvdwns(void) } static void -mvfor(void) +mvfwd(void) { rmwatch(cpane); if (cpane->dirc < 1) @@ -1325,7 +1325,7 @@ start_vmode(void) while (tb_poll_event(&fev) != 0) { switch (fev.type) { case TB_EVENT_KEY: - grabkeys(&fev, skeys, skeyslen); + grabkeys(&fev, vkeys, vkeyslen); if (cont_vmode == -1) return; tb_present();