aboutsummaryrefslogtreecommitdiffstats
path: root/home/lf.nix
blob: 4923fcb74257654a9cc44bb1f052387bb4893d16 (plain) (blame)
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
{ pkgs, ... }:
{
  programs.lf = {
    enable = true;
    commands = {
      editor-open = ''$$EDITOR $f'';
    };
    settings = {
      preview = true;
      hidden = true;
      drawbox = true;
      icons = true;
      ignorecase = true;
      timefmt = "2006-01-02T15:04:05.999Z";
    };
    previewer.source = "/home/petri/.config/lf/pv.sh";
    keybindings = {
      ee = "editor-open";
    };
  };

  xdg.configFile."/home/petri/.config/lf/icons".source = ./icons;
  xdg.configFile."/home/petri/.config/lf/pv.sh" = {
    executable = true;
    source = pkgs.writeShellScript "pv" ''
      case "$1" in
          *.jpg*) timg -I "$1";;
          *.png*) timg -I "$1";;
          *.webp*) timg -I "$1";;
          *.avif*) timg -I "$1";;
          *.tar*) tar tf "$1";;
          *.zip) unzip -l "$1";;
          *.rar) unrar l "$1";;
          *.7z) 7z l "$1";;
          *.pdf) pdftotext "$1" -;;
          *) pistol "$1";;
      esac
    '';
  };
}