nixos/fzf: add ohMyZsh integration
This commit is contained in:
parent
a6ab4bfac4
commit
3c76624c70
|
@ -1,8 +1,9 @@
|
|||
{pkgs, config, lib, ...}:
|
||||
{ pkgs, config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.fzf;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.fzf = {
|
||||
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf");
|
||||
|
@ -11,17 +12,21 @@ in {
|
|||
};
|
||||
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
|
||||
'';
|
||||
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 = optional (cfg.keybindings || cfg.fuzzyCompletion) [ "fzf" ];
|
||||
};
|
||||
meta.maintainers = with maintainers; [ laalsaas ];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue