Nnn: Persistent session and behavior of `$NNN_PIPE`

Created on 12 Nov 2020  路  8Comments  路  Source: jarun/nnn

Environment details (Put x in the checkbox along with the information)

[x] Operating System: Ubuntu 20.04 LTS
[x] Desktop Environment: bspwm
[x] Terminal Emulator: st, kitty
[x] Shell: zsh
[x] Custom desktop opener (if applicable): nuke
[x] Program options used: export NNN_OPTS="cCdEfHorQSUx" (the S option is
relevant here)
[x] Configuration options set:
[x] Issue exists on nnn master

Exact steps to reproduce the issue

I have noticed a couple of inconsistencies when using nnn
with the persistent session option set.
For example, none of the plugins that use $NNN_PIPE
to create a new context work as expected (finder, mimelist etc.).
Furthermore, with this option set, I can no longer start nnn
with passing files at stdin. For example, I used to be able to
something like

fd log_file.txt -0 | nnn

but this no longer works with the persistent option set.
I am not sure if this expected or even documented behavior,
but I sure hope that some of these inconsistencies can be
resolved, because I really do find the persistent option very
useful, and also heavily rely on plugins such as finder.

Thanks,
Amanjit

bug

All 8 comments

For me the plugins you mentioned run file when I issue them within nnn.

I would suggest the following:

  • refresh the plugins, including the internal ones like .nnn-plugin-helper, and install them
  • remove older sessions (in case there is any incompatibility in the persistent confg flags) and create a new persistent session

The only thing that didn't work for me is:

fd log_file.txt -0 | nnn

I have to spend time on it. Can't be immediate.

@leovilok and @KlzXS feel free to take a look.

Piping to nnn doesn't work because the input has to be parsed earlier than the session load and loading the session overwrites the context for the list results.

As we can run custom searches within nnn (last 2 examples here) I will document this case instead of adding unnecessary complexity to the code.

I am thinking we should give more priority to the input stream rather than the stored session. find/grep syntax can be very complex and if the user is explicitly trying to list the results then that's what he wants to work.

In fact the user can always finish what he wants to do with the list results and then use session -> restore to restore the "last session" if he needs.

Please test and confirm it works as documented in the fix.

More doc updates in commit b09adb4654ea68e27b91a96b8e2bfd96a1378971.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

z0rc picture z0rc  路  7Comments

billop picture billop  路  5Comments

snide picture snide  路  6Comments

akimdi picture akimdi  路  6Comments

deadpyxel picture deadpyxel  路  5Comments