aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/lf/default.nix
blob: 1b61fd8345ad402031cd213ecd9d16fb14d96d90 (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
{
  pkgs,
  lib,
  config,
  ...
}:

# lf - terminal file manager
{
  options.tools.lf = {
    enable = lib.mkEnableOption "Enables lf.";
  };

  config = lib.mkIf config.tools.lf.enable {
    home.packages = with pkgs; [
      ctpv
    ];

    programs.lf = {
      enable = true;
      settings = {
        number = true;
        icons = true;
        drawbox = true;
        hidden = true;
        preview = true;

        shell = if config.tools.zsh.enable then lib.getExe pkgs.zsh else "bash";
        shellopts = "'-eu'";
        ifs = "\n";
        scrolloff = "4";
        period = "1";
        incsearch = true;
        smartcase = true;
        info = "size";
        sortby = "natural";
        dirfirst = true;
      };

      previewer = {
        source = lib.getExe' pkgs.ctpv "ctpv";
      };

      extraConfig = ''
        &${lib.getExe' pkgs.ctpv "ctpv"} -s $id
        cmd on-quit %${lib.getExe' pkgs.ctpv "ctpv"} -e $id
        set cleaner ${lib.getExe' pkgs.ctpv "ctpvclear"}
        ${builtins.readFile ./lfrc}
      '';
    };

    home.file.".config/lf/icons".source = ./icons;
  };
}