Standalone selection script #1929
-
I have a script that returns paths separated by new lines. What I want is a functionality for lf so that
end up with lf opening up and having those files that are read from stdin as its selection. I understand I can map it within lf like this:
But can this be done as a standalone script? Would this feature be worth adding? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You can use the
#!/bin/sh
lf -command "cmd on-init toggle $(tr '\n' ' ')" And then use it like so: ls | head -n 5 | lfselect.sh |
Beta Was this translation helpful? Give feedback.
-
More questions:
Alternatives I considered which I wonder why they don't work: lf -command "cmd on-init toggle $(IFS='
' cat)" IFS='
' lf -command "cmd on-init toggle $(cat)" |
Beta Was this translation helpful? Give feedback.
You can use the
-command
option to havelf
do something upon startup (such as selecting files), and then wrap that up into a script:lfselect.sh
And then use it like so: