Most of this is taken from fzf.fish. A really nice fzf integration with fish-shell.
There's quite a bit of usage of a fish command called commandline
. It would be super helpful for porting things like this script if we had such a utility to modify the readline command line buffer.
Set the default fzf options
let-env FZF_DEFAULT_OPTS = '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'