jarun/nnn

Processing $NNN_SEL?

rieje opened this issue · 2 comments

rieje commented

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 commented

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

jarun commented

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