nix-dotfiles/hm_modules/lf.nix

41 lines
860 B
Nix

{ pkgs, ... }:
let
lf_kitty_cleaner = pkgs.writeShellScript "lf_kitty_cleaner" ''
kitty +icat --clear --silent --transfer-mode file
'';
lf_kitty_preview = pkgs.writeShellScript "lf_kitty_preview" ''
file=$1
w=$2
h=$3
x=$4
y=$5
if [[ "$( file -Lb --mime-type "$file")" =~ ^image ]]; then
kitty +icat --silent --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file"
exit 1
fi
${pkgs.pistol}/bin/pistol "$file"
'';
in
{
programs.lf = {
enable = true;
settings = {
dircounts = true;
icons = true;
# mouse = true;
number = true;
# scrollof = 3;
hidden = true;
tabstop = 2;
};
previewer = {
source = lf_kitty_preview;
# keybinding = "i";
};
extraConfig = ''
set cleaner ${lf_kitty_cleaner}
'';
};
}