2015-06-05 13:14:28 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
Merge pull request #8 from joshaw/add-jmp-top-bot Add keybinding to jump to top/bottom of listing.
diff --git a/README.md b/README.md index b421f9a..2692cf9 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Quick Start ? - show Rover manual j/k - move cursor down/up J/K - move cursor down/up 10 lines + g/G - move cursor to top/bottom of listing l - enter selected directory h - go to parent directory H - go to $HOME directory diff --git a/config.h b/config.h index 1d10ed0..8e3e929 100644 --- a/config.h +++ b/config.h @@ -8,6 +8,8 @@ #define RVK_UP "k" #define RVK_JUMP_DOWN "J" #define RVK_JUMP_UP "K" +#define RVK_JUMP_TOP "g" +#define RVK_JUMP_BOTTOM "G" #define RVK_CD_DOWN "l" #define RVK_CD_UP "h" #define RVK_HOME "H" diff --git a/rover.1 b/rover.1 index e72d3da..4a575ae 100644 --- a/rover.1 +++ b/rover.1 @@ -72,6 +72,9 @@ Move cursor down/up. .B J/K Move cursor down/up 10 lines. .TP +.B g/G +Move cursor to top/bottom of listing. +.TP .B l Enter selected directory. .TP diff --git a/rover.c b/rover.c index 4e79093..57e301f 100644 --- a/rover.c +++ b/rover.c @@ -848,6 +848,16 @@ main(int argc, char *argv[]) ESEL = MAX(ESEL - RV_JUMP, 0); SCROLL = MAX(SCROLL - RV_JUMP, 0); update_view(); + } else if (!strcmp(key, RVK_JUMP_TOP)) { + if (!rover.nfiles) continue; + ESEL = 0; + SCROLL = 0; + update_view(); + } else if (!strcmp(key, RVK_JUMP_BOTTOM)) { + if (!rover.nfiles) continue; + ESEL = rover.nfiles - 1; + SCROLL = HEIGHT - rover.nfiles - 1; + update_view(); } else if (!strcmp(key, RVK_CD_DOWN)) { if (!rover.nfiles || !S_ISDIR(EMODE(ESEL))) continue; strcat(CWD, ENAME(ESEL));