From e1bd7c68524e8fac8279863d8b5f3b249f22942d Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 18:39:21 +0530 Subject: [PATCH 01/40] Drop the .sh subscripts --- user-scripts/README.md | 16 ++++++++-------- user-scripts/{copier.sh => copier} | 0 user-scripts/{edit.sh => edit} | 0 user-scripts/{fzy.sh => fzy} | 0 user-scripts/{imgur.sh => imgur} | 0 user-scripts/{picker.sh => picker} | 0 user-scripts/{sxiv.sh => sxiv} | 0 user-scripts/{upgrade.sh => upgrade} | 0 8 files changed, 8 insertions(+), 8 deletions(-) rename user-scripts/{copier.sh => copier} (100%) rename user-scripts/{edit.sh => edit} (100%) rename user-scripts/{fzy.sh => fzy} (100%) rename user-scripts/{imgur.sh => imgur} (100%) rename user-scripts/{picker.sh => picker} (100%) rename user-scripts/{sxiv.sh => sxiv} (100%) rename user-scripts/{upgrade.sh => upgrade} (100%) diff --git a/user-scripts/README.md b/user-scripts/README.md index 2c1b985..49c482b 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -1,12 +1,12 @@ -#### List of scripts +#### Alphabetical list of scripts | Script | Description | | --- | --- | -| copier.sh | Copy selection to clipboard | -| edit.sh | Fuzzy find a file in directory subtree with fzy and edit in vim | -| fzy.sh | Fuzzy find a file in directory subtree with fzy and open using xdg-open | -| imgur.sh | Upload an image file to imgur | +| copier | Copy selection to clipboard | +| edit | Fuzzy find a file in directory subtree with fzy and edit in vim | +| fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open | +| imgur | Upload an image file to imgur | | nlaunch | drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | -| picker.sh | Pick files and pipe the newline-separated list to another utility | -| sxiv.sh | Open images in current directory in sxiv | -| upgrade.sh | Check and update to latest version of nnn manually on Debian 9 Stretch | +| picker | Pick files and pipe the newline-separated list to another utility | +| sxiv | Open images in current directory in sxiv | +| upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch | diff --git a/user-scripts/copier.sh b/user-scripts/copier similarity index 100% rename from user-scripts/copier.sh rename to user-scripts/copier diff --git a/user-scripts/edit.sh b/user-scripts/edit similarity index 100% rename from user-scripts/edit.sh rename to user-scripts/edit diff --git a/user-scripts/fzy.sh b/user-scripts/fzy similarity index 100% rename from user-scripts/fzy.sh rename to user-scripts/fzy diff --git a/user-scripts/imgur.sh b/user-scripts/imgur similarity index 100% rename from user-scripts/imgur.sh rename to user-scripts/imgur diff --git a/user-scripts/picker.sh b/user-scripts/picker similarity index 100% rename from user-scripts/picker.sh rename to user-scripts/picker diff --git a/user-scripts/sxiv.sh b/user-scripts/sxiv similarity index 100% rename from user-scripts/sxiv.sh rename to user-scripts/sxiv diff --git a/user-scripts/upgrade.sh b/user-scripts/upgrade similarity index 100% rename from user-scripts/upgrade.sh rename to user-scripts/upgrade From 4fc8d1edd18d758c6cf43e5b936ab23fe7b5579a Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 18:43:21 +0530 Subject: [PATCH 02/40] Changes for #226 --- user-scripts/README.md | 1 + user-scripts/kdeconnect | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/user-scripts/README.md b/user-scripts/README.md index 49c482b..9c2fd83 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -6,6 +6,7 @@ | edit | Fuzzy find a file in directory subtree with fzy and edit in vim | | fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open | | imgur | Upload an image file to imgur | +| kdeconnect | Send selected files to Android device using kdeconnect-cli | | nlaunch | drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | | picker | Pick files and pipe the newline-separated list to another utility | | sxiv | Open images in current directory in sxiv | diff --git a/user-scripts/kdeconnect b/user-scripts/kdeconnect index d34d269..ac247f4 100755 --- a/user-scripts/kdeconnect +++ b/user-scripts/kdeconnect @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Description: Send the selected files to your Android device using kdeconnect-cli. You must have installed and configured kdeconnect both on the Android device and on the PC. # From f2ee21cdcd2d1309b9443fcb19cdc515c768e5c3 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 19:40:57 +0530 Subject: [PATCH 03/40] checkpatch warning fixes --- src/nnn.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 87a3e4c..7efaf37 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1004,7 +1004,7 @@ static int parseargs(char *line, char **argv) } ++line; - } + } return count; } @@ -1039,7 +1039,8 @@ static void join(pid_t p, uchar flag) if (!(flag & F_NOWAIT)) /* wait for the child to exit */ - while (waitpid(p, &status, 0) == -1); + do { + } while (waitpid(p, &status, 0) == -1); /* restore parent's signal handling */ signal(SIGHUP, oldsighup); @@ -1068,9 +1069,10 @@ static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar fla if (flag & F_MULTI) { size_t len = strlen(file) + 1; + cmd = (char *)malloc(len); if (!cmd) { - DPRINTF_S("spawn: malloc()!"); + DPRINTF_S("malloc()!"); return; } @@ -1078,7 +1080,7 @@ static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar fla status = parseargs(cmd, argv); if (status == -1 || status > (EXEC_ARGS_MAX - 3)) { /* arg1, arg2 and last NULL */ free(cmd); - DPRINTF_S("spawn: NULL or too many args"); + DPRINTF_S("NULL or too many args"); return; } @@ -3176,11 +3178,11 @@ nochange: r = cfg.curctx; if (fd == '>' || fd == '.') do - r = (r + 1) & ~CTX_MAX; + r = (r + 1) & ~CTX_MAX; while (!g_ctx[r].c_cfg.ctxactive); else do - r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1); + r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1); while (!g_ctx[r].c_cfg.ctxactive); // fallthrough fd = '1' + r; // fallthrough case '1': // fallthrough @@ -3923,7 +3925,8 @@ nochange: fd = cfg.curctx; for (r = (fd + 1) & ~CTX_MAX; (r != fd) && !g_ctx[r].c_cfg.ctxactive; - r = ((r + 1) & ~CTX_MAX)); + r = ((r + 1) & ~CTX_MAX)) { + }; if (r != fd) { g_ctx[fd].c_cfg.ctxactive = 0; @@ -4154,8 +4157,11 @@ int main(int argc, char *argv[]) g_tmpfplen = xstrlcpy(g_tmpfpath, home, HOME_LEN_MAX); else if (xdiraccess("/tmp")) g_tmpfplen = xstrlcpy(g_tmpfpath, "/tmp", HOME_LEN_MAX); - else if ((copier = getenv("TMPDIR")) != NULL) - g_tmpfplen = xstrlcpy(g_tmpfpath, copier, HOME_LEN_MAX); + else { + copier = getenv("TMPDIR"); + if (copier != NULL) + g_tmpfplen = xstrlcpy(g_tmpfpath, copier, HOME_LEN_MAX); + } if (!cfg.picker && g_tmpfplen) { xstrlcpy(g_cppath, g_tmpfpath, PATH_MAX); From b4607224e34cea6c52ba218717b66b0da790acfc Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 20:21:34 +0530 Subject: [PATCH 04/40] Update docs --- .github/ISSUE_TEMPLATE.md | 5 +++++ README.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index d6cd447..f963aa7 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,6 +4,11 @@ If it looks like a local environment issue, please try to debug yourself. Debugg Before opening an issue, please try to reproduce the issue on latest master. The bug you noticed might have already been fixed. +Useful links: + +- [compile `nnn` from source](https://github.com/jarun/nnn#from-source) +- [debugging `nnn`](https://github.com/jarun/nnn/wiki/debugging-nnn) + If the issue can be reproduced on master, please make sure you provide the following: - exact steps to reproduce the issue diff --git a/README.md b/README.md index 6467961..469641b 100644 --- a/README.md +++ b/README.md @@ -313,8 +313,8 @@ To list the file paths copied to memory press y. File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is: $HOME or, - $TMPDIR or, /tmp + $TMPDIR or, The path is shown in the help and configuration screen. From dfd4a93e1171c477d4594c934a2afe7f8b1cec39 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 20:35:55 +0530 Subject: [PATCH 05/40] Update refs to new wiki page --- .github/ISSUE_TEMPLATE.md | 4 ++-- README.md | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index f963aa7..9f8a1ff 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,8 +6,8 @@ Before opening an issue, please try to reproduce the issue on latest master. The Useful links: -- [compile `nnn` from source](https://github.com/jarun/nnn#from-source) -- [debugging `nnn`](https://github.com/jarun/nnn/wiki/debugging-nnn) +- compile `nnn` from source - https://github.com/jarun/nnn#from-source +- debugging `nnn` - https://github.com/jarun/nnn/wiki/debugging-nnn If the issue can be reproduced on master, please make sure you provide the following: diff --git a/README.md b/README.md index 469641b..54861b4 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows and `nnn` works with your DE and favourite GUI utilities, has a unique _navigate-as-you-type_ mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, shell spawning, quick notes and much more. -It supports as many scripts as you need! Integrate utilities like sxiv (view images in directory) or fzy (fuzzy search subtree) with available scripts (or your own), transfer selected files using lftp or use it as a (neo)vim plugin. Refer to the wiki [How to](https://github.com/jarun/nnn/wiki/How-to) for more such use cases. +It supports as many scripts as you need! Integrate utilities like sxiv (view images in directory) or fzy (fuzzy search subtree) with available scripts (or your own), transfer selected files using lftp or use it as a (neo)vim plugin. Refer to the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for more such use cases. [Quickstart](#quickstart) and see how `nnn` simplifies those long desktop sessions. @@ -136,11 +136,11 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima | coreutils (cp, mv, rm), findutils (xargs) | copy, move and remove files | | trash-cli | trash files (instead of delete) | | mediainfo or exiftool | multimedia file details | -| atool, patool ([integration](https://github.com/jarun/nnn/wiki/How-to#integrate-patool)) | create, list and extract archives | +| atool, patool ([integration](https://github.com/jarun/nnn/wiki/hacking-nnn#integrate-patool)) | create, list and extract archives | | fzy | app launcher with drop-down menu | | vidir (from moreutils) | batch rename dir entries | | vlock (Linux), bashlock (macOS), lock(1) (BSD) | terminal locker | -| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/How-to#show-cp-mv-progress)) | copy, move progress | +| advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/hacking-nnn#show-cp-mv-progress)) | copy, move progress | | $EDITOR (overridden by $VISUAL, if defined) | edit files (fallback vi) | | $PAGER (less, most) | page through files (fallback less) | | $SHELL | spawn a shell, run script (fallback sh) | @@ -387,7 +387,7 @@ To lookup keyboard shortcuts at runtime, press ?. #### QUICKSTART 1. Install the [utilities required](#utility-dependencies) for your regular activities. -2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/How-to#cd-on-quit). +2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/hacking-nnn#cd-on-quit). 3. Optionally open all text files in EDITOR (fallback vi): export NNN_USE_EDITOR=1 @@ -396,7 +396,7 @@ To lookup keyboard shortcuts at runtime, press ?. 6. Don't memorize keys. Arrows, / and q suffice. Press ? for help on keyboard shortcuts anytime. - For additional functionality [setup custom scripts](#user-scripts). -- Visit the [How to](https://github.com/jarun/nnn/wiki/How-to) for many more specific usecases. +- Visit the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for many more specific usecases. #### USER SCRIPTS From f38692e96864a155a44c8a7dd9d223032066d558 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 21:59:36 +0530 Subject: [PATCH 06/40] Add readme on nlay --- scripts/nlay/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/nlay/README.md diff --git a/scripts/nlay/README.md b/scripts/nlay/README.md new file mode 100644 index 0000000..4671eec --- /dev/null +++ b/scripts/nlay/README.md @@ -0,0 +1,31 @@ +## nlay + +`nlay` (*NnnpLAY*) is a customizable media type or action handler + +### Usage + +`nlay` is not used by `nnn` now. However, the bash script can be used to run desktop search utility or screensaver: + + nlay file type + file: absolute path to file ("" for an action) + type: type of media or action + +### Default apps + +* gnome-search-tool, catfish - file search +* vlock - terminal screensaver (alternatives - cmatrix, termsaver) + +### Perks + +- simple to modify (extensive in-file notes, comments and indicative code) +- handle files by category (e.g. plaintext, search, screensaver) +- support for multiple apps by order of preference +- run app in the foreground or silently detached in the background +- optionally add app arguments + +### Tips to modify + +- set `app=` in any category to change the player +- set `opts=` to use app options +- toggle `bg=` to enable or disable running app silently (`stdout` and `stderr` redirected to `/dev/null`) in background. E.g., vim (CLI) should be verbose and in the foreground while Sublime Text (GUI) can be started silently in the background. +- enable the commented out code under `ENABLE_FILE_TYPE_HANDLING` to handle specific file extensions e.g. use a different app than the one used for the category. From 75c90dbdc67f7977fe9ff434da9ff3fe4e036e64 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Mar 2019 22:06:28 +0530 Subject: [PATCH 07/40] Add reference to program help for keybinds --- nnn.1 | 142 ++-------------------------------------------------------- 1 file changed, 3 insertions(+), 139 deletions(-) diff --git a/nnn.1 b/nnn.1 index 83fd18d..6ec3832 100644 --- a/nnn.1 +++ b/nnn.1 @@ -29,145 +29,9 @@ opens the current working directory by default if is not specified. .Sh KEYBINDS .Pp -NAVIGATION -.Pp -.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact -.It Ic [Up], k -Move to previous entry -.It Ic [Down], j -Move to next entry -.It Ic [Left], h -Go to parent directory -.It Ic [Right], [Enter], l -Open file or enter directory -.It Ic [PgUp], ^U -Scroll up half a page -.It Ic [PgDn], ^D -Scroll down half a page -.It Ic [Home], g, ^A -Move to the first entry -.It Ic [End], G, ^E -Move to the last entry -.It Ic ~ -Change to the HOME directory -.It Ic & -Change to initial directory -.It Ic \- -Change to the last visited directory -.It Ic \&. -Toggle show hidden . (dot) files -.It Ic / -Change filter (more information below) -.It Ic [Insert], ^T -Toggle navigate-as-you-type mode -.It Ic b -Pin current directory -.It Ic ^B -Visit pinned directory -.It Ic d -Toggle detail view -.It Ic Tab, ^I -Next context, ask to create if none -.It Ic ,, ^/ -Leader key -.It Ic N, LeaderN -Switch to context N -.It Ic Esc -Exit prompt -.It Ic ^L -Force a redraw, clear prompt -.It Ic q -Quit the current context -.It Ic ^G -Quit and change directory -.It Ic Q, ^Q -Quit -.It Ic \&? -Help and configuration screen -.El -.Pp -FILES -.Pp -.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact -.It Ic ^O -Open with an application -.It Ic n -Create a new file, directory or link(s) to selection -.It Ic D -Show entry details -.It Ic ^R -Rename selected entry -.It Ic r -Batch rename -.It Ic K, ^Y -Toggle selection mode -.It Ic Y -Select all entries in dir -.It Ic Space, ^K -Select entry and copy absolute path -.It Ic y -Show selection list -.It Ic P -Copy files from selection -.It Ic V -Move files from selection -.It Ic X -Delete files from selection -.It Ic ^X -Delete entry -.It Ic f -Archive files -.It Ic F -List files in archive -.It Ic ^F -Extract archive in current directory -.It Ic m, M -Show brief/full media info -.It Ic e -Open entry in EDITOR (fallback vi) -.It Ic p -Open entry in PAGER (fallback less) -.El -.Pp -ORDER TOGGLES -.Pp -.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact -.It Ic ^J -Toggle disk usage analyzer mode -.It Ic S -Toggle sort by apparent size -.It Ic ^W -Wild mode -.It Ic t -Toggle sort by time modified -.It Ic s -Toggle sort by file size -.El -.Pp -MISC -.Pp -.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact -.It Ic \&!, ^] -Spawn SHELL in current directory (fallback sh) -.It Ic C -Execute entry -.It Ic R, ^V -Run or pick a script to run -.It Ic L -Lock terminal -.It Ic ^P -Show command prompt -.It Ic ^N -Take note -.It Ic = -Launcher -.El -.Pp -Backing up one directory level will set the cursor position at the -directory you came out of. -.Pp -Help & settings, file details, media info and archive listing are shown in the -PAGER. Use the PAGER-specific keys in these screens. +Press \fB?\fR in +.Nm +to see the list of keybinds. .Sh OPTIONS .Pp .Nm From eb7e14a964e6afeea366c41f919b2a15a1b99952 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 18 Mar 2019 05:05:47 +0530 Subject: [PATCH 08/40] Code reformat --- src/dbg.h | 88 ++++++++++++++++++++++++++++++++++ src/nnn.c | 138 +++++++++++++++--------------------------------------- 2 files changed, 126 insertions(+), 100 deletions(-) create mode 100644 src/dbg.h diff --git a/src/dbg.h b/src/dbg.h new file mode 100644 index 0000000..4d5b54a --- /dev/null +++ b/src/dbg.h @@ -0,0 +1,88 @@ +/* + * BSD 2-Clause License + * + * Copyright (C) 2014-2016, Lazaros Koromilas + * Copyright (C) 2014-2016, Dimitris Papastamos + * Copyright (C) 2016-2019, Arun Prakash Jana + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#ifdef DBGMODE +static int DEBUG_FD; + +static int xprintf(int fd, const char *fmt, ...) +{ + char buf[BUFSIZ]; + int r; + va_list ap; + + va_start(ap, fmt); + r = vsnprintf(buf, sizeof(buf), fmt, ap); + if (r > 0) + r = write(fd, buf, r); + va_end(ap); + return r; +} + +static int enabledbg() +{ + FILE *fp = fopen("/tmp/nnndbg", "w"); + + if (!fp) { + perror("dbg(1)"); + + fp = fopen("./nnndbg", "w"); + if (!fp) { + perror("dbg(2)"); + return -1; + } + } + + DEBUG_FD = dup(fileno(fp)); + fclose(fp); + if (DEBUG_FD == -1) { + perror("dbg(3)"); + return -1; + } + + return 0; +} + +static void disabledbg() +{ + close(DEBUG_FD); +} + +#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d\n", x) +#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u\n", x) +#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s\n", x) +#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p\n", x) +#else +#define DPRINTF_D(x) +#define DPRINTF_U(x) +#define DPRINTF_S(x) +#define DPRINTF_P(x) +#endif /* DBGMODE */ diff --git a/src/nnn.c b/src/nnn.c index 7efaf37..65cd394 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -94,76 +94,17 @@ #include #include -#ifndef S_BLKSIZE -#define S_BLKSIZE 512 /* S_BLKSIZE is missing on Android NDK (Termux) */ -#endif - #include "nnn.h" - -#ifdef DBGMODE -static int DEBUG_FD; - -static int -xprintf(int fd, const char *fmt, ...) -{ - char buf[BUFSIZ]; - int r; - va_list ap; - - va_start(ap, fmt); - r = vsnprintf(buf, sizeof(buf), fmt, ap); - if (r > 0) - r = write(fd, buf, r); - va_end(ap); - return r; -} - -static int -enabledbg() -{ - FILE *fp = fopen("/tmp/nnndbg", "w"); - - if (!fp) { - perror("dbg(1)"); - - fp = fopen("./nnndbg", "w"); - if (!fp) { - perror("dbg(2)"); - return -1; - } - } - - DEBUG_FD = dup(fileno(fp)); - fclose(fp); - if (DEBUG_FD == -1) { - perror("dbg(3)"); - return -1; - } - - return 0; -} - -static void -disabledbg() -{ - close(DEBUG_FD); -} - -#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d\n", x) -#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u\n", x) -#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s\n", x) -#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p\n", x) -#else -#define DPRINTF_D(x) -#define DPRINTF_U(x) -#define DPRINTF_S(x) -#define DPRINTF_P(x) -#endif /* DBGMODE */ +#include "dbg.h" /* Macro definitions */ #define VERSION "2.3" #define GENERAL_INFO "BSD 2-Clause\nhttps://github.com/jarun/nnn" +#ifndef S_BLKSIZE +#define S_BLKSIZE 512 /* S_BLKSIZE is missing on Android NDK (Termux) */ +#endif + #define LEN(x) (sizeof(x) / sizeof(*(x))) #undef MIN #define MIN(x, y) ((x) < (y) ? (x) : (y)) @@ -227,30 +168,6 @@ disabledbg() #define FREE 0 #define CAPACITY 1 -/* Function macros */ -#define exitcurses() endwin() -#define clearprompt() printmsg("") -#define printwarn() printmsg(strerror(errno)) -#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/') -#define copycurname() xstrlcpy(lastname, dents[cur].name, NAME_MAX + 1) -#define settimeout() timeout(1000) -#define cleartimeout() timeout(-1) -#define errexit() printerr(__LINE__) -#define setdirwatch() (cfg.filtermode ? (presel = FILTER) : (dir_changed = TRUE)) -/* We don't care about the return value from strcmp() */ -#define xstrcmp(a, b) (*(a) != *(b) ? -1 : strcmp((a), (b))) -/* A faster version of xisdigit */ -#define xisdigit(c) ((unsigned int) (c) - '0' <= 9) -#define xerror() perror(xitoa(__LINE__)) - -#ifdef LINUX_INOTIFY -#define EVENT_SIZE (sizeof(struct inotify_event)) -#define EVENT_BUF_LEN (1024 * (EVENT_SIZE + 16)) -#elif defined(BSD_KQUEUE) -#define NUM_EVENT_SLOTS 1 -#define NUM_EVENT_FDS 1 -#endif - /* TYPE DEFINITIONS */ typedef unsigned long ulong; typedef unsigned int uint; @@ -359,18 +276,6 @@ static char g_cppath[PATH_MAX] __attribute__ ((aligned)); /* Buffer to store tmp file path */ static char g_tmpfpath[HOME_LEN_MAX] __attribute__ ((aligned)); -#ifdef LINUX_INOTIFY -static int inotify_fd, inotify_wd = -1; -static uint INOTIFY_MASK = IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF - | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | IN_MOVED_TO; -#elif defined(BSD_KQUEUE) -static int kq, event_fd = -1; -static struct kevent events_to_monitor[NUM_EVENT_FDS]; -static uint KQUEUE_FFLAGS = NOTE_DELETE | NOTE_EXTEND | NOTE_LINK - | NOTE_RENAME | NOTE_REVOKE | NOTE_WRITE; -static struct timespec gtimeout; -#endif - /* Replace-str for xargs on different platforms */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) #define REPLACE_STR 'J' @@ -495,6 +400,39 @@ static const char * const envs[] = { "PAGER", }; +/* Event handling */ +#ifdef LINUX_INOTIFY +#define EVENT_SIZE (sizeof(struct inotify_event)) +#define EVENT_BUF_LEN (1024 * (EVENT_SIZE + 16)) +static int inotify_fd, inotify_wd = -1; +static uint INOTIFY_MASK = IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF + | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | IN_MOVED_TO; +#elif defined(BSD_KQUEUE) +#define NUM_EVENT_SLOTS 1 +#define NUM_EVENT_FDS 1 +static int kq, event_fd = -1; +static struct kevent events_to_monitor[NUM_EVENT_FDS]; +static uint KQUEUE_FFLAGS = NOTE_DELETE | NOTE_EXTEND | NOTE_LINK + | NOTE_RENAME | NOTE_REVOKE | NOTE_WRITE; +static struct timespec gtimeout; +#endif + +/* Function macros */ +#define exitcurses() endwin() +#define clearprompt() printmsg("") +#define printwarn() printmsg(strerror(errno)) +#define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/') +#define copycurname() xstrlcpy(lastname, dents[cur].name, NAME_MAX + 1) +#define settimeout() timeout(1000) +#define cleartimeout() timeout(-1) +#define errexit() printerr(__LINE__) +#define setdirwatch() (cfg.filtermode ? (presel = FILTER) : (dir_changed = TRUE)) +/* We don't care about the return value from strcmp() */ +#define xstrcmp(a, b) (*(a) != *(b) ? -1 : strcmp((a), (b))) +/* A faster version of xisdigit */ +#define xisdigit(c) ((unsigned int) (c) - '0' <= 9) +#define xerror() perror(xitoa(__LINE__)) + /* Forward declarations */ static void redraw(char *path); static void spawn(char *file, char *arg1, char *arg2, const char *dir, uchar flag); From 39f84efa55f506e1db92b39bacfedee91c0ac6f0 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 18 Mar 2019 06:14:48 +0530 Subject: [PATCH 09/40] Do not refresh on mediainfo --- src/nnn.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 65cd394..114d944 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3315,12 +3315,12 @@ nochange: r = TRUE; switch (sel) { - case SEL_MEDIA: - r = show_mediainfo(newpath, NULL); - break; + case SEL_MEDIA: // fallthrough case SEL_FMEDIA: - r = show_mediainfo(newpath, "-f"); - break; + tmp = (sel == SEL_FMEDIA) ? "-f" : NULL; + show_mediainfo(newpath, tmp); + setdirwatch(); + goto nochange; case SEL_ARCHIVELS: r = handle_archive(newpath, "-l", path); break; From 2946a89c00edbb1945400cb7096376107d600fee Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 18 Mar 2019 06:15:35 +0530 Subject: [PATCH 10/40] Clear rest of the line --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 114d944..d627a4f 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3432,7 +3432,7 @@ nochange: g_crc = crc8fast((uchar *)dents, ndents * sizeof(struct entry)); copystartid = cur; ncp = 0; - mvprintw(xlines - 1, 0, "selection on"); + mvprintw(xlines - 1, 0, "selection on\n"); xdelay(); continue; } From f30d21b7a4e89544870f8cd5749519ad59585fc6 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 18 Mar 2019 19:00:30 +0530 Subject: [PATCH 11/40] Fix #227 --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index d627a4f..ab4c904 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3013,7 +3013,7 @@ nochange: } /* Invoke desktop opener as last resort */ - spawn(opener, newpath, NULL, NULL, F_NOWAIT | F_NOTRACE); + spawn(opener, newpath, NULL, NULL, F_NOTRACE); continue; } default: From 40b98e8c9e78f8e1622968014ed903aeac8a790e Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 19 Mar 2019 03:14:35 +0530 Subject: [PATCH 12/40] Prepare for release v2.4 --- CHANGELOG | 23 +++++++++++++++++++++++ Makefile | 2 +- nnn.1 | 2 +- src/nnn.c | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 698bfad..490fdd5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,26 @@ +nnn v2.4 +2019-03-19 + +- FreeDesktop.org compliant trashing +- mark selected entries with `+` +- _wild_ mode (option `-w`, key ^W) for _nav-as-you-type_ +- POSIX-compliant GUI app launcher with drop-down menu (key =) +- new scripts: + - upload image to imgur + - send selection to Android using kdeconnect-cli +- show permissions in detail mode +- cp, mv progress bar for Linux (needs advcpmv) [BSD, macOS shows on ^T] +- make libreadline an optional dep (reduces memory usage) +- minimize the number of redraws +- handle screen resize gracefully +- option `-d` to show hidden files (`NNN_SHOW_HIDDEN` is removed) +- additional key K to toggle selection +- change visit start dir key to @ +- option `-C` to disable colors removed +- per-context initial directory replaced by program start dir +- marker msg when spawning new shell removed +- rename debug file to `nnndbg` + nnn v2.3 2019-02-19 diff --git a/Makefile b/Makefile index 4e35c6a..fce5f06 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 2.3 +VERSION = 2.4 PREFIX ?= /usr/local MANPREFIX ?= $(PREFIX)/share/man diff --git a/nnn.1 b/nnn.1 index 6ec3832..bda63a7 100644 --- a/nnn.1 +++ b/nnn.1 @@ -1,4 +1,4 @@ -.Dd Feb 19, 2019 +.Dd Mar 19, 2019 .Dt NNN 1 .Os .Sh NAME diff --git a/src/nnn.c b/src/nnn.c index ab4c904..8c40042 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -98,7 +98,7 @@ #include "dbg.h" /* Macro definitions */ -#define VERSION "2.3" +#define VERSION "2.4" #define GENERAL_INFO "BSD 2-Clause\nhttps://github.com/jarun/nnn" #ifndef S_BLKSIZE From 24b72f65c58e4a09d9b43230d8ad661536a59eb6 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 19 Mar 2019 19:39:43 +0530 Subject: [PATCH 13/40] Fix selection symbol (+) lost after a few seconds This is fix on Linux. Someone has to test it on BSD and fix IF there's similar issue with the kevent based mechanism. We need to mask and check if the intended events are received because some events like IN_UNMOUNT, IN_Q_OVERFLOW or IN_IGNORED may arrive without knowledge. --- src/nnn.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 8c40042..b374306 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -402,8 +402,9 @@ static const char * const envs[] = { /* Event handling */ #ifdef LINUX_INOTIFY +#define NUM_EVENT_SLOTS 16 /* Make room for 16 events */ #define EVENT_SIZE (sizeof(struct inotify_event)) -#define EVENT_BUF_LEN (1024 * (EVENT_SIZE + 16)) +#define EVENT_BUF_LEN (EVENT_SIZE * NUM_EVENT_SLOTS) static int inotify_fd, inotify_wd = -1; static uint INOTIFY_MASK = IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | IN_MOVED_TO; @@ -1415,7 +1416,9 @@ static int nextsel(int presel) uint i; const uint len = LEN(bindings); #ifdef LINUX_INOTIFY - static char inotify_buf[EVENT_BUF_LEN]; + struct inotify_event *event; + static char inotify_buf[EVENT_BUF_LEN] + __attribute__ ((aligned(__alignof__(struct inotify_event)))); #elif defined(BSD_KQUEUE) static struct kevent event_data[NUM_EVENT_SLOTS]; #endif @@ -1442,14 +1445,27 @@ static int nextsel(int presel) * Check for changes every odd second. */ #ifdef LINUX_INOTIFY - if (!cfg.blkorder && inotify_wd >= 0 && idle & 1 - && read(inotify_fd, inotify_buf, EVENT_BUF_LEN) > 0) + if (!cfg.blkorder && inotify_wd >= 0 && (idle & 1)) { + ssize_t bytes = read(inotify_fd, inotify_buf, EVENT_BUF_LEN); + if (bytes > 0) { + for (char *ptr = inotify_buf; ptr < inotify_buf + bytes; + ptr += sizeof(struct inotify_event) + event->len) { + event = (struct inotify_event *) ptr; + DPRINTF_D(event->wd); + DPRINTF_D(event->mask); + if (event->mask & INOTIFY_MASK) { + c = CONTROL('L'); + break; + } + } + } + } #elif defined(BSD_KQUEUE) if (!cfg.blkorder && event_fd >= 0 && idle & 1 && kevent(kq, events_to_monitor, NUM_EVENT_SLOTS, event_data, NUM_EVENT_FDS, >imeout) > 0) -#endif c = CONTROL('L'); +#endif } else idle = 0; From ac2a4041b691a1afd03db4b2204df0abbe24f515 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 19 Mar 2019 20:13:03 +0530 Subject: [PATCH 14/40] Fix build break --- src/nnn.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index b374306..8ffcee9 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1416,6 +1416,7 @@ static int nextsel(int presel) uint i; const uint len = LEN(bindings); #ifdef LINUX_INOTIFY + char *ptr; struct inotify_event *event; static char inotify_buf[EVENT_BUF_LEN] __attribute__ ((aligned(__alignof__(struct inotify_event)))); @@ -1446,9 +1447,9 @@ static int nextsel(int presel) */ #ifdef LINUX_INOTIFY if (!cfg.blkorder && inotify_wd >= 0 && (idle & 1)) { - ssize_t bytes = read(inotify_fd, inotify_buf, EVENT_BUF_LEN); - if (bytes > 0) { - for (char *ptr = inotify_buf; ptr < inotify_buf + bytes; + i = read(inotify_fd, inotify_buf, EVENT_BUF_LEN); + if (i > 0) { + for (ptr = inotify_buf; ptr < inotify_buf + i; ptr += sizeof(struct inotify_event) + event->len) { event = (struct inotify_event *) ptr; DPRINTF_D(event->wd); From 58a777375539743ca5815d7fdfc3a62f26b28a1f Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 19 Mar 2019 21:30:13 +0530 Subject: [PATCH 15/40] Remove obsolete help --- src/nnn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 8ffcee9..4e13770 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3919,7 +3919,7 @@ nochange: static void usage(void) { fprintf(stdout, - "%s: nnn [-b key] [-C] [-d] [-e] [-i] [-l] [-n]\n" + "%s: nnn [-b key] [-d] [-e] [-i] [-l] [-n]\n" " [-p file] [-s] [-S] [-v] [-w] [-h] [PATH]\n\n" "The missing terminal file manager for X.\n\n" "positional args:\n" @@ -3927,7 +3927,6 @@ static void usage(void) "optional args:\n" " -b key open bookmark key\n" " -d show hidden files\n" - " -C disable directory color\n" " -e use exiftool for media info\n" " -i nav-as-you-type mode\n" " -l light mode\n" From b0960a2e3d89f680eb5a0bc46379309d3a1eae05 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 20 Mar 2019 05:50:20 +0530 Subject: [PATCH 16/40] Break when watch desc becomes 0 --- src/nnn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nnn.c b/src/nnn.c index 4e13770..88656ad 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -1454,11 +1454,16 @@ static int nextsel(int presel) event = (struct inotify_event *) ptr; DPRINTF_D(event->wd); DPRINTF_D(event->mask); + if (!event->wd) + break; + if (event->mask & INOTIFY_MASK) { c = CONTROL('L'); + DPRINTF_S("issue refresh"); break; } } + DPRINTF_S("inotify read done"); } } #elif defined(BSD_KQUEUE) From 10c8344fbd91fe24063d1a700f7a4b2a2d35426e Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 20 Mar 2019 09:14:39 +0530 Subject: [PATCH 17/40] Update docs --- README.md | 5 +++-- nnn.1 | 4 ++-- scripts/auto-completion/fish/nnn.fish | 2 +- scripts/auto-completion/zsh/_nnn | 2 +- src/nnn.c | 2 +- src/nnn.h | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 54861b4..f18cf37 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - File picker, vim (or neovim) plugin - Navigation - *Navigate-as-you-type* with auto-select directory + - *Wild load* for *navigate-as-you-type* - 4 contexts (_aka_ tabs _aka_ workspaces) - Bookmarks; pin and visit a directory - Familiar, easy shortcuts (arrows, ~, -, @) @@ -213,7 +214,7 @@ optional args: -s string filters [default: regex] -S du mode -v show version - -w wild mode + -w wild load -h show help ``` @@ -339,7 +340,7 @@ When there's a unique match and it's a directory, `nnn` auto selects the directo This mode takes navigation to the next level when short, unique keypress sequences are possible. For example, to reach `nnn` development directory (located at `~/GitHub/nnn`) from my `$HOME` (which is the default directory the terminal starts in), I use the sequence gn. -The **_wild mode_** program option can be extremely handy for users who use this mode constantly. The entries are unsorted when the directory loads. Applying filters sorts the entries (with directories on top). Directory color is disabled in this mode. +The **_wild load_** option can be extremely handy for users who use this mode constantly. The entries are unsorted when the directory loads. Applying filters sorts the entries (with directories on top). Directory color is disabled in this mode. #### File indicators diff --git a/nnn.1 b/nnn.1 index bda63a7..f442eb2 100644 --- a/nnn.1 +++ b/nnn.1 @@ -68,7 +68,7 @@ supports the following options: show version and exit .Pp .Fl w - wild mode - entries unsorted on directory load + wild load - entries unsorted on directory load .Pp .Fl h show program help and exit @@ -119,7 +119,7 @@ allowing continuous navigation. Works best with the \fBarrow keys\fR. .br When there's a unique match and it's a directory, `nnn` auto selects the directory and enters it in this mode. .br -The \fIwild mode\fR can be extremely handy for users who use the \fInavigate-as-you-type\fR mode constantly. The entries are unsorted when the directory loads. Applying filters sorts the entries (with directories on top). Directory color is disabled in this mode. +The \fIwild load\fR option can be extremely handy for users who use the \fInavigate-as-you-type\fR mode constantly. The entries are unsorted when the directory loads. Applying filters sorts the entries (with directories on top). Directory color is disabled in this mode. .Sh SELECTION MODE The absolute path of a single file can be copied to clipboard by pressing \fI^K\fR if NNN_COPIER is set (see ENVIRONMENT section below). diff --git a/scripts/auto-completion/fish/nnn.fish b/scripts/auto-completion/fish/nnn.fish index 59182b5..02f8024 100644 --- a/scripts/auto-completion/fish/nnn.fish +++ b/scripts/auto-completion/fish/nnn.fish @@ -16,4 +16,4 @@ complete -c nnn -s p -r -d 'copy selection to file' complete -c nnn -s s -d 'use substring match for filters' complete -c nnn -s S -d 'start in disk usage analyzer mode' complete -c nnn -s v -d 'show program version and exit' -complete -c nnn -s w -d 'wild mode' +complete -c nnn -s w -d 'wild load' diff --git a/scripts/auto-completion/zsh/_nnn b/scripts/auto-completion/zsh/_nnn index bda285b..20a313f 100644 --- a/scripts/auto-completion/zsh/_nnn +++ b/scripts/auto-completion/zsh/_nnn @@ -20,7 +20,7 @@ args=( '(-s)-s[use substring match for filters]' '(-S)-S[start in disk usage analyzer mode]' '(-v)-v[show program version and exit]' - '(-w)-w[wild mode]' + '(-w)-w[wild load]' '*:filename:_files' ) _arguments -S -s $args diff --git a/src/nnn.c b/src/nnn.c index 88656ad..a952514 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3940,7 +3940,7 @@ static void usage(void) " -s string filters [default: regex]\n" " -S du mode\n" " -v show version\n" - " -w wild mode\n" + " -w wild load\n" " -h show help\n\n" "v%s\n%s\n", __func__, VERSION, GENERAL_INFO); } diff --git a/src/nnn.h b/src/nnn.h index 3c4b909..2104ede 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -185,7 +185,7 @@ static struct key bindings[] = { { CONTROL('J'), SEL_BSIZE }, /* Toggle sort by time */ { 't', SEL_MTIME }, - /* Wild mode */ + /* Wild load */ { CONTROL('W'), SEL_WILD }, /* Redraw window */ { CONTROL('L'), SEL_REDRAW }, From 20321695ccef71e5727dc5908e31e136cc86bf38 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 20 Mar 2019 21:50:56 +0530 Subject: [PATCH 18/40] Diff viewer script using vimdiff --- user-scripts/README.md | 3 ++- user-scripts/ndiff | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 user-scripts/ndiff diff --git a/user-scripts/README.md b/user-scripts/README.md index 9c2fd83..f4589e9 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -7,7 +7,8 @@ | fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open | | imgur | Upload an image file to imgur | | kdeconnect | Send selected files to Android device using kdeconnect-cli | -| nlaunch | drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | +| ndiff | File and directory diff for selection using vimdiff | +| nlaunch | Drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | | picker | Pick files and pipe the newline-separated list to another utility | | sxiv | Open images in current directory in sxiv | | upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch | diff --git a/user-scripts/ndiff b/user-scripts/ndiff new file mode 100755 index 0000000..10af0b3 --- /dev/null +++ b/user-scripts/ndiff @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +# Description: File and directory diff using vimdiff +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +vimdiff $(cat ~/.nnncp | tr '\0' '\n') From 10dea591f088a52648e08eb38a7158509125f458 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 20 Mar 2019 23:52:08 +0530 Subject: [PATCH 19/40] Fix #229 --- src/nnn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index a952514..5265217 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4033,6 +4033,9 @@ int main(int argc, char *argv[]) ++opt; } + home = getenv("HOME"); + DPRINTF_S(home); + /* Parse bookmarks string */ if (!parsebmstr()) { fprintf(stderr, "%s\n", env_cfg[NNN_BMS]); @@ -4105,9 +4108,6 @@ int main(int argc, char *argv[]) idletimeout = xatoi(getenv(env_cfg[NNN_IDLE_TIMEOUT])); DPRINTF_U(idletimeout); - home = getenv("HOME"); - DPRINTF_S(home); - if (getenv(env_cfg[NNN_TRASH])) cfg.trash = 1; From dd52acb925b2e0783e7721ea089eba502272f34f Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 21 Mar 2019 03:39:47 +0530 Subject: [PATCH 20/40] Update docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f18cf37..d9645bd 100644 --- a/README.md +++ b/README.md @@ -367,7 +367,7 @@ The following indicators are used in the detail view: | `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | specify bookmarks (max 10) | | `NNN_OPENER=mimeopen` | custom file opener | | `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] | -| `NNN_IDLE_TIMEOUT=300` | idle time to lock terminal [default: disabled] | +| `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] | | `NNN_COPIER='copier.sh'` | system clipboard copier script [default: none] | | `NNN_SCRIPT=/home/user/scripts[/script.sh]` | path to script dir or a single script | | `NNN_NOTE=/home/user/Dropbox/Public/notes` | path to note file [default: none] | From 73770bd67caf5ef3d3d60bc5e682718570db8b72 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 21 Mar 2019 04:04:42 +0530 Subject: [PATCH 21/40] Disable readability-isolate-declaration check --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 82b705e..40c2a4e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements' +Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements,-readability-isolate-declaration' WarningsAsErrors: '*' HeaderFilterRegex: '.*(? Date: Thu, 21 Mar 2019 21:09:55 +0530 Subject: [PATCH 22/40] Fix lint warnings --- .clang-tidy | 2 +- src/nnn.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 40c2a4e..2ed66e3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements,-readability-isolate-declaration' +Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,-misc-unused-parameters,google-runtime-int,-llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-braces-around-statements,-readability-isolate-declaration,-bugprone-narrowing-conversions' WarningsAsErrors: '*' HeaderFilterRegex: '.*(?t - pa->t; + if (cfg.mtimeorder) { + if (pb->t >= pa->t) + return (int)(pb->t - pa->t); + + return -1; + } if (cfg.sizeorder) { if (pb->size > pa->size) @@ -2311,9 +2315,9 @@ static size_t get_fs_info(const char *path, bool type) return 0; if (type == CAPACITY) - return svb.f_blocks << ffs(svb.f_bsize >> 1); + return svb.f_blocks << ffs((int)(svb.f_bsize >> 1)); - return svb.f_bavail << ffs(svb.f_frsize >> 1); + return svb.f_bavail << ffs((int)(svb.f_frsize >> 1)); } static bool show_mediainfo(const char *fpath, const char *arg) From 7fa6f75542b95b91164269f85078c851b543869d Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 22 Mar 2019 06:41:00 +0530 Subject: [PATCH 23/40] Update issue template --- .github/ISSUE_TEMPLATE.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 9f8a1ff..99c748d 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,23 +1,32 @@ -#### Bug reports +#### BUG REPORTS If it looks like a local environment issue, please try to debug yourself. Debugging local setup issues is not our top priority. -Before opening an issue, please try to reproduce the issue on latest master. The bug you noticed might have already been fixed. +Before opening an issue, please try to reproduce on latest master. The bug you noticed might have already been fixed. Useful links: - compile `nnn` from source - https://github.com/jarun/nnn#from-source - debugging `nnn` - https://github.com/jarun/nnn/wiki/debugging-nnn -If the issue can be reproduced on master, please make sure you provide the following: +If the issue can be reproduced on master, log it. -- exact steps to reproduce the issue -- details of operating system, desktop environment, terminal emulator and shell +Please provide the environment details. **If that's missing, the issue will be closed without any cited reason.** If we need more information and there is no communication from the bug reporter within 7 days from the date of request, we will close the issue. If you have relevant information, resume discussion any time. -#### Feature requests +#### FEATURE REQUESTS Please consider contributing the feature back to `nnn` yourself. Feel free to discuss in the ToDo list thread. We are more than happy to help. --- PLEASE DELETE THIS LINE AND EVERYTHING ABOVE --- + +#### Environment details (Put `x` in the checkbox along with the information) + +[ ] Operating System: +[ ] Desktop Environment: +[ ] Terminal Emulator: +[ ] Shell: +[ ] Issue exists on `nnn` master + +#### Exact steps to reproduce the issue From 0b5a393c25a5623edeb1e087c7929329d9df2a87 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 22 Mar 2019 07:08:23 +0530 Subject: [PATCH 24/40] Update docs --- .github/ISSUE_TEMPLATE.md | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 99c748d..4ac96c8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -27,6 +27,7 @@ Please consider contributing the feature back to `nnn` yourself. Feel free to di [ ] Desktop Environment: [ ] Terminal Emulator: [ ] Shell: +[ ] Custom desktop opener (if applicable): [ ] Issue exists on `nnn` master #### Exact steps to reproduce the issue diff --git a/README.md b/README.md index d9645bd..1d04e37 100644 --- a/README.md +++ b/README.md @@ -319,6 +319,8 @@ File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priori The path is shown in the help and configuration screen. +_**NOTE:**_ If you are on BSD/macOS, please check the [BSD terminal issue](https://github.com/jarun/nnn#bsd-terminal-issue) with ^Y for workaround. + #### Filters Filters support regexes by default to instantly (search-as-you-type) list the matching entries in the current directory. From 93379c673aad841a8a9a1d255f344bcb59c6727a Mon Sep 17 00:00:00 2001 From: TimB87 Date: Fri, 22 Mar 2019 10:06:43 +0100 Subject: [PATCH 25/40] add CRUX to distrolist --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1d04e37..378e072 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [Termux](https://github.com/termux/termux-packages/tree/master/packages/nnn) (`pkg in nnn`) - [Ubuntu](https://packages.ubuntu.com/search?keywords=nnn&searchon=names&exact=1) (`apt-get install nnn`) - [Void Linux](https://github.com/void-linux/void-packages/tree/master/srcpkgs/nnn) (`xbps-install -S nnn`) +- [CRUX](https://github.com/TimB87/crux-ports/tree/master/nnn) (prt-get depinst nnn) #### Release packages From 52d3364c689bdab4f53a79844bc85870ccbb3e18 Mon Sep 17 00:00:00 2001 From: TimB87 Date: Fri, 22 Mar 2019 10:45:12 +0100 Subject: [PATCH 26/40] the list alphabetical and commands go in backquotes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 378e072..6736b41 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [Alpine Linux](https://pkgs.alpinelinux.org/packages?name=nnn) (`apk add nnn`) - [Arch Linux](https://www.archlinux.org/packages/community/x86_64/nnn/) (`pacman -S nnn`) +- [CRUX](https://github.com/TimB87/crux-ports/tree/master/nnn) (`prt-get depinst nnn`) - [Debian](https://packages.debian.org/search?keywords=nnn&searchon=names&exact=1) (`apt-get install nnn`) - [Fedora](https://apps.fedoraproject.org/packages/nnn) (`dnf install nnn`) - [FreeBSD](https://www.freshports.org/misc/nnn) (`pkg install nnn`) @@ -168,7 +169,6 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [Termux](https://github.com/termux/termux-packages/tree/master/packages/nnn) (`pkg in nnn`) - [Ubuntu](https://packages.ubuntu.com/search?keywords=nnn&searchon=names&exact=1) (`apt-get install nnn`) - [Void Linux](https://github.com/void-linux/void-packages/tree/master/srcpkgs/nnn) (`xbps-install -S nnn`) -- [CRUX](https://github.com/TimB87/crux-ports/tree/master/nnn) (prt-get depinst nnn) #### Release packages From fa31775547b684a31929d25dece89c1d77d3567c Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 22 Mar 2019 19:29:36 +0530 Subject: [PATCH 27/40] Fix #231 --- README.md | 1 + nnn.1 | 5 +++++ src/nnn.c | 11 ++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6736b41..40b5716 100644 --- a/README.md +++ b/README.md @@ -369,6 +369,7 @@ The following indicators are used in the detail view: | --- | --- | | `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | specify bookmarks (max 10) | | `NNN_OPENER=mimeopen` | custom file opener | +| `NNN_OPENER_DETACH=1` | do not block when invoking file opener | | `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] | | `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] | | `NNN_COPIER='copier.sh'` | system clipboard copier script [default: none] | diff --git a/nnn.1 b/nnn.1 index f442eb2..3a96e1b 100644 --- a/nnn.1 +++ b/nnn.1 @@ -155,6 +155,11 @@ when dealing with the !, e and p commands respectively. A single combination to export NNN_OPENER=mimeopen .Ed .Pp +\fBNNN_OPENER_DETACH:\fR do not block when invoking file opener. +.Bd -literal + export NNN_OPENER_DETACH=1 +.Ed +.Pp \fBNNN_CONTEXT_COLORS:\fR string of color codes for each context, e.g.: .Bd -literal export NNN_CONTEXT_COLORS='1234' diff --git a/src/nnn.c b/src/nnn.c index 8ff177d..930f495 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -256,6 +256,7 @@ static bm bookmark[BM_MAX]; static size_t g_tmpfplen; /* path to tmp files for copy without X, keybind help and file stats */ static uchar g_crc; static uchar BLK_SHIFT = 9; +static uchar opener_flag = F_NOTRACE; static bool interrupted = FALSE; /* Retain old signal handlers */ @@ -362,9 +363,10 @@ static const char * const messages[] = { #define NNN_NO_AUTOSELECT 10 #define NNN_RESTRICT_NAV_OPEN 11 #define NNN_RESTRICT_0B 12 -#define NNN_TRASH 13 +#define NNN_OPENER_DETACH 13 +#define NNN_TRASH 14 #ifdef __linux__ -#define NNN_OPS_PROG 14 +#define NNN_OPS_PROG 15 #endif static const char * const env_cfg[] = { @@ -381,6 +383,7 @@ static const char * const env_cfg[] = { "NNN_NO_AUTOSELECT", "NNN_RESTRICT_NAV_OPEN", "NNN_RESTRICT_0B", + "NNN_OPENER_DETACH", "NNN_TRASH", #ifdef __linux__ "NNN_OPS_PROG", @@ -3039,7 +3042,7 @@ nochange: } /* Invoke desktop opener as last resort */ - spawn(opener, newpath, NULL, NULL, F_NOTRACE); + spawn(opener, newpath, NULL, NULL, opener_flag); continue; } default: @@ -4103,6 +4106,8 @@ int main(int argc, char *argv[]) /* Get custom opener, if set */ opener = xgetenv(env_cfg[NNN_OPENER], utils[OPENER]); + if (getenv(env_cfg[NNN_OPENER_DETACH])) + opener_flag |= F_NOWAIT; /* Set nnn nesting level, idletimeout used as tmp var */ idletimeout = xatoi(getenv(env_cfg[NNNLVL])); From 00f18570995c2518b51416b64763611baa9a81e8 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 04:57:21 +0530 Subject: [PATCH 28/40] Update docs --- README.md | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 40b5716..e996238 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows and `nnn` works with your DE and favourite GUI utilities, has a unique _navigate-as-you-type_ mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, shell spawning, quick notes and much more. -It supports as many scripts as you need! Integrate utilities like sxiv (view images in directory) or fzy (fuzzy search subtree) with available scripts (or your own), transfer selected files using lftp or use it as a (neo)vim plugin. Refer to the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for more such use cases. +Have as many scripts as you want! View file and directory diffs in vimdiff, integrate utilities like sxiv (to cycle through images in directory) or fzy (to fuzzy search in subtree) with [available scripts](https://github.com/jarun/nnn/tree/master/user-scripts) (or your own), transfer selected files using lftp or use it as a (neo)vim plugin. Refer to the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for more such use cases. [Quickstart](#quickstart) and see how `nnn` simplifies those long desktop sessions. @@ -48,6 +48,7 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [Release packages](#release-packages) - [From source](#from-source) - [Shell completion](#shell-completion) +- [Quickstart](#quickstart) - [Usage](#usage) - [Cmdline options](#cmdline-options) - [Keyboard shortcuts](#keyboard-shortcuts) @@ -60,7 +61,6 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [File indicators](#file-indicators) - [Configuration](#configuration) - [Help](#help) -- [Quickstart](#quickstart) - [User scripts](#user-scripts) - [Troubleshooting](#troubleshooting) - [Tmux configuration](#tmux-configuration) @@ -75,7 +75,8 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima #### FEATURES - Modes - - Detail (default), light, disk usage analyzer (du) + - Detail (default), light + - Disk usage analyzer (block/apparent) - File picker, vim (or neovim) plugin - Navigation - *Navigate-as-you-type* with auto-select directory @@ -150,7 +151,7 @@ It supports as many scripts as you need! Integrate utilities like sxiv (view ima - [Alpine Linux](https://pkgs.alpinelinux.org/packages?name=nnn) (`apk add nnn`) - [Arch Linux](https://www.archlinux.org/packages/community/x86_64/nnn/) (`pacman -S nnn`) -- [CRUX](https://github.com/TimB87/crux-ports/tree/master/nnn) (`prt-get depinst nnn`) +- [CRUX portdb](https://crux.nu/portdb/?a=search&q=nnn) (`prt-get depinst nnn`) - [Debian](https://packages.debian.org/search?keywords=nnn&searchon=names&exact=1) (`apt-get install nnn`) - [Fedora](https://apps.fedoraproject.org/packages/nnn) (`dnf install nnn`) - [FreeBSD](https://www.freshports.org/misc/nnn) (`pkg install nnn`) @@ -191,6 +192,20 @@ To cook yourself, download the [latest stable release](https://github.com/jarun/ Option completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [`scripts/auto-completion/`](scripts/auto-completion). Please refer to your shell's manual for installation instructions. +#### QUICKSTART + +1. Install the [utilities required](#utility-dependencies) for your regular activities. +2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/hacking-nnn#cd-on-quit). +3. Optionally open all text files in EDITOR (fallback vi): + + export NNN_USE_EDITOR=1 +4. Run `n`. +5. To use `nnn` as a GUI app launcher with fuzzy selection menu, drop [`nlaunch`](https://github.com/jarun/nnn/blob/master/user-scripts/nlaunch) somewhere in your `$PATH`. +6. Don't memorize keys. Arrows, / and q suffice. Press ? for help on keyboard shortcuts anytime. + +- For additional functionality [setup custom scripts](#user-scripts). +- Visit the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for many more specific usecases. + #### USAGE #### Cmdline options @@ -389,20 +404,6 @@ The following indicators are used in the detail view: $ man nnn To lookup keyboard shortcuts at runtime, press ?. -#### QUICKSTART - -1. Install the [utilities required](#utility-dependencies) for your regular activities. -2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/hacking-nnn#cd-on-quit). -3. Optionally open all text files in EDITOR (fallback vi): - - export NNN_USE_EDITOR=1 -4. Run `n`. -5. To use `nnn` as a GUI app launcher with fuzzy selection menu, drop [`nlaunch`](https://github.com/jarun/nnn/blob/master/user-scripts/nlaunch) somewhere in your `$PATH`. -6. Don't memorize keys. Arrows, / and q suffice. Press ? for help on keyboard shortcuts anytime. - -- For additional functionality [setup custom scripts](#user-scripts). -- Visit the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for many more specific usecases. - #### USER SCRIPTS `nnn` can invoke custom scripts in the current directory (`$PWD` for the script) with the currently selected file name as the argument. From 144682ad49ea9c95fa935abb14a86de41fb8a95e Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 07:44:34 +0530 Subject: [PATCH 29/40] Add user script to view files in hex --- user-scripts/README.md | 1 + user-scripts/hexview | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100755 user-scripts/hexview diff --git a/user-scripts/README.md b/user-scripts/README.md index f4589e9..08f7a5a 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -5,6 +5,7 @@ | copier | Copy selection to clipboard | | edit | Fuzzy find a file in directory subtree with fzy and edit in vim | | fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open | +| hexview | view a file in hex; needs xxd and $PAGER | | imgur | Upload an image file to imgur | | kdeconnect | Send selected files to Android device using kdeconnect-cli | | ndiff | File and directory diff for selection using vimdiff | diff --git a/user-scripts/hexview b/user-scripts/hexview new file mode 100755 index 0000000..5125fa3 --- /dev/null +++ b/user-scripts/hexview @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +# Description: View a file in hex +# Requires: xxd and $PAGER +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if ! [ -z "$1" ]; then + xxd "$1" | "$PAGER" +fi From f16455f3e0057448ec1208de8faeaf46ecde5964 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 08:38:28 +0530 Subject: [PATCH 30/40] Update docs --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index e996238..76301d9 100644 --- a/README.md +++ b/README.md @@ -196,9 +196,7 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd 1. Install the [utilities required](#utility-dependencies) for your regular activities. 2. Configure [cd on quit](https://github.com/jarun/nnn/wiki/hacking-nnn#cd-on-quit). -3. Optionally open all text files in EDITOR (fallback vi): - - export NNN_USE_EDITOR=1 +3. Optionally open all text files in EDITOR (fallback vi): `export NNN_USE_EDITOR=1` 4. Run `n`. 5. To use `nnn` as a GUI app launcher with fuzzy selection menu, drop [`nlaunch`](https://github.com/jarun/nnn/blob/master/user-scripts/nlaunch) somewhere in your `$PATH`. 6. Don't memorize keys. Arrows, / and q suffice. Press ? for help on keyboard shortcuts anytime. From 9f2955435ed0d87fcb5ea29a6560c28fc15a32bc Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 08:42:34 +0530 Subject: [PATCH 31/40] Do not subscribe to IN_ATTRIB events --- src/nnn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nnn.c b/src/nnn.c index 930f495..c5e66f7 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -409,7 +409,7 @@ static const char * const envs[] = { #define EVENT_SIZE (sizeof(struct inotify_event)) #define EVENT_BUF_LEN (EVENT_SIZE * NUM_EVENT_SLOTS) static int inotify_fd, inotify_wd = -1; -static uint INOTIFY_MASK = IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF +static uint INOTIFY_MASK = /* IN_ATTRIB | */ IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | IN_MOVED_TO; #elif defined(BSD_KQUEUE) #define NUM_EVENT_SLOTS 1 From ebe12e288ac1dd53b43e74ba927d0c0d8236d3ac Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 19:44:07 +0530 Subject: [PATCH 32/40] Update docs --- README.md | 27 +++++++++++---------------- nnn.1 | 18 ++++++++---------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 76301d9..3f4d8d1 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,6 @@ Have as many scripts as you want! View file and directory diffs in vimdiff, inte - [Why fork?](#why-fork) - [Mentions](#mentions) - [Developers](#developers) -- [Contributions](#contributions) #### FEATURES @@ -136,7 +135,7 @@ Have as many scripts as you want! View file and directory diffs in vimdiff, inte | xdg-open (Linux), open(1) (macOS), cygstart (Cygwin) | desktop opener | | file | determine file type | | coreutils (cp, mv, rm), findutils (xargs) | copy, move and remove files | -| trash-cli | trash files (instead of delete) | +| trash-cli | trash files (default: delete) | | mediainfo or exiftool | multimedia file details | | atool, patool ([integration](https://github.com/jarun/nnn/wiki/hacking-nnn#integrate-patool)) | create, list and extract archives | | fzy | app launcher with drop-down menu | @@ -185,7 +184,7 @@ To cook yourself, download the [latest stable release](https://github.com/jarun/ `PREFIX` is supported, in case you want to install to a different location. -- Compilation information for [Raspberry Pi](https://github.com/jarun/nnn/issues/182) +- Compilation for [Raspberry Pi](https://github.com/jarun/nnn/issues/182) - Instructions for [Cygwin](https://github.com/jarun/nnn/wiki/Cygwin-instructions) #### Shell completion @@ -274,7 +273,7 @@ Help & settings, file details, media info and archive listing are shown in the P #### Leader key -The Leader key (` or ^/) provides a powerful multi-functional navigation mechanism. It is case-sensitive and understands contexts, bookmarks and handy location shortcuts. +The Leader key provides a powerful multi-functional navigation mechanism. It is case-sensitive and understands contexts, bookmarks and location shortcuts. | Key | Function | |:---:| --- | @@ -292,8 +291,8 @@ The Leader key (` or ^/) provides a powerful multi-functio Contexts serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner: - the current context is in reverse -- other used contexts are underlined -- rest are unused +- other active contexts are underlined +- rest are inactive To switch to a context press the Leader key followed by the context number (1-4). @@ -303,7 +302,7 @@ When a context is quit, the next active context is selected. If the last active ##### Context-specific color -Each context can have its own color for directories specified: +Each context can have its own directory color specified: export NNN_CONTEXT_COLORS='1234' colors: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white @@ -319,11 +318,11 @@ To copy multiple absolute file paths: - navigate to another file in the same directory to select a range of files - press ^Y again to save the selection and exit selection mode. -Selected files are visually indicated by a `+`. +_NOTE:_ If you are on BSD/macOS, please check the [BSD terminal issue](https://github.com/jarun/nnn#bsd-terminal-issue) with ^Y for workaround. -The files in the list can now be copied (P), moved (V) or removed (X). +Selected files are visually indicated by a `+`. -To list the file paths copied to memory press y. +The selection can now be listed, copied, moved, removed, archived or linked. File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priority) is: @@ -333,11 +332,9 @@ File paths are copied to the temporary file `DIR/.nnncp`, where `DIR` (by priori The path is shown in the help and configuration screen. -_**NOTE:**_ If you are on BSD/macOS, please check the [BSD terminal issue](https://github.com/jarun/nnn#bsd-terminal-issue) with ^Y for workaround. - #### Filters -Filters support regexes by default to instantly (search-as-you-type) list the matching entries in the current directory. +Filters support regexes (default) to instantly (search-as-you-type) list the matching entries in the current directory. Common use cases: - to list all matches starting with the filter expression, start the expression with a `^` (caret) symbol @@ -466,6 +463,4 @@ Restrict opening 0-byte files due to [unexpected behaviour](https://github.com/j 2. Copyright © 2014-2016 Dimitris Papastamos 3. Copyright © 2016-2019 [Arun Prakash Jana](https://github.com/jarun) -#### CONTRIBUTIONS - -We need contributors. Please visit the [ToDo list](https://github.com/jarun/nnn/issues/213). +Contributions are welcome. Please visit the [ToDo list](https://github.com/jarun/nnn/issues/213). diff --git a/nnn.1 b/nnn.1 index 3a96e1b..7ecee23 100644 --- a/nnn.1 +++ b/nnn.1 @@ -76,31 +76,31 @@ supports the following options: .Nm uses \fIxdg-open\fR (on Linux) and \fIopen(1)\fR (on macOS) as the desktop opener. .Pp -There is no configuration file. Settings work on environment variables. Please -refer to the ENVIRONMENT section below. +There is no configuration file. Settings work on environment variables. See ENVIRONMENT section below. .Pp Configuring .Nm to change to the last visited directory on quit requires shell integration in a -few easy steps. Please visit the project page (linked below) for the -instructions. +few easy steps. Look up NNN_TMPFILE in the ENVIRONMENT section below. .Sh CONTEXTS Contexts serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner: .Pp - the current context is in reverse .br -- other used contexts are underlined +- other active contexts are underlined .br -- rest are unused +- rest are inactive .Pp To switch to a context press the Leader key followed by the context number (1-4). .Pp The first time a context is entered, it copies the state of the last visited context. Each context remembers its last visited directory. .Pp When a context is quit, the next active context is selected. If the last active context is quit, the program quits. +.Pp +Each context can have its own directory color specified. See ENVIRONMENT section below. .Sh FILTERS -Filters support regexes by default to instantly (search-as-you-type) list the matching +Filters support regexes (default) to instantly (search-as-you-type) list the matching entries in the current directory. .Pp Common use cases: @@ -135,9 +135,7 @@ Press \fI^Y\fR again to save the selection and exit selection mode. .Pp Selected files are visually indicated by a \fB+\fR. .br -The files in the list can now be copied, moved or removed using respective keyboard shortcuts. -.Pp -To list the selected files press \fIy\fR. +The files in the list can now be listed, copied, moved, removed, archived or linked. .Sh ENVIRONMENT The SHELL, EDITOR (VISUAL, if defined) and PAGER environment variables take precedence when dealing with the !, e and p commands respectively. A single combination to arguments is supported for SHELL and PAGER. From c695e27783ffd4fcd078b0b711fa0a29e49af930 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 21:00:16 +0530 Subject: [PATCH 33/40] nlaunch is an independent app launcher --- user-scripts/README.md | 2 +- user-scripts/nlaunch | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/user-scripts/README.md b/user-scripts/README.md index 08f7a5a..952fce7 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -9,7 +9,7 @@ | imgur | Upload an image file to imgur | | kdeconnect | Send selected files to Android device using kdeconnect-cli | | ndiff | File and directory diff for selection using vimdiff | -| nlaunch | Drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | +| nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | | picker | Pick files and pipe the newline-separated list to another utility | | sxiv | Open images in current directory in sxiv | | upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch | diff --git a/user-scripts/nlaunch b/user-scripts/nlaunch index 7eee8a0..7448ca9 100755 --- a/user-scripts/nlaunch +++ b/user-scripts/nlaunch @@ -1,7 +1,8 @@ #!/usr/bin/env sh -# Description: Fuzzy find executables in $PATH and launch an application -# stdin, stdout, stderr are suppressed so CLI utilities exit silently +# Description: Fuzzy find executables in $PATH and launch an application. +# stdin, stdout, stderr are suppressed so CLI utilities exit silently. +# Works as an independent app launcher. # # Shell: POSIX compliant # Author: Arun Prakash Jana From 8be36b9ae278e3e6a071eb3328e53446f8b30caa Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 23 Mar 2019 23:30:18 +0530 Subject: [PATCH 34/40] Update docs --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3f4d8d1..5339df0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -## nnn - -Noice is Not Noice, a noicer fork... +## nnn (_type less, do more_)

Latest release @@ -447,6 +445,8 @@ Restrict opening 0-byte files due to [unexpected behaviour](https://github.com/j - one can argue my approach deviates from the goal of the original project - keep the utility `suckless`. `noice` was rudimentary. In my opinion evolution is the taste of time. - I would like to have a bit of control on what features are added in the name of desktop integration. A feature-bloat is the last thing in my mind. Check out [nnn design considerations](https://github.com/jarun/nnn/wiki/nnn-design-considerations) for more details. +Trivia: The name `nnn` stands for _Noice is Not Noice, a noicer fork..._. + #### MENTIONS - [FOSSMint](https://www.fossmint.com/nnn-linux-terminal-file-browser/) From 653b7d9211271797e11d33bc5bb43922c0386d06 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 01:21:34 +0530 Subject: [PATCH 35/40] Update docs --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5339df0..0957f77 100644 --- a/README.md +++ b/README.md @@ -18,17 +18,15 @@ [![nnn video](https://i.imgur.com/ZB5UdQ8.jpg)](https://www.youtube.com/watch?v=U2n5aGqou9E "Click to see nnn in action!") -

nnn in action! (Thanks Luke Smith for the video!)

+

video of nnn in action (an earlier release)

-`nnn` is smooth... like butter. It's also one of the fastest and most lightweight file managers you have ever used. It comes in a `~50KB` binary using `~3.5MB` resident memory at runtime. +`nnn` is one of the fastest and most lightweight file managers you have ever used (binary size `~50KB`, resident memory usage `~3.5MB`). And yet, it doesn't lack in features! -Runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows and Termux on Android. +`nnn` works seamlessly with your DE and favourite GUI utilities. It runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows and Termux on Android. -`nnn` works with your DE and favourite GUI utilities, has a unique _navigate-as-you-type_ mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, shell spawning, quick notes and much more. +Have as many scripts as you want to extend the power of `nnn`! Pick from the [scripts repository](https://github.com/jarun/nnn/tree/master/user-scripts) or add your own. -Have as many scripts as you want! View file and directory diffs in vimdiff, integrate utilities like sxiv (to cycle through images in directory) or fzy (to fuzzy search in subtree) with [available scripts](https://github.com/jarun/nnn/tree/master/user-scripts) (or your own), transfer selected files using lftp or use it as a (neo)vim plugin. Refer to the wiki page [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn) for more such use cases. - -[Quickstart](#quickstart) and see how `nnn` simplifies those long desktop sessions. +[Quickstart](#quickstart) and see how `nnn` simplifies long desktop sessions. When you are ready for more, start [hacking `nnn`](https://github.com/jarun/nnn/wiki/hacking-nnn). *Love smart and efficient utilities? Explore [my repositories](https://github.com/jarun?tab=repositories). Buy me a cup of coffee if they help you.* @@ -101,6 +99,7 @@ Have as many scripts as you want! View file and directory diffs in vimdiff, inte - Copy, move, delete, archive, link selection - FreeDesktop compliant trash (needs trash-cli) - Show copy, move progress on Linux (needs avdcpmv) + - Script to view directory and file diff for selection - Transfer files using lftp - Batch rename (needs vidir) - Per-context directory color (default: blue) @@ -112,7 +111,7 @@ Have as many scripts as you want! View file and directory diffs in vimdiff, inte - Change directory at exit (*easy* shell integration) - Edit file in EDITOR or open in PAGER - Take quick notes - - Terminal locker integration + - Lock the terminal (needs a locker) - Shortcut reference a keypress away - Unicode support - Follows Linux kernel coding style From 0328eafcb9cff7b90963b4dd7d2bfae6eca0cbd7 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 11:07:14 +0530 Subject: [PATCH 36/40] Add script to resize images in directory --- user-scripts/README.md | 1 + user-scripts/imgresize | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 user-scripts/imgresize diff --git a/user-scripts/README.md b/user-scripts/README.md index 952fce7..1bfcbd4 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -6,6 +6,7 @@ | edit | Fuzzy find a file in directory subtree with fzy and edit in vim | | fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open | | hexview | view a file in hex; needs xxd and $PAGER | +| imgresize | Resize images in directory to screen resolution (needs [imgp](https://github.com/jarun/imgp)) | | imgur | Upload an image file to imgur | | kdeconnect | Send selected files to Android device using kdeconnect-cli | | ndiff | File and directory diff for selection using vimdiff | diff --git a/user-scripts/imgresize b/user-scripts/imgresize new file mode 100755 index 0000000..40b9945 --- /dev/null +++ b/user-scripts/imgresize @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +# Description: Resize images in a directory to screen resolution with imgp +# imgp homepage: https://github.com/jarun/imgp +# +# Notes: +# 1. Set res if you don't want to be prompted for desktop resolution every time +# 2. minsize is set to 1MB by default, adjust it if you want +# 3. imgp options used: +# a - adaptive mode +# c - convert PNG to JPG +# k - skip images matching specified hres/vres +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +# set resolution (e.g. 1920x1080) +res= + +# set minimum image size (in bytes) to resize (default: 1MB) +minsize=1048576 + +if [ -z "$res" ]; then + echo -n "desktop resolution (hxv): " + read res +fi + +if [ -z "$res" ]; then + if ! [ -z "$minsize" ]; then + imgp -ackx "$res" -s "$minsize" + fi +fi From f135a30c0c95b84eb62b157f6ff454866b250fce Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 17:38:29 +0530 Subject: [PATCH 37/40] Add script to upload a file to transfer.sh --- user-scripts/README.md | 1 + user-scripts/imgresize | 2 +- user-scripts/transfer | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 user-scripts/transfer diff --git a/user-scripts/README.md b/user-scripts/README.md index 1bfcbd4..cbed784 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -13,4 +13,5 @@ | nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | | picker | Pick files and pipe the newline-separated list to another utility | | sxiv | Open images in current directory in sxiv | +| transfer | Upload current file to transfer.sh | | upgrade | Check and update to latest version of nnn manually on Debian 9 Stretch | diff --git a/user-scripts/imgresize b/user-scripts/imgresize index 40b9945..6d016f1 100755 --- a/user-scripts/imgresize +++ b/user-scripts/imgresize @@ -25,7 +25,7 @@ if [ -z "$res" ]; then read res fi -if [ -z "$res" ]; then +if ! [ -z "$res" ]; then if ! [ -z "$minsize" ]; then imgp -ackx "$res" -s "$minsize" fi diff --git a/user-scripts/transfer b/user-scripts/transfer new file mode 100755 index 0000000..7201b0b --- /dev/null +++ b/user-scripts/transfer @@ -0,0 +1,16 @@ +#!/usr/bin/env sh + +# Description: Upload a file to transfer.sh +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if ! [ -z "$1" ]; then + # Upload the file, show the download link and wait till user presses any key + curl -s --upload-file "$1" https://transfer.sh/`basename "$1"` + echo + read input + + # To write download link to "$1".loc and exit + # curl -s --upload-file "$1" https://transfer.sh/`basename "$1"` -o `basename "$1"`.loc +fi From 1bd42c40c6778263ff35ece3592bfc2c140fcd7a Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 20:33:27 +0530 Subject: [PATCH 38/40] Add script to invoke pastebinit --- user-scripts/README.md | 1 + user-scripts/paste | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 user-scripts/paste diff --git a/user-scripts/README.md b/user-scripts/README.md index cbed784..bc71c70 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -11,6 +11,7 @@ | kdeconnect | Send selected files to Android device using kdeconnect-cli | | ndiff | File and directory diff for selection using vimdiff | | nlaunch | Drop-down independent app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | +| paste | Paste contents of current (text) file to paste.ubuntu.com (needs [pastebinit](https://launchpad.net/pastebinit)) | | picker | Pick files and pipe the newline-separated list to another utility | | sxiv | Open images in current directory in sxiv | | transfer | Upload current file to transfer.sh | diff --git a/user-scripts/paste b/user-scripts/paste new file mode 100755 index 0000000..de130e4 --- /dev/null +++ b/user-scripts/paste @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +# Description: Paste contents of a text a file to paste.ubuntu.com using pastebinit +# +# pastebinit: https://launchpad.net/pastebinit +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if ! [ -z "$1" ]; then + pastebinit "$1" + read input +fi From b6c66a78c01384ea1cc255c5c16db4a436136109 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 21:11:43 +0530 Subject: [PATCH 39/40] Use POSIX compliant sh scripts if possible --- user-scripts/copier | 2 +- user-scripts/edit | 8 ++------ user-scripts/fzy | 8 ++------ user-scripts/kdeconnect | 2 +- user-scripts/picker | 2 +- user-scripts/upgrade | 2 +- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/user-scripts/copier b/user-scripts/copier index a99b88b..2aec820 100755 --- a/user-scripts/copier +++ b/user-scripts/copier @@ -2,7 +2,7 @@ # Description: Copy selection to clipboard # -# Shell: generic +# Shell: POSIX compliant # Author: Arun Prakash Jana # Linux diff --git a/user-scripts/edit b/user-scripts/edit index f23d7a8..d15b34e 100755 --- a/user-scripts/edit +++ b/user-scripts/edit @@ -2,11 +2,7 @@ # Description: Fuzzy find a file in directory subtree with fzy and edit in vim # -# Shell: generic +# Shell: POSIX compliant # Author: Arun Prakash Jana -# bash, zsh -vim $(find -type f | fzy) - -# fish -# vim (find -type f | fzy) +vim `find -type f | fzy` diff --git a/user-scripts/fzy b/user-scripts/fzy index ba8cfc9..0e52b28 100755 --- a/user-scripts/fzy +++ b/user-scripts/fzy @@ -2,11 +2,7 @@ # Description: Fuzzy find a file in directory subtree with fzy and open using xdg-open # -# Shell: generic +# Shell: POSIX compliant # Author: Arun Prakash Jana -# bash, zsh -xdg-open $(find -type f | fzy) >/dev/null 2>&1 - -# fish -# xdg-open (find -type f | fzy) >/dev/null 2>&1 +xdg-open `find -type f | fzy` >/dev/null 2>&1 diff --git a/user-scripts/kdeconnect b/user-scripts/kdeconnect index ac247f4..db28e7a 100755 --- a/user-scripts/kdeconnect +++ b/user-scripts/kdeconnect @@ -2,7 +2,7 @@ # Description: Send the selected files to your Android device using kdeconnect-cli. You must have installed and configured kdeconnect both on the Android device and on the PC. # -# Shell: Bash +# Shell: bash # Author: juacq97 id=$(kdeconnect-cli -a --id-only | awk '{print $1}') diff --git a/user-scripts/picker b/user-scripts/picker index cebecb1..a500435 100755 --- a/user-scripts/picker +++ b/user-scripts/picker @@ -2,7 +2,7 @@ # Description: Pick files and pipe the newline-separated list to another utility # -# Shell: generic +# Shell: POSIX compliant # Author: Arun Prakash Jana # # Usage: diff --git a/user-scripts/upgrade b/user-scripts/upgrade index fa044ee..858a6a0 100755 --- a/user-scripts/upgrade +++ b/user-scripts/upgrade @@ -18,7 +18,7 @@ fi wget "https://github.com/jarun/nnn/releases/download/v$new/nnn_$new-1_debian9.amd64.deb" # install it -dpkg -i nnn_$new-1_debian9.amd64.deb +sudo dpkg -i nnn_$new-1_debian9.amd64.deb # remove the file rm -rf nnn_$new-1_debian9.amd64.deb From 28ef959e7119e0ff8eed426f636f19744825e4dd Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 24 Mar 2019 22:01:15 +0530 Subject: [PATCH 40/40] Update docs --- README.md | 4 ++-- user-scripts/README.md | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0957f77..d6bc95b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@

video of nnn in action (an earlier release)

-`nnn` is one of the fastest and most lightweight file managers you have ever used (binary size `~50KB`, resident memory usage `~3.5MB`). And yet, it doesn't lack in features! +`nnn` is one of the fastest and most lightweight file managers you have ever used (`~50KB` binary, `~3.5MB` resident memory usage, [highly optimized](https://github.com/jarun/nnn/wiki/performance-factors) code). And yet, it doesn't lack in features! `nnn` works seamlessly with your DE and favourite GUI utilities. It runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows and Termux on Android. @@ -72,7 +72,7 @@ Have as many scripts as you want to extend the power of `nnn`! Pick from the [sc - Modes - Detail (default), light - Disk usage analyzer (block/apparent) - - File picker, vim (or neovim) plugin + - File picker, (neo)vim plugin - Navigation - *Navigate-as-you-type* with auto-select directory - *Wild load* for *navigate-as-you-type* diff --git a/user-scripts/README.md b/user-scripts/README.md index bc71c70..18ed906 100644 --- a/user-scripts/README.md +++ b/user-scripts/README.md @@ -1,6 +1,4 @@ -#### Alphabetical list of scripts - -| Script | Description | +| Script (a-z) | Description | | --- | --- | | copier | Copy selection to clipboard | | edit | Fuzzy find a file in directory subtree with fzy and edit in vim |