1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-23 18:29:47 +01:00

fzf: do shell initialization a bit earlier

This is to better integrate with more advanced shell history managers
like McFly and Atuin. By initializing fzf first, we allow the history
managers to steal the C-r key binding from fzf.
This commit is contained in:
Robert Helgesson 2021-10-06 00:20:32 +02:00
parent af2007bb77
commit 80d23ee06c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -146,19 +146,25 @@ in {
FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions;
});
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
# Note, since fzf unconditionally binds C-r we use `mkOrder` to make the
# initialization show up a bit earlier. This is to make initialization of
# other history managers, like mcfly or atuin, take precedence.
programs.bash.initExtra = mkIf cfg.enableBashIntegration (mkOrder 200 ''
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
. ${cfg.package}/share/fzf/completion.bash
. ${cfg.package}/share/fzf/key-bindings.bash
fi
'';
'');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
# Note, since fzf unconditionally binds C-r we use `mkOrder` to make the
# initialization show up a bit earlier. This is to make initialization of
# other history managers, like mcfly or atuin, take precedence.
programs.zsh.initExtra = mkIf cfg.enableZshIntegration (mkOrder 200 ''
if [[ $options[zle] = on ]]; then
. ${cfg.package}/share/fzf/completion.zsh
. ${cfg.package}/share/fzf/key-bindings.zsh
fi
'';
'');
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
source ${cfg.package}/share/fzf/key-bindings.fish && fzf_key_bindings