From e874d049c6573cc21f2d75278bb515b2ddbce010 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 25 Oct 2023 18:46:13 -0500 Subject: [PATCH] added yazi config. --- .gitignore | 2 - README.md | 8 +- yazi/.config/yazi/keymap.toml | 239 +++++++++++++++++++++++++++++++++ yazi/.config/yazi/theme.toml | 244 ++++++++++++++++++++++++++++++++++ yazi/.config/yazi/yazi.toml | 70 ++++++++++ 5 files changed, 556 insertions(+), 7 deletions(-) create mode 100644 yazi/.config/yazi/keymap.toml create mode 100644 yazi/.config/yazi/theme.toml create mode 100644 yazi/.config/yazi/yazi.toml diff --git a/.gitignore b/.gitignore index 7f2eacc..27354ab 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,6 @@ *.directory .netrwhist *.log -vifminfo -vifm-help.txt __pycache__/ *.pickle *.spl diff --git a/README.md b/README.md index 906dccf..00d03b9 100644 --- a/README.md +++ b/README.md @@ -98,12 +98,10 @@ Software used by aliases: * sshfs ### Paru -currently uses vifm, but I really need to change that +uses yazi as a file explorer -### Vifm -* zathura -* poppler -* w3m +### Yazi +for accurate mimetype info, I suggest installing `perl-file-mimeinfo` ### Khal and Khard: both require the vdirsyncer program and config. diff --git a/yazi/.config/yazi/keymap.toml b/yazi/.config/yazi/keymap.toml new file mode 100644 index 0000000..57d6267 --- /dev/null +++ b/yazi/.config/yazi/keymap.toml @@ -0,0 +1,239 @@ +[manager] + +keymap = [ + { on = [ "" ], exec = "escape", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = [ "q" ], exec = "quit", desc = "Exit the process" }, + { on = [ "Q" ], exec = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" }, + { on = [ "" ], exec = "close", desc = "Close the current tab, or quit if it is last tab" }, + { on = [ "" ], exec = "suspend", desc = "Suspend the process" }, + + # Navigation + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], exec = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], exec = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], exec = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], exec = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "h" ], exec = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" }, + { on = [ "l" ], exec = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" }, + + { on = [ "H" ], exec = "back", desc = "Go back to the previous directory" }, + { on = [ "L" ], exec = "forward", desc = "Go forward to the next directory" }, + + { on = [ "" ], exec = "peek -5", desc = "Peek up 5 units in the preview" }, + { on = [ "" ], exec = "peek 5", desc = "Peek down 5 units in the preview" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], exec = "leave", desc = "Go back to the parent directory" }, + { on = [ "" ], exec = "enter", desc = "Enter the child directory" }, + + { on = [ "g", "g" ], exec = "arrow -99999999", desc = "Move cursor to the top" }, + { on = [ "G" ], exec = "arrow 99999999", desc = "Move cursor to the bottom" }, + + # Selection + { on = [ "" ], exec = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = [ "v" ], exec = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = [ "V" ], exec = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, + { on = [ "" ], exec = "select_all --state=true", desc = "Select all files" }, + { on = [ "" ], exec = "select_all --state=none", desc = "Inverse selection of all files" }, + + # Operation + { on = [ "o" ], exec = "open", desc = "Open the selected files" }, + { on = [ "O" ], exec = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "" ], exec = "open", desc = "Open the selected files" }, + { on = [ "" ], exec = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "y" ], exec = [ "yank", "escape --visual --select" ], desc = "Copy the selected files" }, + { on = [ "x" ], exec = [ "yank --cut", "escape --visual --select" ], desc = "Cut the selected files" }, + { on = [ "p" ], exec = "paste", desc = "Paste the files" }, + { on = [ "P" ], exec = "paste --force", desc = "Paste the files (overwrite if the destination exists)" }, + { on = [ "-" ], exec = "link", desc = "Symlink the absolute path of files" }, + { on = [ "_" ], exec = "link --relative", desc = "Symlink the relative path of files" }, + { on = [ "d" ], exec = [ "remove", "escape --visual --select" ], desc = "Move the files to the trash" }, + { on = [ "D" ], exec = [ "remove --permanently", "escape --visual --select" ], desc = "Permanently delete the files" }, + { on = [ "a" ], exec = "create", desc = "Create a file or directory (ends with / for directories)" }, + { on = [ "r" ], exec = "rename", desc = "Rename a file or directory" }, + { on = [ ";" ], exec = "shell", desc = "Run a shell command" }, + { on = [ ":" ], exec = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" }, + { on = [ "." ], exec = "hidden toggle", desc = "Toggle the visibility of hidden files" }, + { on = [ "s" ], exec = "search fd", desc = "Search files by name using fd" }, + { on = [ "S" ], exec = "search rg", desc = "Search files by content using ripgrep" }, + { on = [ "" ], exec = "search none", desc = "Cancel the ongoing search" }, + { on = [ "z" ], exec = "jump zoxide", desc = "Jump to a directory using zoxide" }, + { on = [ "Z" ], exec = "jump fzf", desc = "Jump to a directory, or reveal a file using fzf" }, + + # Linemode + { on = [ "m", "s" ], exec = "linemode size", desc = "Set linemode to size" }, + { on = [ "m", "p" ], exec = "linemode permissions", desc = "Set linemode to permissions" }, + { on = [ "m", "m" ], exec = "linemode mtime", desc = "Set linemode to mtime" }, + { on = [ "m", "n" ], exec = "linemode none", desc = "Set linemode to none" }, + + # Copy + { on = [ "c", "c" ], exec = "copy path", desc = "Copy the absolute path" }, + { on = [ "c", "d" ], exec = "copy dirname", desc = "Copy the path of the parent directory" }, + { on = [ "c", "f" ], exec = "copy filename", desc = "Copy the name of the file" }, + { on = [ "c", "n" ], exec = "copy name_without_ext", desc = "Copy the name of the file without the extension" }, + + # Find + { on = [ "/" ], exec = "find --smart" }, + { on = [ "?" ], exec = "find --previous --smart" }, + { on = [ "n" ], exec = "find_arrow" }, + { on = [ "N" ], exec = "find_arrow --previous" }, + + # Sorting + { on = [ ",", "a" ], exec = "sort alphabetical --dir_first", desc = "Sort alphabetically" }, + { on = [ ",", "A" ], exec = "sort alphabetical --reverse --dir_first", desc = "Sort alphabetically (reverse)" }, + { on = [ ",", "c" ], exec = "sort created --dir_first", desc = "Sort by creation time" }, + { on = [ ",", "C" ], exec = "sort created --reverse --dir_first", desc = "Sort by creation time (reverse)" }, + { on = [ ",", "m" ], exec = "sort modified --dir_first", desc = "Sort by modified time" }, + { on = [ ",", "M" ], exec = "sort modified --reverse --dir_first", desc = "Sort by modified time (reverse)" }, + { on = [ ",", "n" ], exec = "sort natural --dir_first", desc = "Sort naturally" }, + { on = [ ",", "N" ], exec = "sort natural --reverse --dir_first", desc = "Sort naturally (reverse)" }, + { on = [ ",", "s" ], exec = "sort size --dir_first", desc = "Sort by size" }, + { on = [ ",", "S" ], exec = "sort size --reverse --dir_first", desc = "Sort by size (reverse)" }, + + # Tabs + { on = [ "t" ], exec = "tab_create --current", desc = "Create a new tab using the current path" }, + + { on = [ "1" ], exec = "tab_switch 0", desc = "Switch to the first tab" }, + { on = [ "2" ], exec = "tab_switch 1", desc = "Switch to the second tab" }, + { on = [ "3" ], exec = "tab_switch 2", desc = "Switch to the third tab" }, + { on = [ "4" ], exec = "tab_switch 3", desc = "Switch to the fourth tab" }, + { on = [ "5" ], exec = "tab_switch 4", desc = "Switch to the fifth tab" }, + { on = [ "6" ], exec = "tab_switch 5", desc = "Switch to the sixth tab" }, + { on = [ "7" ], exec = "tab_switch 6", desc = "Switch to the seventh tab" }, + { on = [ "8" ], exec = "tab_switch 7", desc = "Switch to the eighth tab" }, + { on = [ "9" ], exec = "tab_switch 8", desc = "Switch to the ninth tab" }, + + { on = [ "[" ], exec = "tab_switch -1 --relative", desc = "Switch to the previous tab" }, + { on = [ "]" ], exec = "tab_switch 1 --relative", desc = "Switch to the next tab" }, + + { on = [ "{" ], exec = "tab_swap -1", desc = "Swap the current tab with the previous tab" }, + { on = [ "}" ], exec = "tab_swap 1", desc = "Swap the current tab with the next tab" }, + + # Tasks + { on = [ "w" ], exec = "tasks_show", desc = "Show the tasks manager" }, + + # Goto + { on = [ "g", "h" ], exec = "cd ~", desc = "Go to the home directory" }, + { on = [ "g", "c" ], exec = "cd ~/.config", desc = "Go to the config directory" }, + { on = [ "g", "d" ], exec = "cd ~/Downloads", desc = "Go to the downloads directory" }, + { on = [ "g", "t" ], exec = "cd /tmp", desc = "Go to the temporary directory" }, + { on = [ "g", "" ], exec = "cd --interactive", desc = "Go to a directory interactively" }, + + # Help + { on = [ "~" ], exec = "help", desc = "Open help" }, +] + +[tasks] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Hide the task manager" }, + { on = [ "" ], exec = "close", desc = "Hide the task manager" }, + { on = [ "w" ], exec = "close", desc = "Hide the task manager" }, + + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], exec = "inspect", desc = "Inspect the task" }, + { on = [ "x" ], exec = "cancel", desc = "Cancel the task" }, + + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[select] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Cancel selection" }, + { on = [ "" ], exec = "close", desc = "Cancel selection" }, + { on = [ "" ], exec = "close --submit", desc = "Submit the selection" }, + + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[input] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Cancel input" }, + { on = [ "" ], exec = "close --submit", desc = "Submit the input" }, + { on = [ "" ], exec = "escape", desc = "Go back the normal mode, or cancel input" }, + + # Mode + { on = [ "i" ], exec = "insert", desc = "Enter insert mode" }, + { on = [ "a" ], exec = "insert --append", desc = "Enter append mode" }, + { on = [ "v" ], exec = "visual", desc = "Enter visual mode" }, + { on = [ "V" ], exec = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, + + # Navigation + { on = [ "h" ], exec = "move -1", desc = "Move cursor left" }, + { on = [ "l" ], exec = "move 1", desc = "Move cursor right" }, + + { on = [ "0" ], exec = "move -999", desc = "Move to the BOL" }, + { on = [ "$" ], exec = "move 999", desc = "Move to the EOL" }, + { on = [ "I" ], exec = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = [ "A" ], exec = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" }, + + { on = [ "" ], exec = "move -1", desc = "Move cursor left" }, + { on = [ "" ], exec = "move 1", desc = "Move cursor right" }, + + { on = [ "b" ], exec = "backward", desc = "Move to the beginning of the previous word" }, + { on = [ "w" ], exec = "forward", desc = "Move to the beginning of the next word" }, + { on = [ "e" ], exec = "forward --end-of-word", desc = "Move to the end of the next word" }, + + # Deletion + { on = [ "d" ], exec = "delete --cut", desc = "Cut the selected characters" }, + { on = [ "D" ], exec = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" }, + { on = [ "c" ], exec = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" }, + { on = [ "C" ], exec = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" }, + { on = [ "x" ], exec = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" }, + + # Yank/Paste + { on = [ "y" ], exec = "yank", desc = "Copy the selected characters" }, + { on = [ "p" ], exec = "paste", desc = "Paste the copied characters after the cursor" }, + { on = [ "P" ], exec = "paste --before", desc = "Paste the copied characters before the cursor" }, + + # Undo/Redo + { on = [ "u" ], exec = "undo", desc = "Undo the last operation" }, + { on = [ "" ], exec = "redo", desc = "Redo the last operation" }, + + # Help + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[help] + +keymap = [ + { on = [ "" ], exec = "escape", desc = "Clear the filter, or hide the help" }, + { on = [ "q" ], exec = "close", desc = "Exit the process" }, + { on = [ "" ], exec = "close", desc = "Hide the help" }, + + # Navigation + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + # Filtering + { on = [ "/" ], exec = "filter", desc = "Apply a filter for the help items" }, +] diff --git a/yazi/.config/yazi/theme.toml b/yazi/.config/yazi/theme.toml new file mode 100644 index 0000000..57a558c --- /dev/null +++ b/yazi/.config/yazi/theme.toml @@ -0,0 +1,244 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# : Manager {{{ + +[manager] +cwd = { fg = "cyan" } + +# Hovered +hovered = { fg = "black", bg = "lightblue" } +preview_hovered = { underline = true } + +# Find +find_keyword = { fg = "yellow", italic = true } +find_position = { fg = "magenta", bg = "reset", italic = true } + +# Marker +marker_selected = { fg = "lightgreen", bg = "lightgreen" } +marker_copied = { fg = "lightyellow", bg = "lightyellow" } +marker_cut = { fg = "lightred", bg = "lightred" } + +# Tab +tab_active = { fg = "black", bg = "lightblue" } +tab_inactive = { fg = "white", bg = "darkgray" } +tab_width = 1 + +# Border +border_symbol = "│" +border_style = { fg = "gray" } + +# Offset +folder_offset = [ 1, 0, 1, 0 ] +preview_offset = [ 1, 1, 1, 1 ] + +# Highlighting +syntect_theme = "" + +# : }}} + + +# : Status {{{ + +[status] +separator_open = "" +separator_close = "" +separator_style = { fg = "darkgray", bg = "darkgray" } + +# Mode +mode_normal = { fg = "black", bg = "lightblue", bold = true } +mode_select = { fg = "black", bg = "lightgreen", bold = true } +mode_unset = { fg = "black", bg = "lightmagenta", bold = true } + +# Progress +progress_label = { bold = true } +progress_normal = { fg = "blue", bg = "black" } +progress_error = { fg = "red", bg = "black" } + +# Permissions +permissions_t = { fg = "lightgreen" } +permissions_r = { fg = "lightyellow" } +permissions_w = { fg = "lightred" } +permissions_x = { fg = "lightcyan" } +permissions_s = { fg = "darkgray" } + +# : }}} + + +# : Input {{{ + +[input] +border = { fg = "blue" } +title = {} +value = {} +selected = { reversed = true } + +# : }}} + + +# : Select {{{ + +[select] +border = { fg = "blue" } +active = { fg = "magenta" } +inactive = {} + +# : }}} + + +# : Tasks {{{ + +[tasks] +border = { fg = "blue" } +title = {} +hovered = { underline = true } + +# : }}} + + +# : Which {{{ + +[which] +mask = { bg = "black" } +cand = { fg = "lightcyan" } +rest = { fg = "darkgray" } +desc = { fg = "magenta" } +separator = "  " +separator_style = { fg = "darkgray" } + +# : }}} + + +# : Help {{{ + +[help] +on = { fg = "magenta" } +exec = { fg = "cyan" } +desc = { fg = "gray" } +hovered = { bg = "darkgray", bold = true } +footer = { fg = "black", bg = "white" } + +# : }}} + + +# : File-specific styles {{{ + +[filetype] + +rules = [ + # Images + { mime = "image/*", fg = "cyan" }, + + # Videos + { mime = "video/*", fg = "yellow" }, + { mime = "audio/*", fg = "yellow" }, + + # Archives + { mime = "application/zip", fg = "magenta" }, + { mime = "application/gzip", fg = "magenta" }, + { mime = "application/x-tar", fg = "magenta" }, + { mime = "application/x-bzip", fg = "magenta" }, + { mime = "application/x-bzip2", fg = "magenta" }, + { mime = "application/x-7z-compressed", fg = "magenta" }, + { mime = "application/x-rar", fg = "magenta" }, + + # Fallback + # { name = "*", fg = "white" }, + { name = "*/", fg = "blue" } +] + +[icons] + +"Desktop/" = "" +"Documents/" = "" +"Downloads/" = "" +"Pictures/" = "" +"Music/" = "" +"Movies/" = "" +"Videos/" = "" +"Public/" = "" +"Library/" = "" +"Development/" = "" +".config/" = "" + +# Git +".git/" = "" +".gitignore" = "" +".gitmodules" = "" +".gitattributes" = "" + +# Dotfiles +".DS_Store" = "" +".bashrc" = "" +".bashprofile" = "" +".zshrc" = "" +".zshenv" = "" +".zprofile" = "" +".vimrc" = "" + +# Text +"*.txt" = "" +"*.md" = "" + +# Archives +"*.zip" = "" +"*.tar" = "" +"*.gz" = "" +"*.7z" = "" + +# Audio +"*.mp3" = "" +"*.flac" = "" +"*.wav" = "" + +# Movies +"*.mp4" = "" +"*.mkv" = "" +"*.avi" = "" +"*.mov" = "" + +# Images +"*.jpg" = "" +"*.jpeg" = "" +"*.png" = "" +"*.gif" = "" +"*.webp" = "" +"*.avif" = "" +"*.bmp" = "" +"*.ico" = "" +"*.svg" = "" + +# Programming +"*.c" = "" +"*.cpp" = "" +"*.h" = "" +"*.hpp" = "" +"*.rs" = "" +"*.go" = "" +"*.py" = "" +"*.js" = "" +"*.ts" = "" +"*.tsx" = "" +"*.jsx" = "" +"*.rb" = "" +"*.php" = "" +"*.java" = "" +"*.sh" = "" +"*.fish" = "" +"*.swift" = "" +"*.vim" = "" +"*.lua" = "" +"*.html" = "" +"*.css" = "" +"*.scss" = "" +"*.json" = "" +"*.toml" = "" +"*.yml" = "" +"*.yaml" = "" +"*.ini" = "" +"*.conf" = "" + +# Default +"*" = "" +"*/" = "" + +# : }}} diff --git a/yazi/.config/yazi/yazi.toml b/yazi/.config/yazi/yazi.toml new file mode 100644 index 0000000..1774e1e --- /dev/null +++ b/yazi/.config/yazi/yazi.toml @@ -0,0 +1,70 @@ +[manager] +layout = [ 1, 4, 3 ] +sort_by = "modified" +sort_sensitive = true +sort_reverse = true +sort_dir_first = true +linemode = "none" +show_hidden = false +show_symlink = true + +[preview] +tab_size = 2 +max_width = 600 +max_height = 900 +cache_dir = "" +ueberzug_scale = 1 +ueberzug_offset = [ 0, 0, 0, 0 ] + +[opener] +edit = [ + { exec = '$EDITOR "$@"', block = true, for = "unix" }, +] +open = [ + { exec = 'xdg-open "$@"', desc = "Open", for = "linux" }, +] +reveal = [ + { 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" }, +] +play = [ + { exec = 'mpv "$@"', orphan = true, for = "unix" }, + { 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 = "*", use = [ "open", "reveal" ] }, +] + +[tasks] +micro_workers = 5 +macro_workers = 10 +bizarre_retry = 5 + +[plugins] +preload = [] + +[log] +enabled = false