nixpkgs/nixos/modules/programs/skim.nix
InternetUnexplorer 86ae48a4bf skim: fix fish shell keybindings
This fixes a typo that prevented the fish keybindings from being loaded.
Also, the keybindings are now only loaded if programs.skim.keybindings
is true, which matches the behavior for bash and zsh.
2022-12-08 22:52:09 -08:00

34 lines
1.1 KiB
Nix

{ pkgs, config, lib, ... }:
let
inherit (lib) mdDoc mkEnableOption mkPackageOption optional optionalString;
cfg = config.programs.skim;
in
{
options = {
programs.skim = {
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with skim");
keybindings = mkEnableOption (mdDoc "skim keybindings");
package = mkPackageOption pkgs "skim" {};
};
};
config = {
environment.systemPackages = optional (cfg.keybindings || cfg.fuzzyCompletion) cfg.package;
programs.bash.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
source ${cfg.package}/share/skim/completion.bash
'' + optionalString cfg.keybindings ''
source ${cfg.package}/share/skim/key-bindings.bash
'';
programs.zsh.interactiveShellInit = optionalString cfg.fuzzyCompletion ''
source ${cfg.package}/share/skim/completion.zsh
'' + optionalString cfg.keybindings ''
source ${cfg.package}/share/skim/key-bindings.zsh
'';
programs.fish.interactiveShellInit = optionalString cfg.keybindings ''
source ${cfg.package}/share/skim/key-bindings.fish && skim_key_bindings
'';
};
}