Oxidize CLI
- Remove bashmount - Remove unzip - Add yazi - Add ouch - Add zoxide - Add mediainfo Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
193
hosts/common/configs/user/console/yazi/default.nix
Normal file
193
hosts/common/configs/user/console/yazi/default.nix
Normal file
@@ -0,0 +1,193 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user} = {
|
||||
programs = {
|
||||
yazi = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
mgr = {
|
||||
show_hidden = true;
|
||||
};
|
||||
|
||||
opener = {
|
||||
edit =
|
||||
[
|
||||
{
|
||||
run = "${hmConfig.programs.neovim.finalPackage}/bin/nvim \"$@\"";
|
||||
desc = "nvim";
|
||||
block = true;
|
||||
}
|
||||
]
|
||||
++ lib.lists.optional hmConfig.programs.vscode.enable {
|
||||
run = "${hmConfig.programs.vscode.package}/bin/code \"$@\"";
|
||||
desc = "code";
|
||||
orphan = true;
|
||||
};
|
||||
open = [
|
||||
{
|
||||
run = "xdg-open \"$1\"";
|
||||
desc = "Open";
|
||||
}
|
||||
];
|
||||
reveal = [
|
||||
{
|
||||
run = "xdg-open \"$(dirname \"$1\")\"";
|
||||
desc = "Reveal";
|
||||
}
|
||||
];
|
||||
extract = [
|
||||
{
|
||||
run = "ouch d -y \"$@\"";
|
||||
desc = "Extract here with ouch";
|
||||
}
|
||||
];
|
||||
play = [
|
||||
{
|
||||
run = "mpv \"$@\"";
|
||||
orphan = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
plugin = {
|
||||
prepend_preloaders = [
|
||||
{
|
||||
mime = "{audio,video,image}/*";
|
||||
run = "mediainfo";
|
||||
}
|
||||
{
|
||||
mime = "application/subrip";
|
||||
run = "mediainfo";
|
||||
}
|
||||
];
|
||||
|
||||
prepend_previewers = [
|
||||
{
|
||||
mime = "{audio,video,image}/*";
|
||||
run = "mediainfo";
|
||||
}
|
||||
{
|
||||
mime = "application/subrip";
|
||||
run = "mediainfo";
|
||||
}
|
||||
{
|
||||
mime = "application/*zip";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/x-tar";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/x-bzip2";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/x-7z-compressed";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/x-rar";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/x-xz";
|
||||
run = "ouch";
|
||||
}
|
||||
{
|
||||
mime = "application/xz";
|
||||
run = "ouch";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
keymap = {
|
||||
mgr.prepend_keymap = [
|
||||
{
|
||||
on = "<Enter>";
|
||||
run = "plugin smart-enter";
|
||||
desc = "Enter the child directory, or open the file";
|
||||
}
|
||||
{
|
||||
on = "!";
|
||||
run = "shell \"$SHELL\" --block";
|
||||
desc = "Open $SHELL here";
|
||||
}
|
||||
{
|
||||
on = "C";
|
||||
run = "plugin ouch";
|
||||
desc = "Compress";
|
||||
}
|
||||
{
|
||||
on = "M";
|
||||
run = "plugin chmod";
|
||||
desc = "Chmod on selected files";
|
||||
}
|
||||
{
|
||||
on = "<C-m>";
|
||||
run = "plugin mount";
|
||||
desc = "Open the mount menu";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
initLua = ''
|
||||
Status:children_add(function(self)
|
||||
local h = self._current.hovered
|
||||
if not h or not h.link_to then
|
||||
return ""
|
||||
end
|
||||
|
||||
return " -> " .. tostring(h.link_to)
|
||||
end, 3300, Status.LEFT)
|
||||
|
||||
Status:children_add(function()
|
||||
local h = cx.active.current.hovered
|
||||
if not h then
|
||||
return ""
|
||||
end
|
||||
|
||||
return ui.Line {
|
||||
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)),
|
||||
":",
|
||||
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)),
|
||||
" ",
|
||||
}
|
||||
end, 500, Status.RIGHT)
|
||||
'';
|
||||
|
||||
plugins = with pkgs.yaziPlugins; {
|
||||
inherit
|
||||
smart-enter
|
||||
chmod
|
||||
ouch
|
||||
mount
|
||||
mediainfo
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
zsh = {
|
||||
shellAliases.y = "yazi";
|
||||
p10k.extraRightPromptElements = [ "yazi" ];
|
||||
};
|
||||
};
|
||||
|
||||
theme.template.".config/yazi/theme.toml".source = ./theme.toml;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user