diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | nnn.1 | 2 | ||||
-rw-r--r-- | nnn.c | 16 | ||||
-rw-r--r-- | nnn.h | 3 |
4 files changed, 22 insertions, 4 deletions
@@ -90,7 +90,7 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To - Desktop search (gnome-search-tool, catfish) integration - Mimes - Open with desktop opener (default) or specify a custom app - - List and extract archives (needs atool) + - Create, list and extract archives (needs atool) - Optionally open text files in EDITOR (fallback vi) - Customizable bash script [nlay](https://github.com/jarun/nnn/wiki/all-about-nlay) to handle actions - Information @@ -237,6 +237,7 @@ optional arguments: e | Edit entry in EDITOR o | Open DE filemanager p | Open entry in PAGER + f | Archive entry F | List archive ^F | Extract archive ^K | Copy file path @@ -291,7 +292,7 @@ The following abbreviations are used in the detail view: | xdg-open (Linux), open(1) (OS X) | desktop opener | | mediainfo, exiftool | multimedia file details | | gnome-search-tool, catfish | desktop search utility | -| atool | list and extract archives | +| atool | create, list and extract archives | | vidir from moreutils | batch rename, move, delete dir entries | | vlock (Linux) | terminal locker | | $EDITOR ($VISUAL, if defined) | edit files (fallback vi) | @@ -100,6 +100,8 @@ Open current entry in EDITOR (fallback vi) Open directory in NNN_DE_FILE_MANAGER .It Ic p Open current entry in PAGER (fallback less) +.It Ic f +Archive current entry .It Ic F List files in archive .It Ic ^F @@ -273,7 +273,8 @@ static struct timespec gtimeout; #define OPENER 2 #define NLAY 3 #define ATOOL 4 -#define VIDIR 5 +#define APACK 5 +#define VIDIR 6 /* Utilities to open files, run actions */ static char * const utils[] = { @@ -286,6 +287,7 @@ static char * const utils[] = { #endif "nlay", "atool", + "apack", "vidir" }; @@ -1966,6 +1968,7 @@ show_help(char *path) "ee | Edit entry in EDITOR\n" "eo | Open DE filemanager\n" "ep | Open entry in PAGER\n" + "ef | Archive entry\n" "eF | List archive\n" "d^F | Extract archive\n" "d^K | Copy file path\n" @@ -3068,8 +3071,9 @@ nochange: goto nochange; case SEL_OPEN: printprompt("open with: "); // fallthrough + case SEL_ARCHIVE: // fallthrough case SEL_NEW: - if (sel == SEL_NEW) + if (sel != SEL_OPEN) printprompt("name: "); tmp = xreadline(NULL); @@ -3095,7 +3099,15 @@ nochange: mkpath(path, dents[cur].name, newpath, PATH_MAX); spawn(tmp, newpath, NULL, path, r); + continue; + } else if (sel == SEL_ARCHIVE) { + /* newpath is used as temporary buffer */ + if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) { + printmsg("apack missing"); + continue; + } + spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL); continue; } @@ -27,6 +27,7 @@ enum action { SEL_MEDIA, SEL_FMEDIA, SEL_DFB, + SEL_ARCHIVE, SEL_LIST, SEL_EXTRACT, SEL_FSIZE, @@ -137,6 +138,8 @@ static struct key bindings[] = { { 'M', SEL_FMEDIA, "-f", "" }, /* Open dir in desktop file manager */ { 'o', SEL_DFB, "", "" }, + /* Create archive */ + { 'f', SEL_ARCHIVE, "", "" }, /* List archive */ { 'F', SEL_LIST, "-l", "" }, /* Extract archive */ |