Update plugin docs and examples

This commit is contained in:
Arun Prakash Jana 2023-01-03 04:37:07 +05:30
parent c9b384f009
commit dd214c50f3
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 8 additions and 4 deletions

6
nnn.1
View File

@ -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

View File

@ -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 |