Merge pull request #225341 from SuperSandro2000/ohmyzsh-fzf
nixos/fzf: add ohMyZsh integration
This commit is contained in:
commit
6a8a43e5f2
@ -1,8 +1,9 @@
|
|||||||
{pkgs, config, lib, ...}:
|
{ pkgs, config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.programs.fzf;
|
cfg = config.programs.fzf;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
programs.fzf = {
|
programs.fzf = {
|
||||||
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf");
|
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with fzf");
|
||||||
@ -11,17 +12,21 @@ in {
|
|||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) pkgs.fzf;
|
environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) pkgs.fzf;
|
||||||
|
|
||||||
programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
|
programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
|
||||||
source ${pkgs.fzf}/share/fzf/completion.bash
|
source ${pkgs.fzf}/share/fzf/completion.bash
|
||||||
'' + optionalString cfg.keybindings ''
|
'' + optionalString cfg.keybindings ''
|
||||||
source ${pkgs.fzf}/share/fzf/key-bindings.bash
|
source ${pkgs.fzf}/share/fzf/key-bindings.bash
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.zsh.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
|
programs.zsh.interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable)
|
||||||
source ${pkgs.fzf}/share/fzf/completion.zsh
|
(optionalString cfg.fuzzyCompletion ''
|
||||||
'' + optionalString cfg.keybindings ''
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
||||||
source ${pkgs.fzf}/share/fzf/key-bindings.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 ];
|
meta.maintainers = with maintainers; [ laalsaas ];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user