blob: a4820b88f4e1d8ba68037f230d3eb12a6f3afa46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# Fuzzy finder, CLI fuzzy search tool
{
config,
lib,
...
}:
{
imports = [ ./assertions.nix ];
options.terminal.fzf = {
enable = lib.mkEnableOption "Enables fzf.";
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
default = config.programs.fzf.package;
description = "The fzf package to use.";
};
};
config =
let
shellIntegration = ''
${if config.terminal.zsh.enable then "eval \"$(fzf --zsh)\"" else "eval \"$(fzf --bash)\""}
'';
in
lib.mkIf config.terminal.fzf.enable {
programs.fzf = {
enable = true;
defaultOptions = [
"--height 100%"
"--layout=reverse"
"--pointer=\" \""
"--header=\" \""
"--prompt=\" \""
"--marker=\"✓ \""
"--border=none"
"--cycle"
"--no-info"
"--margin=\"1,2\""
];
colors = with config.scheme.withHashtag; {
fg = base05;
bg = "-1";
hl = base0D;
"fg+" = base07;
"bg+" = "-1";
"hl+" = base0D;
gutter = "-1";
info = base0B;
border = base03;
prompt = base0A;
pointer = base0F;
marker = base0C;
spinner = base0C;
};
};
programs.zsh.initContent = lib.mkIf config.terminal.zsh.enable (lib.mkAfter shellIntegration);
programs.bash.initExtra = lib.mkIf config.terminal.bash.enable (lib.mkAfter shellIntegration);
};
}
|