2026-08-13 18:43:18 +03:00

96 lines
2.5 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, pkgs, ... }:
{
programs.yazi = {
enable = true;
initLua = ''
function Linemode:size_and_mtime()
local time = math.floor(self._file.cha.mtime or 0)
if time == 0 then
time = ""
elseif os.date("%Y", time) == os.date("%Y") then
time = os.date("%b %d %H:%M", time)
else
time = os.date("%b %d %Y", time)
end
local size = self._file:size()
return string.format("%s %s", size and ya.readable_size(size) or "-", time)
end
require("git"):setup()
'';
# Основные настройки
settings = {
manager = {
sort_by = "natural";
sort_dir_first = false;
linemode = "size_and_mtime";
show_symlink = true;
};
preview = {
wrap = "no";
tab_size = 4;
};
opener = {
play = [
{
run = "mpv %s";
orphan = true;
for = "unix";
}
];
edit = [
{
run = ''cd "''${YAZI_ORIGINAL_CWD:-''${PWD}}" && "''${EDITOR:-nano}" %s'';
block = true;
for = "unix";
}
];
open = [
{
run = "xdg-open %s1";
desc = "Open";
}
];
};
plugin.prepend_fetchers = [
{ group = "git"; url = "*"; run = "git"; }
{ group = "git"; url = "*/"; run = "git"; }
];
};
# Хоткеи
keymap.mgr = {
prepend_keymap = [
{ on = "h"; run = "leave"; desc = "Назад (вверх по иерархии)"; }
{ on = "n"; run = "arrow next"; desc = "Вниз"; }
{ on = "e"; run = "arrow prev"; desc = "Вверх"; }
{ on = "M"; run = "plugin mount"; }
{ on = "F"; run = "plugin jump-to-char"; desc = "Jump to char"; }
{ on = "i"; run = "plugin smart-enter"; desc = "Enter the child directory, or open the file"; }
{ on = [ "c" "m" ]; run = "plugin chmod"; desc = "Chmod on selected files"; }
{ on = [ "<C-n>" ]; run = "seek 1"; desc = "Scroll preview down 1 line"; }
{ on = [ "<C-p>" ]; run = "seek -1"; desc = "Scroll preview up 1 line"; }
];
append_keymap = [
{ on = [ "c" "e" ]; run = "shell -- flipbit x %h"; desc = "Toggle execution mode on file"; }
];
};
plugins = {
git.package = pkgs.yaziPlugins.git;
mount.package = pkgs.yaziPlugins.mount;
jump-to-char.package = pkgs.yaziPlugins.jump-to-char;
smart-enter.package = pkgs.yaziPlugins.smart-enter;
chmod.package = pkgs.yaziPlugins.chmod;
};
};
}