nixos: added yazi as global tui file manager
This commit is contained in:
parent
07feb5d83d
commit
258e7dcf88
|
@ -76,5 +76,12 @@
|
|||
zathura.enable = lib.mkEnableOption "zathura";
|
||||
floorp.enable = lib.mkEnableOption "floorp";
|
||||
};
|
||||
|
||||
programs = {
|
||||
yazi.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,5 +20,6 @@
|
|||
./steam.nix
|
||||
./sudo.nix
|
||||
./vial.nix
|
||||
./yazi.nix
|
||||
];
|
||||
}
|
||||
|
|
63
system/modules/yazi.nix
Normal file
63
system/modules/yazi.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.profile.programs.yazi;
|
||||
inherit (lib) mkIf;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
settings = {
|
||||
# https://yazi-rs.github.io/docs/configuration/yazi
|
||||
yazi = {
|
||||
manager = {
|
||||
# 1/8 width for parent, 4/8 width for current, 3/8 width for preview
|
||||
ratio = [ 1 4 3 ];
|
||||
sort_by = "natural";
|
||||
sort_sensitive = false;
|
||||
sort_dir_first = true;
|
||||
linemode = "permissions";
|
||||
show_hidden = true;
|
||||
show_symlink = true;
|
||||
scrolloff = 5;
|
||||
};
|
||||
opener = {
|
||||
edit = [
|
||||
{ run = ''nvim "$@"''; block = true; desc = "Edit in Neovim"; }
|
||||
];
|
||||
play = [
|
||||
{ run = ''mpv "$@"''; orphan = true; desc = "Play in MPV"; }
|
||||
];
|
||||
open = [
|
||||
{ run = ''xdg-open "$@"''; desc = "Open"; }
|
||||
];
|
||||
};
|
||||
open = {
|
||||
rules = [
|
||||
{
|
||||
mime = "text/*";
|
||||
use = "edit";
|
||||
}
|
||||
{
|
||||
mime = "video/*";
|
||||
use = "play";
|
||||
}
|
||||
{
|
||||
mime = "application/json";
|
||||
use = "edit";
|
||||
}
|
||||
# Multiple openers for a single rule
|
||||
{
|
||||
name = "*.html";
|
||||
use = [ "open" "edit" ];
|
||||
}
|
||||
];
|
||||
append_rules = [
|
||||
{ name = "*"; use = "open"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue