♻️ refactor(yazi): openers and rules

This commit is contained in:
Sergio Laín 2024-08-01 14:18:17 +02:00
parent a1fa702d7b
commit 98504aab38
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150

View file

@ -7,47 +7,42 @@ sort_dir_first = true
[opener]
folder = [
{ run = 'hyprctl dispatch exec "[float; size 60% 60%; center 1] xdg-open" "$@"', desc = "Open in GUI File Manager" },
{ run = '$EDITOR "$@"' },
{ run = 'hyprctl dispatch exec "[float; size 60% 60%; center 1] xdg-open" "$@"', desc = "GUI file manager" },
{ run = '''fish -c "nvim "$1""''', block = true, desc = "neovim", for = "linux" },
{ run = 'kitty --detach nvim "$@"', orphan = true, desc = "neovim (detached)", for = "linux" },
{ run = '''fish -c "lazygit -p "$1""''', block = true, desc = "lazygit", for = "linux" },
{ run = 'codium "$@"', orphan = true, desc = "vscodium", for = "linux" },
{ run = 'kitty "$@"', orphan = true, desc = "kitty", for = "linux" },
]
archive = [{ run = 'xdg-open "$1"', desc = "Extract here" }]
pdf = [{ run = 'xdg-open "$1"', desc = "Open" }]
docx = [{ run = 'xdg-open "$1"', desc = "Open" }]
edit = [
{ run = 'pypr hide yazi & kitty --detach nvim "$@"', block = true, desc = "Open" },
text = [
{ run = 'nvim "$@"', block = true, desc = "neovim", for = "linux" },
{ run = 'kitty --detach nvim "$@"', block = true, desc = "neovim (detached)", for = "linux" },
{ run = 'codium "$@"', orphan = true, desc = "vscodium", for = "linux" },
{ run = 'xdg-open "$@"', orphan = true, desc = "xdg-open", for = "linux" },
]
image = [
{ run = 'xdg-open "$@"', desc = "Open" },
{ run = '''exiftool "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show EXIF" },
]
video = [
{ run = 'xdg-open "$@"' },
{ run = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info" },
]
audio = [
{ run = 'xdg-open "$@"' },
{ run = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info" },
]
fallback = [
{ run = 'open "$@"', desc = "Open" },
{ run = 'open -R "$@"', desc = "Reveal in Finder" },
document = [
{ run = 'xdg-open "$@"', orphan = true, desc = "xdg-open", for = "linux" },
]
image = [{ run = 'xdg-open "$@"', desc = "xdg-open", for = "linux" }]
video = [{ run = 'xdg-open "$@"', desc = "xdg-open", for = "linux" }]
audio = [{ run = 'xdg-open "$@"', desc = "xdg-open", for = "linux" }]
fallback = [{ run = 'xdg-open "$@"', desc = "xdg-open", for = "linux" }]
[open]
rules = [
{ name = "*/", use = "folder" },
{ mime = "text/*", use = "edit" },
{ mime = "text/docx", use = "docx" },
{ mime = "text/*", use = "text" },
{ mime = "image/*", use = "image" },
{ mime = "video/*", use = "video" },
{ mime = "application/octet-stream", use = "video" },
{ mime = "audio/*", use = "audio" },
{ mime = "inode/x-empty", use = "edit" },
{ mime = "inode/x-empty", use = "text" },
{ mime = "application/json", use = "text" },
{ mime = "application/json", use = "edit" },
{ mime = "*/javascript", use = "edit" },
{ mime = "application/pdf", use = "pdf" },
{ mime = "application/zip", use = "archive" },
{ mime = "application/gzip", use = "archive" },
{ mime = "application/x-bzip", use = "archive" },
@ -55,6 +50,9 @@ rules = [
{ mime = "application/x-tar", use = "archive" },
{ mime = "application/x-7z-compressed", use = "archive" },
{ mime = "application/x-rar", use = "archive" },
{ mime = "application/pdf", use = "document" },
{ mime = "application/epub+zip", use = "document" },
{ mime = "application/x-mobipocket-ebook", use = "document" },
{ mime = "*", use = "fallback" },
]