Pls help fixing the issue with omf/fzf as _fzf_key_bindings_ is not being loaded automatically. I have to execute the command manually (every time I open shell) if I want to user ctrl+r (fuzzy history search).
Issue was described on fzf github
my installation looks like this:
[~/.fzf]─[⎇ master]─> ./install
Downloading bin/fzf ...
- Already exists
- Checking fzf executable ... 0.16.6
Do you want to enable fuzzy auto-completion? ([y]/n)
Do you want to enable key bindings? ([y]/n)
Generate ~/.fzf.bash ... OK
Generate ~/.fzf.zsh ... OK
Update fish_user_paths ... OK
Symlink /home/kuba/.config/fish/functions/fzf_key_bindings.fish ... OK
Do you want to update your shell configuration files? ([y]/n)
Update /home/kuba/.bashrc:
- [ -f ~/.fzf.bash ] && source ~/.fzf.bash
- Already exists: line #21
Update /home/kuba/.zshrc:
- [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
- Already exists: line #98
Update /home/kuba/.config/fish/functions/fish_user_key_bindings.fish:
- fzf_key_bindings
- Already exists: line #4
Finished. Restart your shell or reload config file.
source ~/.bashrc # bash
source ~/.zshrc # zsh
fzf_key_bindings # fish
Use uninstall script to remove fzf.
For more information, see: https://github.com/junegunn/fzf
but after restarting shell ctrl+r doesn't work. It works only after executing _fzf_key_bindings_
Operating System: Fedora 25
Fish Version: 2.5.0
Oh My Fish Version: 5
Git version: 2.9.3
Oh My Fish overrides the fish_user_key_bindings function in order to delegate to multiple sources of key bindings in plugins. Because of this, fish_user_key_bindings will never be loaded from disk from the Fish config directory.
You can set up a hack to get fzf to behave how OMF expects by creating a virtual fzf plugin with key bindings in the expected file:
$ mkdir -p $OMF_PATH/pkg/fzf
$ echo fzf_key_bindings > $OMF_PATH/pkg/fzf/key_bindings.fish
$ omf reload
There's an old fzf plugin in the official package repository you can install (with omf install fzf) that might provide similar functionality, though that does not directly solve the problem you asked. It might be worth looking into updating the fzf plugin to fix this behavior.
@sagebind thx! your solution works perfectly for me. Anyway, this should be fixed somehow, as installation script says
Finished. Restart your shell or reload config file.
source ~/.bashrc # bash
source ~/.zshrc # zsh
fzf_key_bindings # fish
I would expect that after restarting / opening new terminal window I have fzf ready after pressing ctrl+r (as accomplished with your hint).
I think this is a bug with how fzf writes to fish_user_key_bindings.fish. I fixed it by updating it to be a function like so:
function fish_user_key_bindings
fzf_key_bindings
end
@cmrn Ah, that makes sense why it was not working then; I did investigation and it looked like it should have worked out of the box assuming the fish_user_key_bindings function was being defined. Without OMF, the fact that it worked anyway is because Fish was sourcing the file looking for a fish_user_key_bindings function. But it got sourced and ended up calling fzf_key_bindings "accidentally" despite not calling the function.
This might be helpful info to have at https://github.com/junegunn/fzf/issues/851
@jmayday
This is an issue with the fzf installer not following Fish idioms or guidelines; I don't think we should implement a workaround in OMF itself. See the open issue at junegunn/fzf#851 to track fixing.
Most helpful comment
Oh My Fish overrides the
fish_user_key_bindingsfunction in order to delegate to multiple sources of key bindings in plugins. Because of this,fish_user_key_bindingswill never be loaded from disk from the Fish config directory.You can set up a hack to get fzf to behave how OMF expects by creating a virtual fzf plugin with key bindings in the expected file:
There's an old
fzfplugin in the official package repository you can install (withomf install fzf) that might provide similar functionality, though that does not directly solve the problem you asked. It might be worth looking into updating the fzf plugin to fix this behavior.