48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
{ config, pkgs, ... }:
 | 
						|
 | 
						|
{
 | 
						|
    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 = "";
 | 
						|
            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
 | 
						|
        '');
 | 
						|
        };
 | 
						|
        keybindings = {
 | 
						|
            "<backspace2>" = "quit";
 | 
						|
            "<c-e>" = "half-up";
 | 
						|
            "." = "set hidden!";
 | 
						|
            "o" = ''$nvim -c "lua require(\"oil\").open(\"$PWD\")"'';
 | 
						|
            "-" = ''$nvim -c "lua require(\"oil\").open(\"$PWD\")"'';
 | 
						|
            "<enter>" = "open";
 | 
						|
            "<c-t>" = ":jump <enter>";
 | 
						|
        };
 | 
						|
        commands = {
 | 
						|
            jump = ''
 | 
						|
                ''${{
 | 
						|
            res=$(zsh -c "source ${../zsh/files/functions.zsh} && find_global d")
 | 
						|
            lf -remote "send $id cd \"$res\""
 | 
						|
        }}
 | 
						|
            '';
 | 
						|
        };
 | 
						|
        cmdKeybindings = { q = "quit"; };
 | 
						|
    };
 | 
						|
}
 |