From 4be1094312c9fa6c97073f0e2906c13bb9fbff82 Mon Sep 17 00:00:00 2001 From: Seymur Bagirov Date: Wed, 14 Feb 2024 21:23:31 +0400 Subject: [PATCH] add yazi configuration --- yazi/yazi.toml | 192 +++++++++++++++++++++++++++++++++++++++++++++++++ zsh/.profile | 2 + 2 files changed, 194 insertions(+) create mode 100644 yazi/yazi.toml diff --git a/yazi/yazi.toml b/yazi/yazi.toml new file mode 100644 index 0000000..4299c6b --- /dev/null +++ b/yazi/yazi.toml @@ -0,0 +1,192 @@ +# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. +# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. +"$schema" = "https://yazi-rs.github.io/schemas/yazi.json" + +[manager] +ratio = [ 1, 4, 3 ] +sort_by = "natural" +sort_sensitive = false +sort_reverse = false +sort_dir_first = false +linemode = "none" +show_hidden = false +show_symlink = true + +[preview] +tab_size = 2 +max_width = 600 +max_height = 900 +cache_dir = "" +image_filter = "triangle" +image_quality = 75 +sixel_fraction = 15 +ueberzug_scale = 1 +ueberzug_offset = [ 0, 0, 0, 0 ] + +[opener] +edit = [ + { exec = '[ -n "$EDITOR" ] && $EDITOR "$@"', desc = "$EDITOR", block = true, for = "unix" }, + { exec = 'code "%*"', orphan = true, for = "windows" }, +] +open = [ + { exec = 'xdg-open "$@"', desc = "Open", for = "linux" }, + { exec = 'open "$@"', desc = "Open", for = "macos" }, + { exec = 'start "" "%1"', orphan = true, desc = "Open", for = "windows" } +] +reveal = [ + { exec = 'open -R "$1"', desc = "Reveal", for = "macos" }, + { exec = 'explorer /select, "%1"', orphan = true, desc = "Reveal", for = "windows" }, + { exec = '''exiftool "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show EXIF", for = "unix" }, +] +extract = [ + { exec = 'unar "$1"', desc = "Extract here", for = "unix" }, + { exec = 'unar "%1"', desc = "Extract here", for = "windows" }, +] +play = [ + { exec = 'mpv "$@"', orphan = true, for = "unix" }, + { exec = 'mpv "%1"', orphan = true, for = "windows" }, + { exec = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info", for = "unix" }, +] + +[open] +rules = [ + { name = "*/", use = [ "edit", "open", "reveal" ] }, + + { mime = "text/*", use = [ "edit", "reveal" ] }, + { mime = "image/*", use = [ "open", "reveal" ] }, + { mime = "video/*", use = [ "play", "reveal" ] }, + { mime = "audio/*", use = [ "play", "reveal" ] }, + { mime = "inode/x-empty", use = [ "edit", "reveal" ] }, + + { mime = "application/json", use = [ "edit", "reveal" ] }, + { mime = "*/javascript", use = [ "edit", "reveal" ] }, + + { mime = "application/zip", use = [ "extract", "reveal" ] }, + { mime = "application/gzip", use = [ "extract", "reveal" ] }, + { mime = "application/x-tar", use = [ "extract", "reveal" ] }, + { mime = "application/x-bzip", use = [ "extract", "reveal" ] }, + { mime = "application/x-bzip2", use = [ "extract", "reveal" ] }, + { mime = "application/x-7z-compressed", use = [ "extract", "reveal" ] }, + { mime = "application/x-rar", use = [ "extract", "reveal" ] }, + { mime = "application/xz", use = [ "extract", "reveal" ] }, + + { mime = "*", use = [ "open", "reveal" ] }, +] + +[tasks] +micro_workers = 10 +macro_workers = 25 +bizarre_retry = 5 +image_alloc = 536870912 # 512MB +image_bound = [ 0, 0 ] +suppress_preload = false + +[plugin] + +preloaders = [ + { name = "*", cond = "!mime", exec = "mime", multi = true, prio = "high" }, + # Image + { mime = "image/vnd.djvu", exec = "noop" }, + { mime = "image/*", exec = "image" }, + # Video + { mime = "video/*", exec = "video" }, + # PDF + { mime = "application/pdf", exec = "pdf" }, +] +previewers = [ + { name = "*/", exec = "folder", sync = true }, + # Code + { mime = "text/*", exec = "code" }, + { mime = "*/xml", exec = "code" }, + { mime = "*/javascript", exec = "code" }, + { mime = "*/x-wine-extension-ini", exec = "code" }, + # JSON + { mime = "application/json", exec = "json" }, + # Image + { mime = "image/vnd.djvu", exec = "noop" }, + { mime = "image/*", exec = "image" }, + # Video + { mime = "video/*", exec = "video" }, + # PDF + { mime = "application/pdf", exec = "pdf" }, + # Archive + { mime = "application/zip", exec = "archive" }, + { mime = "application/gzip", exec = "archive" }, + { mime = "application/x-tar", exec = "archive" }, + { mime = "application/x-bzip", exec = "archive" }, + { mime = "application/x-bzip2", exec = "archive" }, + { mime = "application/x-7z-compressed", exec = "archive" }, + { mime = "application/x-rar", exec = "archive" }, + { mime = "application/xz", exec = "archive" }, + # Fallback + { name = "*", exec = "file" }, +] + +[input] +# cd +cd_title = "Change directory:" +cd_origin = "top-center" +cd_offset = [ 0, 2, 50, 3 ] + +# create +create_title = "Create:" +create_origin = "top-center" +create_offset = [ 0, 2, 50, 3 ] + +# rename +rename_title = "Rename:" +rename_origin = "hovered" +rename_offset = [ 0, 1, 50, 3 ] + +# trash +trash_title = "Move {n} selected file{s} to trash? (y/N)" +trash_origin = "top-center" +trash_offset = [ 0, 2, 50, 3 ] + +# delete +delete_title = "Delete {n} selected file{s} permanently? (y/N)" +delete_origin = "top-center" +delete_offset = [ 0, 2, 50, 3 ] + +# filter +filter_title = "Filter:" +filter_origin = "top-center" +filter_offset = [ 0, 2, 50, 3 ] + +# find +find_title = [ "Find next:", "Find previous:" ] +find_origin = "top-center" +find_offset = [ 0, 2, 50, 3 ] + +# search +search_title = "Search via {n}:" +search_origin = "top-center" +search_offset = [ 0, 2, 50, 3 ] + +# shell +shell_title = [ "Shell:", "Shell (block):" ] +shell_origin = "top-center" +shell_offset = [ 0, 2, 50, 3 ] + +# overwrite +overwrite_title = "Overwrite an existing file? (y/N)" +overwrite_origin = "top-center" +overwrite_offset = [ 0, 2, 50, 3 ] + +# quit +quit_title = "{n} task{s} running, sure to quit? (y/N)" +quit_origin = "top-center" +quit_offset = [ 0, 2, 50, 3 ] + +[select] +open_title = "Open with:" +open_origin = "hovered" +open_offset = [ 0, 1, 50, 7 ] + +[which] +sort_by = "none" +sort_sensitive = false +sort_reverse = false + +[log] +enabled = false diff --git a/zsh/.profile b/zsh/.profile index 306b662..76cd512 100644 --- a/zsh/.profile +++ b/zsh/.profile @@ -69,6 +69,7 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm export SUDO_EDITOR="nvim" +export EDITOR="nvim" mkcdir () { mkdir -p -- "$1" && @@ -164,3 +165,4 @@ alias rm="rm -i" alias hyprexec="hyprctl dispatch exec" alias tgwaybar="killall -SIGUSR1 waybar" alias rwaybar="killall -SIGUSR2 waybar" +alias ls="lsd"