From dd214c50f3a17ccb08f70cf2ed9495dbe7adf8fc Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 3 Jan 2023 04:37:07 +0530 Subject: [PATCH] Update plugin docs and examples --- nnn.1 | 6 ++++-- plugins/README.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nnn.1 b/nnn.1 index 091a92af..7b736a25 100644 --- a/nnn.1 +++ b/nnn.1 @@ -440,14 +440,15 @@ separated by \fI;\fR: export NNN_PLUG='y:-!sync*' 6. To run a \fIGUI app as plugin\fR, add a \fB&\fR after \fB!\fR - Note: \fI$nnn\fR must be the last argument in this case. + \fI$nnn\fR must be the last argument in this case. export NNN_PLUG='m:-!&mousepad $nnn' 7. To show the output of run-and-exit commands which do not need user input, add \fB|\fR (pipe) after \fB!\fR Note: This option is incompatible with \fB&\fR (terminal output is masked - for GUI programs) and ignores \fB*\fR (output is already paged for user) + for GUI programs) and ignores \fB*\fR (output is already paged for user). + \fI$nnn\fR must be the last argument in this case as well. export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-directories-first' @@ -457,6 +458,7 @@ separated by \fI;\fR: ------------------------------------ + ------------------------------------------------- c:!convert $nnn png:- | xclip -sel \ | Copy image to clipboard clipboard -t image/png* | + C:!cp -rv "$nnn" "$nnn".cp* | Create a copy of the hovered file e:-!sudo -E vim $nnn* | Edit file as root in vim g:-!git diff | Show git diff h:-!hx $nnn* | Open hovered file in hx hex editor diff --git a/plugins/README.md b/plugins/README.md index b7ef7d6b..ca5af90b 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -169,7 +169,7 @@ To run a GUI app as plugin, add a `&` after `!`. export NNN_PLUG='m:-!&mousepad $nnn' ``` -Note: `$nnn` must be the last argument in this case. +`$nnn` must be the last argument in this case. #### Page non-interactive command output [`|`] @@ -180,11 +180,12 @@ export NNN_PLUG='m:-!|mediainfo $nnn;t:-!|tree -ps;l:-!|ls -lah --group-director ``` This option is incompatible with `&` (terminal output is masked for GUI programs) and ignores `*` (output is already paged for user). +`$nnn` must be the last argument in this case as well. Notes: 1. Use single quotes for `$NNN_PLUG` so `$nnn` is not interpreted -2. `$nnn` must be the last argument (if used) to run a _command as plugin_ +2. `$nnn` must be the last argument (if used) to run a _GUI app as plugin_ or to page non-interactive command output 3. (_Again_) add `!` before the command 4. To disable directory refresh after running a _command as plugin_, prefix with `-!` @@ -193,6 +194,7 @@ Notes: | Key:Command | Description | |---|---| | `c:!convert $nnn png:- \| xclip -sel clipboard -t image/png*` | Copy image to clipboard | +| `C:!cp -rv "$nnn" "$nnn".cp` | Create a copy of the hovered file | | `e:-!sudo -E vim $nnn*` | Edit file as root in vim | | `g:-!git diff` | Show git diff | | `h:-!hx $nnn*` | Open hovered file in [hx](https://github.com/krpors/hx) hex editor |