yazi: init

This commit is contained in:
Nico 2026-01-05 02:15:30 +11:00
parent 50d8845e06
commit 3ac3a823d1
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0
4 changed files with 73 additions and 0 deletions

View file

@ -8,6 +8,7 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim neovim
yazi
git git
zoxide zoxide
tlrc tlrc

View file

@ -0,0 +1,8 @@
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
command yazi $argv --cwd-file="$tmp"
if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
end

View file

@ -0,0 +1,56 @@
[mgr]
show_hidden = true
show_symlink = true
sort_by = "alphabetical"
sort_reverse = false
sort_dir_first = true
linemode = "permissions"
scrolloff = 8
[preview]
wrap = "no"
tab_size = 2
[opener]
edit = [
{ run = "$EDITOR %s", block = true, desc = "Open in text editor"},
]
editimg = [
{ run = "gimp %s", block = false, desc = "Open in image editor" },
]
play = [
{ run = "mpv %s", block = false, for = "linux", desc = "Play video"},
{ run = "iina %s", block = false, for = "macos", desc = "Play video"},
]
open = [
{ run = "xdg-open %s", block = false, for = "linux", desc = "Open with default program"},
{ run = "open %s", block = false, for = "macos", desc = "Open with default program"},
]
setwallpaper = [
{ run = "matugen --config ~/.config/matugen/config.toml image %s", block = false, for = "macos", desc = "Set as wallpaper"},
{ run = "matugen image %s", block = false, for = "linux", desc = "Set as wallpaper"},
]
setwallpaperlight = [
{ run = "matugen --config ~/.config/matugen/config.toml image -m light %s", block = false, for = "macos", desc = "Set as wallpaper (light)"},
{ run = "matugen image -m light %s", block = false, for = "linux", desc = "Set as wallpaper (light)"},
]
[open]
rules = [
{ mime = "text/*", use = "edit" },
{ mime = "video/*", use = "play" },
{ mime = "image/*", use = [ "open", "setwallpaper", "setwallpaperlight", "editimg" ] },
{ url = "*.html", use = [ "open", "edit" ] },
{ mime = "application/json", use = "edit" },
# Multiple openers for a single rule
{ url = "*", use = "open" },
]

View file

@ -109,3 +109,11 @@ plugInstall https://github.com/Aloxaf/fzf-tab fzf-tab.zsh
# load fzf and zoxide # load fzf and zoxide
eval "$(fzf --zsh)" eval "$(fzf --zsh)"
eval "$(zoxide init zsh)" eval "$(zoxide init zsh)"
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd"
command rm -f -- "$tmp"
}