2022-11-11 20:08:36 +00:00
|
|
|
{pkgs, config, lib, ...}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.fzf;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
programs.fzf = {
|
2022-12-03 15:15:00 +00:00
|
|
|
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf");
|
|
|
|
keybindings = mkEnableOption (mdDoc "fzf keybindings");
|
2022-11-11 20:08:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) pkgs.fzf;
|
|
|
|
programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
|
|
|
|
source ${pkgs.fzf}/share/fzf/completion.bash
|
|
|
|
'' + optionalString cfg.keybindings ''
|
|
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.bash
|
|
|
|
'';
|
|
|
|
|
|
|
|
programs.zsh.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
|
|
|
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
|
|
|
'' + optionalString cfg.keybindings ''
|
|
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ laalsaas ];
|
|
|
|
}
|