The key bindings are not available until I manually execute fzf_key_bindings in the shell.
I did the following according to the install guide
brew update
brew reinstall fzf
/usr/local/opt/fzf/install
However somehow fish does not auto execute the key bindings.
In my desperation I also tried to add the following to my .config/fish/config.fish
...
fzf_key_bindings
...
But that didn't help either.
Fish Version 2.5.0
fzf Version 0.16.5
install script does two things for fish:
~/.config/fish/functions/fzf_key_bindings.fishfzf_key_bindings to ~/.config/fish/functions/fish_user_key_bindings.fishCheck if both files exist and there's fzf_key_bindings in fish_user_key_bindings.fish.
The files exist and have the expected contents. However calling fzf_key_bindings inside the functions file does not seem to have any effect. As stated earlier in my desperation I have created a Config.fish file and added fzf_key_bindings call there too but that doesn't seem to do anything.
I am using oh-my-fish. Not sure if that has anything to do with it. Also note that I didn't have a fish_user_key_bindings.fish file before. So it only has this one entry.
Hmm, I see. I don't use fish so I don't know much about it. I also have no experience with oh-my-fish. All I can confirm is that it works as expected on my machine with vanilla fish 2.5.0. You might want to reach out to more experienced fish users especially the ones who use oh-my-fish.
Hi. I have same issue as @rburgst. Don't know what happed (maybe something broke after updating Fedora).
[~]─> omf --version
Oh My Fish version 5
[~]─> fzf --version
0.16.5
Here is some info about my last update.
Unfortunately I can't undo this update because I didn't have _keepcache_ turned on in DNF and one of the packages is gone from repo.
@rburgst could you pls repost on omf github? https://github.com/oh-my-fish/oh-my-fish/issues
I think this is a bug with how fzf writes to fish_user_key_bindings.fish. I fixed it by updating it to be within a function like so:
function fish_user_key_bindings
fzf_key_bindings
end
fish 2.5.0, omf 5, fzf 0.16.6
@cmrn this works! Thanks a lot!
So what do you suggest? It's not going to be trivial for the install script to inject the line if fish_user_key_bindings function already exists. I don't know fish, and it's probably not a conventional way to write fish_user_key_bindings.fish, but it works anyway if OMF is not used. Can OMF come up with a workaround? Patches are welcome.
I don't think that OMF should, or even can, implement a workaround. If I understand correctly, the fzf install script produces a file at ~/.config/fish/functions/fish_user_key_bindings.fish with the following contents:
fzf_key_bindings
That is not the correct way to do things in Fish. Script files in ~/.config/fish/functions should be function definitions corresponding to the file name, like so:
function fish_user_key_bindings
fzf_key_bindings
end
This is explained in the Fish documentation. The fact that the current way works without OMF is a side-effect that Fish has to source the function file in order to load the function. OMF assumes there are no side-effects (code outside the function block) in the function script in order to make key bindings more extensible.
@sagebind Thanks for the reference. But install script can't just create the file with
function fish_user_key_bindings
fzf_key_bindings
end
because the user may already have the function. Maybe the install script should just print out the instruction instead of trying to implement a fragile fish script parser.
Updated the install script to create the file with the proper content if the file doesn't exist.
I can confirm it can be fixed by changing content to that file. Any luck on having an update script to fix that as well?
Fix needed...
very needed...hours of work and couldn't get any presence of fzf via omf or fisher
Most helpful comment
I think this is a bug with how fzf writes to
fish_user_key_bindings.fish. I fixed it by updating it to be within a function like so:fish 2.5.0, omf 5, fzf 0.16.6