LF kitty preview + Kitty bindings

This commit is contained in:
Filippo Berto 2022-08-05 11:32:13 +02:00
parent b975faf84f
commit d03913d61c
2 changed files with 29 additions and 0 deletions

View file

@ -40,6 +40,8 @@ in
"ctrl+shift+t" = "new_tab_with_cwd";
"ctrl+shift+enter" = "new_window_with_cwd";
"ctrl+shift+n" = "new_os_window_with_cwd";
"ctrl+shift+up" = "previous_window";
"ctrl+shift+down" = "next_window";
};
font = pkgs.rice.font.monospace;
};

View file

@ -1,3 +1,23 @@
{ 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;
@ -10,5 +30,12 @@
hidden = true;
tabstop = 2;
};
previewer = {
source = lf_kitty_preview;
# keybinding = "i";
};
extraConfig = ''
set cleaner ${lf_kitty_cleaner}
'';
};
}