yazi: init
This commit is contained in:
parent
50d8845e06
commit
3ac3a823d1
4 changed files with 73 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
neovim
|
neovim
|
||||||
|
yazi
|
||||||
git
|
git
|
||||||
zoxide
|
zoxide
|
||||||
tlrc
|
tlrc
|
||||||
|
|
|
||||||
8
stow/.config/fish/functions/y.fish
Normal file
8
stow/.config/fish/functions/y.fish
Normal 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
|
||||||
56
stow/.config/yazi/yazi.toml
Normal file
56
stow/.config/yazi/yazi.toml
Normal 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" },
|
||||||
|
]
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue