yazi: bettr integration (waiting for home-manager stable release)

This commit is contained in:
Filippo Berto 2023-10-22 17:37:34 +02:00
parent 9251438253
commit 31f7c9e801
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
2 changed files with 33 additions and 9 deletions

View file

@ -1,10 +1,20 @@
{ pkgs, ... }:
let tomlGenerate = (pkgs.formats.toml { }).generate; in
let
tomlGenerate = (pkgs.formats.toml { }).generate;
bashIntegration = ''
function ya() {
tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
'';
in
{
home.packages = [ pkgs.unstable_pkgs.yazi pkgs.ffmpegthumbnailer pkgs.exiftool pkgs.mediainfo ];
home.shellAliases."yz" = "yazi";
xdg.configFile."yazi/yazi.toml".source = tomlGenerate "yazi.toml" {
manager = {
sort_by = "natural";
@ -49,5 +59,7 @@ let tomlGenerate = (pkgs.formats.toml { }).generate; in
# enableBashIntegration = true;
# enableZshIntegration = true;
# };
programs.bash.initExtra = bashIntegration;
programs.zsh.initExtra = bashIntegration;
}