dotfiles/home/lf/default.nix

48 lines
1.2 KiB
Nix
Raw Normal View History

2024-06-02 13:05:51 +02:00
{ config, pkgs, ... }:
{
2024-06-02 14:02:14 +02:00
home.file."${config.xdg.configHome}/lf" = {
source = ./files;
recursive = true;
};
programs.lf = {
enable = true;
settings = {
icons = true;
autoquit = true;
mouse = true;
number = true;
relativenumber = true;
cursorpreviewfmt = "";
2024-06-23 22:42:28 +02:00
previewer = toString (pkgs.writeShellScript "script" ''
case "''$1" in
*.tar*) tar tf "''$1";;
*.zip) unzip -l "''$1";;
*.rar) unrar l "''$1";;
*.7z) 7z l "''$1";;
*.pdf) ${pkgs.poppler_utils}/bin/pdftotext "''$1" -;;
*) ${pkgs.highlight}/bin/highlight -O ansi "''$1";;
esac
'');
2024-06-02 13:14:46 +02:00
};
2024-06-02 14:02:14 +02:00
keybindings = {
"<backspace2>" = "quit";
"<c-e>" = "half-up";
"." = "set hidden!";
2024-06-03 16:02:50 +02:00
"o" = ''$nvim -c "lua require(\"oil\").open(\"$PWD\")"'';
"-" = ''$nvim -c "lua require(\"oil\").open(\"$PWD\")"'';
2024-06-02 14:02:14 +02:00
"<enter>" = "open";
"<c-t>" = ":jump <enter>";
2024-06-02 13:05:51 +02:00
};
2024-06-02 14:02:14 +02:00
commands = {
jump = ''
''${{
2024-06-23 22:28:04 +02:00
res=$(zsh -c "source ${../zsh/files/functions.zsh} && find_global d")
2024-06-02 14:02:14 +02:00
lf -remote "send $id cd \"$res\""
}}
'';
};
2024-06-03 16:02:50 +02:00
cmdKeybindings = { q = "quit"; };
2024-06-02 14:02:14 +02:00
};
2024-06-02 13:05:51 +02:00
}