{pkgs, ...}: let
  readScript = path: ''
    ''${{
      ${builtins.readFile path}
    }}'';
in {
  home.packages = with pkgs; [
    # previewer

    ## get file type
    file

    ## convert to sixels
    chafa

    ## get file info
    exiftool

    ## pretty print text files
    bat

    ## format json
    jq

    ## get thumbnails from videos
    ffmpegthumbnailer

    # commands

    ## trash utility
    trash-cli
  ];

  programs.lf.enable = true;
  programs.lf.keybindings = {
    D = "trash";
    R = "drag";
    "<f-2>" = ":rename";
    "<enter>" = "open-with";
  };
  programs.lf.extraConfig = ''
    set sixel true
  '';
  programs.lf.commands = {
    drag = "%${pkgs.ripdrag}/bin/ripdrag -x \"$fx\"";
    trash = "%trash-put \"$fx\"";
    open = "$set -f; ${pkgs.ranger}/bin/rifle -p 0 \"$fx\"";
    open-with = ''
      ''${{
        set -f
        ${pkgs.ranger}/bin/rifle -l "$fx"
        read -p "Open with: " method
        ${pkgs.ranger}/bin/rifle -p "$method" "$fx"
      }}'';
    bulk-rename = readScript ./bulk-rename.sh;
  };
  programs.lf.previewer.source = ./preview.sh;
}
