2022-12-17 10:02:37 +00:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
let
|
2024-01-02 11:29:13 +00:00
|
|
|
inherit (lib) mdDoc mkEnableOption mkPackageOption optional optionalString;
|
2022-12-17 10:02:37 +00:00
|
|
|
cfg = config.programs.skim;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.skim = {
|
|
|
|
fuzzyCompletion = mkEnableOption (mdDoc "fuzzy completion with skim");
|
|
|
|
keybindings = mkEnableOption (mdDoc "skim keybindings");
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "skim" {};
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|