mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Update docs
This commit is contained in:
parent
86e579799b
commit
69e132e36d
18
nnn.1
18
nnn.1
|
@ -408,6 +408,15 @@ separated by \fI;\fR:
|
||||||
export NNN_TRASH=1
|
export NNN_TRASH=1
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
\fBNNN_SEL:\fR absolute path to custom selection file.
|
||||||
|
.Pp
|
||||||
|
\fBNNN_FIFO:\fR path of a named pipe to write current file path:
|
||||||
|
.Bd -literal
|
||||||
|
export NNN_FIFO='/tmp/nnn.fifo'
|
||||||
|
|
||||||
|
NOTE: If the FIFO file doesn't exist it will be created, but it will never be removed.
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
\fBNNN_LOCKER:\fR terminal locker program.
|
\fBNNN_LOCKER:\fR terminal locker program.
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
export NNN_LOCKER='bmon -p wlp1s0'
|
export NNN_LOCKER='bmon -p wlp1s0'
|
||||||
|
@ -421,15 +430,6 @@ separated by \fI;\fR:
|
||||||
NOTE: Only the first character is considered if not a \fICtrl+key\fR combo.
|
NOTE: Only the first character is considered if not a \fICtrl+key\fR combo.
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
\fBNNN_SEL:\fR absolute path to custom selection file.
|
|
||||||
.Pp
|
|
||||||
\fBNNN_FIFO:\fR path of a named pipe to write current file path:
|
|
||||||
.Bd -literal
|
|
||||||
export NNN_FIFO='/tmp/nnn.fifo'
|
|
||||||
|
|
||||||
NOTE: If the FIFO file doesn't exist it will be created, but it will never be removed.
|
|
||||||
.Ed
|
|
||||||
.Pp
|
|
||||||
\fBnnn:\fR this is a special variable set to the hovered entry before executing
|
\fBnnn:\fR this is a special variable set to the hovered entry before executing
|
||||||
a command from the command prompt or spawning a shell.
|
a command from the command prompt or spawning a shell.
|
||||||
.Pp
|
.Pp
|
||||||
|
|
|
@ -186,6 +186,16 @@ For convenience, we provided a helper script named `.nnn-plugin-helper` and a fu
|
||||||
If a context is not provided, it is asked for explicitly. To skip this and choose the current context, set the `CUR_CTX` variable in `.nnn-plugin-helper` to `1`.
|
If a context is not provided, it is asked for explicitly. To skip this and choose the current context, set the `CUR_CTX` variable in `.nnn-plugin-helper` to `1`.
|
||||||
Usage examples can be found in the Examples section below.
|
Usage examples can be found in the Examples section below.
|
||||||
|
|
||||||
|
#### Get notified on file hover
|
||||||
|
|
||||||
|
If `NNN_FIFO` is set, `nnn` will open it and write every hovered files. This can be used in plugins, e.g. to implement file previews.
|
||||||
|
|
||||||
|
If a `NNN_FIFO` is set globally, each `nnn` instance will write to it, and a process reading from the pipe will get hovered path from every instance, interleaved.
|
||||||
|
|
||||||
|
If you want to prevent this and be sure to have a private pipe to one `nnn` instance, you can unlink (remove) the FIFO file. If you had opened the FIFO before and you have read from it (so that `nnn` have it opened too), you can still read from it while you don't close it. But new `nnn` instances will recreate a new FIFO not linked to the previous one.
|
||||||
|
|
||||||
|
Don't forget to fork in the background to avoid blocking `nnn`.
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
There are many plugins provided by `nnn` which can be used as examples. Here are a few simple selected examples.
|
There are many plugins provided by `nnn` which can be used as examples. Here are a few simple selected examples.
|
||||||
|
|
||||||
|
@ -220,39 +230,25 @@ There are many plugins provided by `nnn` which can be used as examples. Here are
|
||||||
printf "%s" "0c$dir" > "$NNN_PIPE"
|
printf "%s" "0c$dir" > "$NNN_PIPE"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Get notified on file hover
|
- Send every hovered file to X selection
|
||||||
|
```sh
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
if [ -z "$NNN_FIFO" ] ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
If `NNN_FIFO` is set, `nnn` will open it and write every hovered files.
|
while read FILE ; do
|
||||||
This can be used in plugins, e.g. to implement file previews.
|
if [ -n "$NNN_FIFO" ] ; then
|
||||||
|
# If you want to remove the FIFO,
|
||||||
If a `NNN_FIFO` is set globally, each `nnn` instance will write to it, and a process reading from the pipe will get hovered path from every instance, interleaved.
|
# don't do it before first read,
|
||||||
|
# nnn won't have it opened yet
|
||||||
If you want to prevent this and be sure to have a private pipe to one `nnn` instance, you can unlink (remove) the FIFO file.
|
rm "$NNN_FIFO"
|
||||||
If you opened the FIFO before and you have read from it (so that `nnn` have it opened too), you can still read from it while you don't close it.
|
NNN_FIFO=
|
||||||
But new `nnn` instances will recreate a new FIFO not linked to the previous one.
|
fi
|
||||||
|
printf "%s" "$FILE" | xsel
|
||||||
Don't forget to fork in the background to avoid blocking `nnn`.
|
done < "$NNN_FIFO" &
|
||||||
|
disown
|
||||||
Example (send every hovered file to X selection):
|
```
|
||||||
|
|
||||||
```sh
|
|
||||||
#!/usr/bin/env sh
|
|
||||||
if [ -z "$NNN_FIFO" ] ; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read FILE ; do
|
|
||||||
if [ -n "$NNN_FIFO" ] ; then
|
|
||||||
# If you want to remove the FIFO,
|
|
||||||
# don't do it before first read,
|
|
||||||
# nnn won't have it opened yet
|
|
||||||
rm "$NNN_FIFO"
|
|
||||||
NNN_FIFO=
|
|
||||||
fi
|
|
||||||
printf "%s" "$FILE" | xsel
|
|
||||||
done < "$NNN_FIFO" &
|
|
||||||
disown
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing plugins
|
## Contributing plugins
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue