From: Anders Damsgaard Date: Tue, 3 Feb 2015 09:27:51 +0000 (+0100) Subject: Add vi-ish navigation to first and last slide X-Git-Url: https://git.danieliu.xyz/?p=smdp.git;a=commitdiff_plain;h=6d627bac82f84e39beda51981ddf3a6ddabbbe78;hp=42a0fbc2fa198be33df372c198c225d6fb0de33e Add vi-ish navigation to first and last slide Navigate to first and last slide with 'g' and 'G', respectively. This resembles the behavior of vi, that uses 'gg' and 'G' for the first and last lines in a file. These keybinds are useful for keyboards without dedicated home/end keys. --- diff --git a/sample.md b/sample.md index b717393..95d767e 100644 --- a/sample.md +++ b/sample.md @@ -18,8 +18,8 @@ previous slide *Backspace*, *Page Up*, *h*, *k*, quit *q* reload *r* slide N *1..9* -first slide *Home* -last slide *End* +first slide *Home*, *g* +last slide *End*, *G* ------------------------------------------------- diff --git a/src/viewer.c b/src/viewer.c index b540b1a..3e391b1 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -394,12 +394,14 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa break; // show first slide + case 'g': case KEY_HOME: slide = deck->slide; sc = 1; break; // show last slide + case 'G': case KEY_END: for(i = sc; i <= deck->slides; i++) { if(slide->next) {