Hi, --toggle-sort is being used in fzf_history but fzf --help doesn't mention what it does.
In fzf_history, why have +s followed by --toggle-sort?
Also, can you please explain what -n does with an example?
Have you looked at man fzf? More information can be found in the man page. --toggle-sort is kind of deprecated (no plan to remove it though) as it's equivalent to --bind KEYNAME:toggle-sort. We disable sorting with +s (--no-sort) by default to display the commands in chronological order. But sorting can be dynamically enabled by the key specified in --toggle-sort.
-n 2.. (ignoring index number) allows you to perform prefix match on the command for example ^git.
Have you looked at man fzf?
No, I didn't even know a man page existed. Thanks for letting me know. That helps but just raises more questions for eg. this bit here: -n2..,... The man page says -n2.. will restrict the search scope to the 2nd to the last field but then there's also ,.. after that increasing the search scope to all fields. Either I'm not following what it does exactly or that seems redundant.
Also, the only thing in there is this line toggle-sort is equivalent to --toggle-sort. It doesn't mention how sorting works. I tried using C-r but that doesn't seem to do anything. Here's an example of the before and after pressing it:
Before:

After:

As you can see the order of the command history hasn't changed.
Each comma-separated search scope is tried in order. So fzf first checks if the query matches in 2.. scope, if not, then it searches the whole scope ...
^sudo won't match without 2..2su won't match without ..^20 is also validSee the point?
As you can see the order of the command history hasn't changed.
Try it after typing in some query string. Regarding the ranking algorithm, see https://github.com/junegunn/fzf/blob/0.15.9/src/algo/algo.go#L39
Ah, I see. Thanks a lot for answering all my questions.
Most helpful comment
Each comma-separated search scope is tried in order. So fzf first checks if the query matches in
2..scope, if not, then it searches the whole scope...^sudowon't match without2..2suwon't match without..^20is also validSee the point?
Try it after typing in some query string. Regarding the ranking algorithm, see https://github.com/junegunn/fzf/blob/0.15.9/src/algo/algo.go#L39