src/nnn.c | 16 ++++++++++++++++ src/nnn.h | 6 ++++++ diff --git a/src/nnn.c b/src/nnn.c index 566d12c6a84512456cdf1e4287c31b934c008173..2d9f6dbc5cacdbff78f1c58192df04c4e61a5952 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -7889,6 +7889,22 @@ cd = FALSE; goto begin; } + case SEL_CD: // fallthrough + case SEL_COPY: + if (!xdiraccess(plgpath)) { + printwarn(&presel); + goto nochange; + } + endselection(FALSE); + tmp = sel == SEL_CD ? "!_nnn-cd*" : "!_nnn-cp"; + if (!run_plugin(&path, tmp, (ndents ? pdents[cur].name : NULL), + &lastname, &lastdir)) { + printwait(messages[MSG_FAILED], &presel); + goto nochange; + } + copycurname(); + setdirwatch(); + goto begin; case SEL_PLUGIN: /* Check if directory is accessible */ if (!xdiraccess(plgpath)) { diff --git a/src/nnn.h b/src/nnn.h index adfb83b40393c26da59cdf729651bfd5a778525f..16f5b4c95615b89d3dc6d8838f3beb4a86b8deb3 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -119,6 +119,8 @@ SEL_QUITCD, SEL_QUIT, SEL_QUITERR, SEL_VIEW, + SEL_COPY, + SEL_CD, #ifndef NOMOUSE SEL_CLICK, #endif @@ -264,6 +266,10 @@ /* View in PAGER */ { KEY_F(3), SEL_VIEW }, /* Run a plugin */ { ';', SEL_PLUGIN }, + /* Call _nnn-cd */ + { KEY_F(2), SEL_CD }, + /* Call _nnn-cp */ + { KEY_F(5), SEL_COPY }, /* Show total size of listed selection */ { 'S', SEL_SELSIZE }, /* Run command */