nix-config/users/tacocat/lf/default.nix

63 lines
1.4 KiB
Nix
Raw Normal View History

2024-01-03 01:55:35 +00:00
{pkgs, ...}: {
xdg.configFile."lf/icons".source = ./icons;
programs.lf = {
enable = true;
commands = {
dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"'';
editor-open = ''$$EDITOR $f'';
mkdir = ''
''${{
printf "Directory Name: "
read DIR
mkdir $DIR
}}
'';
};
keybindings = {
"\\\"" = "";
o = "";
m = "";
mm = "mark-save";
md = "mkdir";
"." = "set hidden!";
"`" = "mark-load";
"\\'" = "mark-load";
"<enter>" = "open";
d = "";
do = "dragon-out";
dd = "cut";
"g~" = "cd";
gh = "cd";
"g/" = "/";
ee = "editor-open";
V = ''$${pkgs.bat}/bin/bat --paging=always "$f"'';
};
settings = {
preview = true;
hidden = true;
drawbox = true;
icons = true;
ignorecase = true;
tabstop = 2;
};
previewer = {
keybinding = "i";
source = pkgs.writeShellScript "pv.sh" ''
#!/bin/sh
case "$1" in
*.tar*) ${pkgs.gnutar}/bin/tar tf "$1";;
*.zip) ${pkgs.unzip}/bin/unzip -l "$1";;
*.rar) ${pkgs.unrar}/bin/unrar l "$1";;
*.7z) ${pkgs.p7zip}/bin/7z l "$1";;
*.pdf) ${pkgs.poppler_utils}/bin/pdftotext "$1" -;;
*) ${pkgs.highlight}/bin/highlight -O ansi "$1" || cat "$1";;
esac
'';
};
};
}