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

Processing $NNN_SEL? #771

Closed
rieje opened this issue Nov 1, 2020 · 2 comments
Closed

Processing $NNN_SEL? #771

rieje opened this issue Nov 1, 2020 · 2 comments

Comments

@rieje
Copy link

rieje commented Nov 1, 2020

My attempt at trying to process $NNN_SEL:

while IFS= read -r -d $'\0' file; do
   echo $file
done < <(cat /tmp/.nnn-selection)

results in the last filename not printing. Should a null character also be appended to the last filename in $NNN_SEL and if not, how should all the filenames be processed? Since this is probably a technical support question, maybe I should tack on a tangentially related feature request to add some substance:


  • Support custom path for .lastd and saved sessions.

They are in ~/.config/nnn but it would be flexible to one's workflow to have them anywhere. For example, I would like to sync my sessions and progress between my machines. I'm currently using Syncthing to sync files but would rather not add ~/.config/nnn as a directory to sync and instead add these files to my existing directory intended for syncing between multiple machines.

@jarun
Copy link
Owner

jarun commented Nov 1, 2020

@KlzXS or @leovilok can you please check this out?

@jarun
Copy link
Owner

jarun commented Nov 1, 2020

@rieje please check how xargs is doing this.

Here's what I see with 7 files selected:

xargs -0 ls -1 < /tmp/.sel                       
/home/vaio/GitHub/nnn/src/dbg.h
/home/vaio/GitHub/nnn/src/icons.h
/home/vaio/GitHub/nnn/src/icons-in-terminal.h
/home/vaio/GitHub/nnn/src/icons-nerdfont.h
/home/vaio/GitHub/nnn/src/nnn.c
/home/vaio/GitHub/nnn/src/nnn.h
/home/vaio/GitHub/nnn/src/qsort.h

NUL terminator is not required at the end.

@jarun jarun closed this as completed Nov 1, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants