From 8bc71c6e5b06ae3d01da142417dc92340fa91e5e Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 7 Aug 2019 19:47:17 +0530 Subject: [PATCH] Key Lead' to go to first file in dir --- README.md | 1 + src/nnn.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 20cb9a26..0663d9ed 100644 --- a/README.md +++ b/README.md @@ -323,6 +323,7 @@ The Leader/Lead key provides a powerful multi-functional navigation mechanism. I | >, . | Go to next active context | | <, , | Go to previous active context | | key | Go to bookmarked location | +| ' | Go to first file in directory | | ~ ` @ - | Go to HOME, `/`, start, last visited dir | | q | Quit context | diff --git a/src/nnn.c b/src/nnn.c index f41558b9..8756b0de 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3669,6 +3669,16 @@ nochange: case '@': presel = fd; goto nochange; + case '\'': + for (r = 0; r < ndents; ++r) { + if (!(dents[r].flags & DIR_OR_LINK_TO_DIR)) { + move_cursor((r) % ndents, 0); + break; + } + } + if (r != ndents) + continue;; + goto nochange; case '>': // fallthrough case '.': // fallthrough case '<': // fallthrough