From: Sergey Matveev Date: Thu, 26 Oct 2023 13:53:23 +0000 (+0300) Subject: F3 view X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6102bb6f8bc3829c36c723d99be2d44692e8d2e3;p=nnn.git F3 view --- diff --git a/src/nnn.c b/src/nnn.c index dbc64197..566d12c6 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -7454,13 +7454,14 @@ nochange: case SEL_HELP: // fallthrough case SEL_AUTONEXT: // fallthrough case SEL_EDIT: // fallthrough + case SEL_VIEW: // fallthrough case SEL_LOCK: { bool refresh = FALSE; if (ndents) mkpath(path, pdents[cur].name, newpath); - else if (sel == SEL_EDIT) /* Avoid trying to edit a non-existing file */ + else if ((sel == SEL_EDIT) || (sel == SEL_VIEW)) /* Avoid trying to edit a non-existing file */ goto nochange; switch (sel) { @@ -7498,6 +7499,10 @@ nochange: if (!(g_state.picker || g_state.fifomode)) spawn(editor, newpath, NULL, NULL, F_CLI); continue; + case SEL_VIEW: + if (!(g_state.picker || g_state.fifomode)) + spawn(pager, newpath, NULL, NULL, F_CLI); + continue; default: /* SEL_LOCK */ lock_terminal(); break; diff --git a/src/nnn.h b/src/nnn.h index cdba884d..adfb83b4 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -118,6 +118,7 @@ enum action { SEL_QUITCD, SEL_QUIT, SEL_QUITERR, + SEL_VIEW, #ifndef NOMOUSE SEL_CLICK, #endif @@ -259,6 +260,8 @@ static struct key bindings[] = { /* Edit in EDITOR */ { 'e', SEL_EDIT }, { KEY_F(4), SEL_EDIT }, + /* View in PAGER */ + { KEY_F(3), SEL_VIEW }, /* Run a plugin */ { ';', SEL_PLUGIN }, /* Show total size of listed selection */