src/nnn.c | 7 ++++++- src/nnn.h | 3 +++ diff --git a/src/nnn.c b/src/nnn.c index dbc64197fd50e5bfa15e0313492f6dc1a865ca73..566d12c6a84512456cdf1e4287c31b934c008173 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -7454,13 +7454,14 @@ case SEL_RENAMEMUL: // fallthrough 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) { @@ -7497,6 +7498,10 @@ goto nochange; case SEL_EDIT: 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(); diff --git a/src/nnn.h b/src/nnn.h index cdba884de711ea4f25bed0cdb820f0c4514535c1..adfb83b40393c26da59cdf729651bfd5a778525f 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -118,6 +118,7 @@ SEL_QUITCTX, SEL_QUITCD, SEL_QUIT, SEL_QUITERR, + SEL_VIEW, #ifndef NOMOUSE SEL_CLICK, #endif @@ -259,6 +260,8 @@ { CONTROL('J'), SEL_AUTONEXT }, /* 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 */