forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/fzf: bring back keybindings and completion option removed in Ni…
…xOS#298692 Also drop with lib
- Loading branch information
1 parent
c463436
commit cb5b97f
Showing
4 changed files
with
31 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,38 @@ | ||
{ pkgs, config, lib, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.programs.fzf; | ||
|
||
args = "${lib.optionalString (!cfg.fuzzyCompletion) " --no-completion"} ${lib.optionalString (!cfg.keybindings) " --no-key-bindings"}"; | ||
in | ||
{ | ||
imports = [ | ||
(lib.mkRemovedOptionModule [ "programs" "fzf" "keybindings" ] '' | ||
Use "programs.fzf.enable" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. | ||
If you want to change/disable certain keybindings please check the fzf-documentation. | ||
'') | ||
(lib.mkRemovedOptionModule [ "programs" "fzf" "fuzzyCompletion" ] '' | ||
Use "programs.fzf.enable" instead, due to fzf upstream-change it's not possible to load shell-completion and keybindings separately. | ||
If you want to change/disable certain keybindings please check the fzf-documentation. | ||
'') | ||
]; | ||
|
||
options = { | ||
programs.fzf.enable = mkEnableOption (mdDoc "fuzzy completion with fzf and keybindings"); | ||
programs.fzf = { | ||
fuzzyCompletion = lib.mkEnableOption (lib.mdDoc "fuzzy completion with fzf"); | ||
keybindings = lib.mkEnableOption (lib.mdDoc "fzf keybindings"); | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ pkgs.fzf ]; | ||
config = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) { | ||
environment.systemPackages = lib.mkIf (cfg.keybindings || cfg.fuzzyCompletion) [ pkgs.fzf ]; | ||
|
||
programs.bash.interactiveShellInit = '' | ||
eval "$(${getExe pkgs.fzf} --bash)" | ||
''; | ||
|
||
programs.fish.interactiveShellInit = '' | ||
${getExe pkgs.fzf} --fish | source | ||
''; | ||
programs = { | ||
bash.interactiveShellInit = '' | ||
eval "$(${lib.getExe pkgs.fzf} --bash ${args})" | ||
''; | ||
|
||
programs.zsh = { | ||
interactiveShellInit = optionalString (!config.programs.zsh.ohMyZsh.enable) '' | ||
eval "$(${getExe pkgs.fzf} --zsh)" | ||
fish.interactiveShellInit = '' | ||
${lib.getExe pkgs.fzf} --fish ${args}| source | ||
''; | ||
|
||
ohMyZsh.plugins = mkIf (config.programs.zsh.ohMyZsh.enable) [ "fzf" ]; | ||
zsh = { | ||
interactiveShellInit = lib.optionalString (!config.programs.zsh.ohMyZsh.enable) '' | ||
eval "$(${lib.getExe pkgs.fzf} --zsh ${args})" | ||
''; | ||
|
||
ohMyZsh.plugins = lib.mkIf config.programs.zsh.ohMyZsh.enable [ "fzf" ]; | ||
}; | ||
}; | ||
}; | ||
|
||
meta.maintainers = with maintainers; [ laalsaas ]; | ||
meta.maintainers = with lib.maintainers; [ laalsaas ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters