mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
33 lines
1.0 KiB
Nix
33 lines
1.0 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.programs.fzf;
|
|
in
|
|
{
|
|
options = {
|
|
programs.fzf = {
|
|
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf");
|
|
keybindings = mkEnableOption (mdDoc "fzf keybindings");
|
|
};
|
|
};
|
|
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 (!config.programs.zsh.ohMyZsh.enable)
|
|
(optionalString cfg.fuzzyCompletion ''
|
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
|
'' + optionalString cfg.keybindings ''
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
|
'');
|
|
|
|
programs.zsh.ohMyZsh.plugins = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ "fzf" ];
|
|
};
|
|
meta.maintainers = with maintainers; [ laalsaas ];
|
|
}
|