-
Hi. I'm writing a script¹ that should display a list of entries for selection in Fzf that is running in a Vim pop-up window. The entries themselves are read from a text file. The problem is that in a case of a large number of entries the program crashes, returning the error: What happens and why? How the mentioned problem could be solved? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
It's an error from your shell, not fzf. There is a limit to the number/length of arguments you can pass to a command. It looks like |
Beta Was this translation helpful? Give feedback.
-
I gave a simplified version of the script. In the original version, after reading data from the file, it's further processed and formatted. Only after that the resulting data is passed to the input of Fzf. I made a change to the sample script to illustrate the matter. It looks like, this resulting data should also be saved in a file. After that the file should be read in Fzf command, as you wrote, i. e. If you have any other thoughts on the problem, I would be glad to hear them. |
Beta Was this translation helpful? Give feedback.
-
Understood. The issue is closed.
As far as I understand, this is the only way to pass a command to Fzf, that it should execute when it starts. In skim, an alternative to Fzf, there is a special option for that matter, i. e. |
Beta Was this translation helpful? Give feedback.
-
No, you can just run the source command with fzf using a shell. call term_start(['sh', '-c', 'seq 100 | fzf'])
Why do we need it when we can FWIW, fzf can also do that using a far more extensible event-binding mechanism. : | fzf --bind 'start:reload(seq 1 1000)' More examples on https://github.com/junegunn/fzf/blob/master/ADVANCED.md |
Beta Was this translation helpful? Give feedback.
-
Great! I rewrote the script in accordance with your recommendations. In addition, in the new version of the script, the processed data is written to a file and subsequently read from it. Therefore, no error occurs. I tested the script on 1,000,000 entries and the program works with acceptable performance for me. Is it something else, I need to care about?
That's an interesting read. Thanks! |
Beta Was this translation helpful? Give feedback.
-
With the |
Beta Was this translation helpful? Give feedback.
-
Perfect! Thank you very much for your explanations and for the help! |
Beta Was this translation helpful? Give feedback.
This is a limitation of your shell environment, there's nothing fzf can help alleviate the problem. I mean, you'll run into the same problem just by running the
echo
command.You'll either have to save the result to a temp file or find another way to filter/transform the list. e.g.
seq 10000 | perl -ne 'print if $_ % 2 == 0' | fzf