Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent session and behavior of $NNN_PIPE #777

Closed
amanjitsk opened this issue Nov 11, 2020 · 8 comments
Closed

Persistent session and behavior of $NNN_PIPE #777

amanjitsk opened this issue Nov 11, 2020 · 8 comments
Labels

Comments

@amanjitsk
Copy link

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

@amanjitsk amanjitsk added the bug label Nov 11, 2020
@jarun
Copy link
Owner

jarun commented Nov 12, 2020

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.

@jarun
Copy link
Owner

jarun commented Nov 12, 2020

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

@jarun
Copy link
Owner

jarun commented Nov 12, 2020

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.

@jarun
Copy link
Owner

jarun commented Nov 12, 2020

Doc updated: https://github.com/jarun/nnn/wiki/Troubleshooting#find--list-issues

@jarun jarun closed this as completed Nov 12, 2020
@jarun
Copy link
Owner

jarun commented Nov 13, 2020

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.

@jarun
Copy link
Owner

jarun commented Nov 13, 2020

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.

jarun added a commit that referenced this issue Nov 13, 2020
If an input stream is available, prioritize that over sessions. find/grep
syntax can be very complex and can be scripted. On the contrary, sessions
can be loaded at runtime and the persistent session can be "restored".

An interesting use case is the listing is done in picker mode from a script
and the user expects to "pick" some entries among the listed search results.

Another important change is - if the user tries to load the "last session"
explicitly by name instead of using the session option _restore_, we should
not overwrite the "last session" ("@") before loading the it.
@jarun
Copy link
Owner

jarun commented Nov 13, 2020

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

@jarun
Copy link
Owner

jarun commented Nov 13, 2020

More doc updates in commit b09adb4.

This was referenced Nov 13, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants