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

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

	config = lib.mkIf config.tools.file-manager.lf.enable {
		tools.file-manager.default = "${pkgs.nnn}/bin/lf";
		programs.lf.enable = true;
		programs.lf.settings = {
			hidden = true;
		};
		programs.lf.previewer.source = pkgs.writeShellScript
			"previewer.sh"
			''
#!/bin/sh
unset COLORTERM
${if config.tools.viewer.bat.enable then
	"bat -pp --line-range=:500 --color=always '$1'"
else "cat"}
			'';
		programs.lf.extraConfig = "set icons";

		xdg.configFile."lf/icons".source = ./icons;
	};
}