Yazi
Yazi is a blazing-fast terminal file manager developed in Rust, leveraging non-blocking async I/O to offer an efficient, user-friendly, and highly customizable file management experience. It stands out for its full asynchronous support, where all I/O operations are asynchronous, and CPU tasks are distributed across multiple threads, maximizing resource utilization. This design choice significantly enhances performance and responsiveness.
Yazi introduces powerful async task scheduling and management capabilities, providing real-time progress updates, task cancellation, and internal task prioritization. It supports multiple image protocols natively and integrates with Überzug++ for extensive terminal compatibility. Additionally, Yazi includes built-in code highlighting and image decoding functionalities, combined with a pre-loading mechanism that speeds up both image and regular file loading processes.
Installation
2.1 Using nix-shell
nix-shell -p yazi
2.2 System-Wide Installation on NixOS
environment.systemPackages = [
pkgs.yazi
];
After modifying your configuration, apply the changes by running:
sudo nixos-rebuild switch
2.3 User-Specific Installation with Home Manager
home.packages = [
pkgs.yazi
];
After updating your configuration, apply the changes by running:
home-manager switch
Configuration
3.1 Basic
programs.yazi = {
enable = true;
};
3.2 Advanced
The configuration below is using home manager, but the same can be achieved if system-wide.
programs.yazi = {
enable = true;
settings = {
manager = {
sort_by = "natural";
show_hidden = true;
show_symlink = true;
};
preview = {
image_filter = "lanczos3";
image_quality = 80;
max_width = 600;
max_height = 900;
ueberzug_scale = 1;
ueberzug_offset = [0 0 0 0];
};
tasks = {
micro_workers = 5;
macro_workers = 10;
bizarre_retry = 5;
};
open = {
rules = [
{
use = "open";
mime = "image/*";
}
{
use = ["play" "reveal"];
mime = "video/*";
}
{
use = ["play" "reveal"];
mime = "audio/*";
}
];
};
opener = {
edit = [
{
exec = "nvim \"$@\"";
block = true;
for = "unix";
}
];
open = [
{
exec = "qimgv \"$@\"";
desc = "Open";
}
];
reveal = [
{
exec = "''${pkgs.exiftool}/bin/exiftool \"$1\"; echo \"Press enter to exit\"; read _''";
block = true;
desc = "Show EXIF";
}
];
play = [
{
exec = "mpv \"$@\"";
orphan = true;
}
{
exec = "''${pkgs.mediainfo}/bin/mediainfo \"$1\"; echo \"Press enter to exit\"; read _''";
block = true;
desc = "Show media info";
}
];
archive = [
{
exec = "unar \"$1\"";
desc = "Extract here";
}
];
};
};
keymap = {
manager.keymap = [
{
exec = "shell 'dragon -x -i -T \"$1\"' --confirm";
on = ["<C-d>"];
}
{
exec = "arrow -1";
desc = "Move cursor up";
on = ["<Up>"];
}
];
completion.keymap = [
{
on = ["<Esc>"];
run = "close";
desc = "Cancel completion";
}
{
on = ["<Tab>"];
run = "close --submit";
desc = "Submit the completion";
}
];
tasks.keymap = [
{
exec = "close";
on = ["<Esc>"];
}
{
exec = "arrow -1";
on = ["<Up>"];
}
];
select.keymap = [
{
exec = "close";
on = ["<Esc>"];
}
{
exec = "close --submit";
on = ["<Enter>"];
}
];
input.keymap = [
{
exec = "close";
on = ["<Esc>"];
}
{
exec = "close --submit";
on = ["<Enter>"];
}
];
help.keymap = [
{
exec = "escape";
on = ["<Esc>"];
}
{
exec = "filter";
on = ["/"];
}
];
};
theme = {
manager = {
border_symbol = " ";
};
icon = {
rules = [
{
name = "*.jsx";
text = "";
fg = "#20c2e3";
}
{
name = "*.lua";
text = "";
fg = "#51a0cf";
}
{
name = "*.nix";
text = "";
fg = "#7ebae4";
}
];
};
filetype = {
rules = [
# Images
{
mime = "image/*";
fg = "#7ebae4";
}
];
};
};
};
Tips and Tricks
4.1 Where to see a list of options?
The home manager options are defined in the following Home Manager Options Manual.
The system-wide options are listed on MyNixOS.
4.2 Can this be used with stylix?
Yes, it can. See the following configuration:
theme = with config.stylix.base16Scheme; {
filetype = {
rules = [
# Images
{
mime = "image/*";
fg = "#${base0B}";
}
# Videos
{
mime = "video/*";
fg = "#${base03}";
}
# Audio
{
mime = "audio/*";
fg = "#${base08}";
}
];
};
};
4.3 How to map yazi to a key?
It depends on the window manager that you are using. On Hyprland it's fairly easy:
bind = [
"$mod, E, exec, kitty -e yazi"
];