From 945b87e85dfb3cc964ee42a3d513b6d921336336 Mon Sep 17 00:00:00 2001 From: aleidk Date: Mon, 5 Aug 2024 09:29:41 -0400 Subject: [PATCH] update yazi config to fix breaking changes --- chezmoi/dot_config/yazi/init.lua | 29 +- chezmoi/dot_config/yazi/keymap.toml | 395 +++++++++--------- chezmoi/dot_config/yazi/original_package.toml | 5 + .../dot_config/yazi/symlink_package.toml.tmpl | 2 + chezmoi/dot_config/yazi/theme.toml | 2 + chezmoi/dot_config/yazi/yazi.toml | 109 ++--- .../dot_config/zsh/functions/functions.zsh | 4 +- 7 files changed, 266 insertions(+), 280 deletions(-) create mode 100644 chezmoi/dot_config/yazi/original_package.toml create mode 100644 chezmoi/dot_config/yazi/symlink_package.toml.tmpl create mode 100644 chezmoi/dot_config/yazi/theme.toml diff --git a/chezmoi/dot_config/yazi/init.lua b/chezmoi/dot_config/yazi/init.lua index 8fc4cdb..6c283c4 100644 --- a/chezmoi/dot_config/yazi/init.lua +++ b/chezmoi/dot_config/yazi/init.lua @@ -1,28 +1 @@ -function Manager:render(area) - local chunks = self:layout(area) - - local bar = function(c, x, y) - x, y = math.max(0, x), math.max(0, y) - return ui.Bar(ui.Rect({ x = x, y = y, w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) }), ui.Bar.TOP) - :symbol(c) - end - - return ya.flat({ - -- Borders - ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED), - ui.Bar(chunks[1], ui.Bar.RIGHT), - ui.Bar(chunks[3], ui.Bar.LEFT), - - bar("┬", chunks[1].right - 1, chunks[1].y), - bar("┴", chunks[1].right - 1, chunks[1].bottom - 1), - bar("┬", chunks[2].right, chunks[2].y), - bar("┴", chunks[2].right, chunks[1].bottom - 1), - - -- Parent - Parent:render(chunks[1]:padding(ui.Padding.xy(1))), - -- Current - Current:render(chunks[2]:padding(ui.Padding.y(1))), - -- Preview - Preview:render(chunks[3]:padding(ui.Padding.xy(1))), - }) -end +require("full-border"):setup() diff --git a/chezmoi/dot_config/yazi/keymap.toml b/chezmoi/dot_config/yazi/keymap.toml index a505c66..ceeeee3 100644 --- a/chezmoi/dot_config/yazi/keymap.toml +++ b/chezmoi/dot_config/yazi/keymap.toml @@ -5,296 +5,289 @@ [manager] keymap = [ - { on = [ "" ], exec = "escape --all", 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" }, + { on = [ "" ], run = "escape --all", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = [ "q" ], run = "quit", desc = "Exit the process" }, + { on = [ "Q" ], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" }, + { on = [ "" ], run = "close", desc = "Close the current tab, or quit if it is last tab" }, + { on = [ "" ], run = "suspend", desc = "Suspend the process" }, + + # Hopping + { on = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], run = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], run = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], run = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "" ], run = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], run = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], run = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], run = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "g", "g" ], run = "arrow -99999999", desc = "Move cursor to the top" }, + { on = [ "G" ], run = "arrow 99999999", desc = "Move cursor to the bottom" }, # Navigation - { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, - { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "h" ], run = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" }, + { on = [ "l" ], run = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" }, - { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, - { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + { on = [ "" ], run = [ "leave", "escape --visual --select" ], desc = "Go back to the parent directory" }, + { on = [ "" ], run = [ "enter", "escape --visual --select" ], desc = "Enter the child directory" }, - { on = [ "" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, - { on = [ "" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + { on = [ "H" ], run = "back", desc = "Go back to the previous directory" }, + { on = [ "L" ], run = "forward", desc = "Go forward to the next directory" }, - { 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 = [ "" ], 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 = "seek -5", desc = "Seek up 5 units in the preview" }, - { on = [ "" ], exec = "seek 5", desc = "Seek down 5 units in the preview" }, - { on = [ "" ], exec = "seek -5", desc = "Seek up 5 units in the preview" }, - { on = [ "" ], exec = "seek 5", desc = "Seek 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" }, + # Seeking + { on = ["K"], run = "seek -5", desc = "Seek up 5 units in the preview" }, + { on = ["J"], run = "seek 5", desc = "Seek down 5 units in the preview" }, # 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" }, + { on = [ "" ], run = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = [ "v" ], run = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = [ "V" ], run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, + { on = [ "" ], run = "select_all --state=true", desc = "Select all files" }, + { on = [ "" ], run = "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 = [ "Y" ], exec = [ "unyank", "escape --visual --select" ], desc = "Cancel the yank status of 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 --cursor=before_ext", 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" }, + { on = [ "o" ], run = "open", desc = "Open the selected files" }, + { on = [ "O" ], run = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "" ], run = "open", desc = "Open the selected files" }, + { on = [ "" ], run = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "y" ], run = [ "yank", "escape --visual --select" ], desc = "Copy the selected files" }, + { on = [ "Y" ], run = [ "unyank", "escape --visual --select" ], desc = "Cancel the yank status of files" }, + { on = [ "x" ], run = [ "yank --cut", "escape --visual --select" ], desc = "Cut the selected files" }, + { on = [ "p" ], run = "paste", desc = "Paste the files" }, + { on = [ "P" ], run = "paste --force", desc = "Paste the files (overwrite if the destination exists)" }, + { on = [ "-" ], run = "link", desc = "Symlink the absolute path of files" }, + { on = [ "_" ], run = "link --relative", desc = "Symlink the relative path of files" }, + { on = [ "d" ], run = [ "remove", "escape --visual --select" ], desc = "Move the files to the trash" }, + { on = [ "D" ], run = [ "remove --permanently", "escape --visual --select" ], desc = "Permanently delete the files" }, + { on = [ "a" ], run = "create", desc = "Create a file or directory (ends with / for directories)" }, + { on = [ "r" ], run = "rename --cursor=before_ext", desc = "Rename a file or directory" }, + { on = [ ";" ], run = "shell", desc = "Run a shell command" }, + { on = [ ":" ], run = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" }, + { on = [ "." ], run = "hidden toggle", desc = "Toggle the visibility of hidden files" }, + { on = [ "s" ], run = "search fd", desc = "Search files by name using fd" }, + { on = [ "S" ], run = "search rg", desc = "Search files by content using ripgrep" }, + { on = [ "" ], run = "search none", desc = "Cancel the ongoing search" }, + { on = [ "z" ], run = "plugin zoxide", desc = "Jump to a directory using zoxide" }, + { on = [ "Z" ], run = "plugin 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" }, + { on = [ "m", "s" ], run = "linemode size", desc = "Set linemode to size" }, + { on = [ "m", "p" ], run = "linemode permissions", desc = "Set linemode to permissions" }, + { on = [ "m", "m" ], run = "linemode mtime", desc = "Set linemode to mtime" }, + { on = [ "m", "n" ], run = "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" }, + { on = [ "c", "c" ], run = "copy path", desc = "Copy the absolute path" }, + { on = [ "c", "d" ], run = "copy dirname", desc = "Copy the path of the parent directory" }, + { on = [ "c", "f" ], run = "copy filename", desc = "Copy the name of the file" }, + { on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the name of the file without the extension" }, # Filter - { on = [ "f" ], exec = "filter --smart", desc = "Filter the files" }, + { on = [ "f" ], run = "filter --smart", desc = "Filter the files" }, # Find - { on = [ "/" ], exec = "find --smart", desc = "Find next file" }, - { on = [ "?" ], exec = "find --previous --smart", desc = "Find previous file" }, - { on = [ "n" ], exec = "find_arrow", desc = "Go to next found file" }, - { on = [ "N" ], exec = "find_arrow --previous", desc = "Go to previous found file" }, + { on = [ "/" ], run = "find --smart", desc = "Find next file" }, + { on = [ "?" ], run = "find --previous --smart", desc = "Find previous file" }, + { on = [ "n" ], run = "find_arrow", desc = "Go to next found file" }, + { on = [ "N" ], run = "find_arrow --previous", desc = "Go to previous found file" }, # Sorting - { 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 = [ ",", "c" ], exec = "sort created --dir-first", desc = "Sort by created time" }, - { on = [ ",", "C" ], exec = "sort created --reverse --dir-first", desc = "Sort by created time (reverse)" }, - { on = [ ",", "e" ], exec = "sort extension --dir-first", desc = "Sort by extension" }, - { on = [ ",", "E" ], exec = "sort extension --reverse --dir-first", desc = "Sort by extension (reverse)" }, - { on = [ ",", "a" ], exec = "sort alphabetical --dir-first", desc = "Sort alphabetically" }, - { on = [ ",", "A" ], exec = "sort alphabetical --reverse --dir-first", desc = "Sort alphabetically (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)" }, - + { on = [ ",", "m" ], run = "sort modified --reverse=no", desc = "Sort by modified time" }, + { on = [ ",", "M" ], run = "sort modified --reverse", desc = "Sort by modified time (reverse)" }, + { on = [ ",", "c" ], run = "sort created --reverse=no", desc = "Sort by created time" }, + { on = [ ",", "C" ], run = "sort created --reverse", desc = "Sort by created time (reverse)" }, + { on = [ ",", "e" ], run = "sort extension --reverse=no", desc = "Sort by extension" }, + { on = [ ",", "E" ], run = "sort extension --reverse", desc = "Sort by extension (reverse)" }, + { on = [ ",", "a" ], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" }, + { on = [ ",", "A" ], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" }, + { on = [ ",", "n" ], run = "sort natural --reverse=no", desc = "Sort naturally" }, + { on = [ ",", "N" ], run = "sort natural --reverse", desc = "Sort naturally (reverse)" }, + { on = [ ",", "s" ], run = "sort size --reverse=no", desc = "Sort by size" }, + { on = [ ",", "S" ], run = "sort size --reverse", desc = "Sort by size (reverse)" }, # Tabs - { on = [ "t" ], exec = "tab_create --current", desc = "Create a new tab using the current path" }, + { on = [ "t" ], run = "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 = [ "1" ], run = "tab_switch 0", desc = "Switch to the first tab" }, + { on = [ "2" ], run = "tab_switch 1", desc = "Switch to the second tab" }, + { on = [ "3" ], run = "tab_switch 2", desc = "Switch to the third tab" }, + { on = [ "4" ], run = "tab_switch 3", desc = "Switch to the fourth tab" }, + { on = [ "5" ], run = "tab_switch 4", desc = "Switch to the fifth tab" }, + { on = [ "6" ], run = "tab_switch 5", desc = "Switch to the sixth tab" }, + { on = [ "7" ], run = "tab_switch 6", desc = "Switch to the seventh tab" }, + { on = [ "8" ], run = "tab_switch 7", desc = "Switch to the eighth tab" }, + { on = [ "9" ], run = "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 = [ "[" ], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" }, + { on = [ "]" ], run = "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" }, + { on = [ "{" ], run = "tab_swap -1", desc = "Swap the current tab with the previous tab" }, + { on = [ "}" ], run = "tab_swap 1", desc = "Swap the current tab with the next tab" }, # Tasks - { on = [ "w" ], exec = "tasks_show", desc = "Show the tasks manager" }, + { on = [ "w" ], run = "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" }, + { on = [ "g", "h" ], run = "cd ~", desc = "Go to the home directory" }, + { on = [ "g", "c" ], run = "cd ~/.config", desc = "Go to the config directory" }, + { on = [ "g", "d" ], run = "cd ~/Downloads", desc = "Go to the downloads directory" }, + { on = [ "g", "t" ], run = "cd /tmp", desc = "Go to the temporary directory" }, + { on = [ "g", "" ], run = "cd --interactive", desc = "Go to a directory interactively" }, # Help - { on = [ "~" ], exec = "help", desc = "Open help" }, + { on = [ "~" ], run = "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 = [ "" ], run = "close", desc = "Hide the task manager" }, + { on = [ "" ], run = "close", desc = "Hide the task manager" }, + { on = [ "w" ], run = "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 = [ "k" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, - { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "" ], exec = "inspect", desc = "Inspect the task" }, - { on = [ "x" ], exec = "cancel", desc = "Cancel the task" }, + { on = [ "" ], run = "inspect", desc = "Inspect the task" }, + { on = [ "x" ], run = "cancel", desc = "Cancel the task" }, - { on = [ "~" ], exec = "help", desc = "Open help" } + { on = [ "~" ], run = "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 = [ "" ], run = "close", desc = "Cancel selection" }, + { on = [ "" ], run = "close", desc = "Cancel selection" }, + { on = [ "" ], run = "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" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "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 = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], run = "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 = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, - { on = [ "" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + { on = [ "" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, - { on = [ "~" ], exec = "help", desc = "Open help" } + { on = [ "~" ], run = "help", desc = "Open help" } ] [input] keymap = [ - { on = [ "" ], exec = "close", desc = "Cancel input" }, - { on = [ "" ], exec = "close --submit", desc = "Submit the input" }, - { on = [ "" ], exec = "close", desc = "Go back the normal mode, or cancel input" }, + { on = [ "" ], run = "close", desc = "Cancel input" }, + { on = [ "" ], run = "close --submit", desc = "Submit the input" }, + { on = [ "" ], run = "close", 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 = [ "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 = [ "v" ], exec = "visual", desc = "Enter visual mode" }, - { on = [ "V" ], exec = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, + { on = [ "i" ], run = "insert", desc = "Enter insert mode" }, + { on = [ "a" ], run = "insert --append", desc = "Enter append mode" }, + { on = [ "I" ], run = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = [ "A" ], run = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" }, + { on = [ "v" ], run = "visual", desc = "Enter visual mode" }, + { on = [ "V" ], run = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, # Character-wise movement - { on = [ "h" ], exec = "move -1", desc = "Move back a character" }, - { on = [ "l" ], exec = "move 1", desc = "Move forward a character" }, - { on = [ "" ], exec = "move -1", desc = "Move back a character" }, - { on = [ "" ], exec = "move 1", desc = "Move forward a character" }, - { on = [ "" ], exec = "move -1", desc = "Move back a character" }, - { on = [ "" ], exec = "move 1", desc = "Move forward a character" }, + { on = [ "h" ], run = "move -1", desc = "Move back a character" }, + { on = [ "l" ], run = "move 1", desc = "Move forward a character" }, + { on = [ "" ], run = "move -1", desc = "Move back a character" }, + { on = [ "" ], run = "move 1", desc = "Move forward a character" }, + { on = [ "" ], run = "move -1", desc = "Move back a character" }, + { on = [ "" ], run = "move 1", desc = "Move forward a character" }, # Word-wise movement - { on = [ "b" ], exec = "backward", desc = "Move back to the start of the current or previous word" }, - { on = [ "w" ], exec = "forward", desc = "Move forward to the start of the next word" }, - { on = [ "e" ], exec = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, - { on = [ "" ], exec = "backward", desc = "Move back to the start of the current or previous word" }, - { on = [ "" ], exec = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + { on = [ "b" ], run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = [ "w" ], run = "forward", desc = "Move forward to the start of the next word" }, + { on = [ "e" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, + { on = [ "" ], run = "backward", desc = "Move back to the start of the current or previous word" }, + { on = [ "" ], run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" }, # Line-wise movement - { on = [ "0" ], exec = "move -999", desc = "Move to the BOL" }, - { on = [ "$" ], exec = "move 999", desc = "Move to the EOL" }, - { on = [ "" ], exec = "move -999", desc = "Move to the BOL" }, - { on = [ "" ], exec = "move 999", desc = "Move to the EOL" }, - { on = [ "" ], exec = "move -999", desc = "Move to the BOL" }, - { on = [ "" ], exec = "move 999", desc = "Move to the EOL" }, + { on = [ "0" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "$" ], run = "move 999", desc = "Move to the EOL" }, + { on = [ "" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "" ], run = "move 999", desc = "Move to the EOL" }, + { on = [ "" ], run = "move -999", desc = "Move to the BOL" }, + { on = [ "" ], run = "move 999", desc = "Move to the EOL" }, # Delete - { on = [ "" ], exec = "backspace", desc = "Delete the character before the cursor" }, - { on = [ "" ], exec = "backspace --under", desc = "Delete the character under the cursor" }, - { on = [ "" ], exec = "backspace", desc = "Delete the character before the cursor" }, - { on = [ "" ], exec = "backspace --under", desc = "Delete the character under the cursor" }, + { on = [ "" ], run = "backspace", desc = "Delete the character before the cursor" }, + { on = [ "" ], run = "backspace --under", desc = "Delete the character under the cursor" }, + { on = [ "" ], run = "backspace", desc = "Delete the character before the cursor" }, + { on = [ "" ], run = "backspace --under", desc = "Delete the character under the cursor" }, # Kill - { on = [ "" ], exec = "kill bol", desc = "Kill backwards to the BOL" }, - { on = [ "" ], exec = "kill eol", desc = "Kill forwards to the EOL" }, - { on = [ "" ], exec = "kill backward", desc = "Kill backwards to the start of the current word" }, - { on = [ "" ], exec = "kill forward", desc = "Kill forwards to the end of the current word" }, + { on = [ "" ], run = "kill bol", desc = "Kill backwards to the BOL" }, + { on = [ "" ], run = "kill eol", desc = "Kill forwards to the EOL" }, + { on = [ "" ], run = "kill backward", desc = "Kill backwards to the start of the current word" }, + { on = [ "" ], run = "kill forward", desc = "Kill forwards to the end of the current word" }, # Cut/Yank/Paste - { 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" }, - { 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" }, + { on = [ "d" ], run = "delete --cut", desc = "Cut the selected characters" }, + { on = [ "D" ], run = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" }, + { on = [ "c" ], run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" }, + { on = [ "C" ], run = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" }, + { on = [ "x" ], run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" }, + { on = [ "y" ], run = "yank", desc = "Copy the selected characters" }, + { on = [ "p" ], run = "paste", desc = "Paste the copied characters after the cursor" }, + { on = [ "P" ], run = "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" }, + { on = [ "u" ], run = "undo", desc = "Undo the last operation" }, + { on = [ "" ], run = "redo", desc = "Redo the last operation" }, # Help - { on = [ "~" ], exec = "help", desc = "Open help" } + { on = [ "~" ], run = "help", desc = "Open help" } ] [completion] keymap = [ - { on = [ "" ], exec = "close", desc = "Cancel completion" }, - { on = [ "" ], exec = "close --submit", desc = "Submit the completion" }, - { on = [ "" ], exec = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" }, + { on = [ "" ], run = "close", desc = "Cancel completion" }, + { on = [ "" ], run = "close --submit", desc = "Submit the completion" }, + { on = [ "" ], run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" }, - { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, - { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, - { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "~" ], exec = "help", desc = "Open help" } + { on = [ "~" ], run = "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" }, + { on = [ "" ], run = "escape", desc = "Clear the filter, or hide the help" }, + { on = [ "q" ], run = "close", desc = "Exit the process" }, + { on = [ "" ], run = "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" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], run = "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 = [ "K" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], run = "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 = [ "" ], run = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], run = "arrow 1", desc = "Move cursor down" }, - { on = [ "" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, - { on = [ "" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + { on = [ "" ], run = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "" ], run = "arrow 5", desc = "Move cursor down 5 lines" }, # Filtering - { on = [ "/" ], exec = "filter", desc = "Apply a filter for the help items" }, + { on = [ "/" ], run = "filter", desc = "Apply a filter for the help items" }, ] diff --git a/chezmoi/dot_config/yazi/original_package.toml b/chezmoi/dot_config/yazi/original_package.toml new file mode 100644 index 0000000..7e34c3a --- /dev/null +++ b/chezmoi/dot_config/yazi/original_package.toml @@ -0,0 +1,5 @@ +[plugin] +deps = [{ use = "yazi-rs/plugins#full-border", commit = "39f2753" }] + +[flavor] +deps = [{ use = "yazi-rs/flavors#catppuccin-macchiato", commit = "2d7dd2a" }] diff --git a/chezmoi/dot_config/yazi/symlink_package.toml.tmpl b/chezmoi/dot_config/yazi/symlink_package.toml.tmpl new file mode 100644 index 0000000..716b5a9 --- /dev/null +++ b/chezmoi/dot_config/yazi/symlink_package.toml.tmpl @@ -0,0 +1,2 @@ +{{ .chezmoi.sourceDir }}/dot_config/yazi/original_package.toml + diff --git a/chezmoi/dot_config/yazi/theme.toml b/chezmoi/dot_config/yazi/theme.toml new file mode 100644 index 0000000..000a93b --- /dev/null +++ b/chezmoi/dot_config/yazi/theme.toml @@ -0,0 +1,2 @@ +[flavor] +use = "catppuccin-macchiato" diff --git a/chezmoi/dot_config/yazi/yazi.toml b/chezmoi/dot_config/yazi/yazi.toml index 7b2a733..8eb7d53 100644 --- a/chezmoi/dot_config/yazi/yazi.toml +++ b/chezmoi/dot_config/yazi/yazi.toml @@ -11,6 +11,9 @@ sort_dir_first = true linemode = "mtime" show_hidden = true show_symlink = true +scrolloff = 5 +mouse_events = [ "click", "scroll" ] +title_format = "Yazi: {cwd}" [preview] tab_size = 2 @@ -25,51 +28,55 @@ ueberzug_offset = [ 0, 0, 0, 0 ] [opener] edit = [ - { exec = '[ -n "$EDITOR" ] && $EDITOR "$@"', desc = "$EDITOR", block = true, for = "unix" }, - { exec = 'code "%*"', orphan = true, for = "windows" }, + { run = '[ -n "$EDITOR" ] && $EDITOR "$@"', desc = "$EDITOR", block = true, for = "unix" }, + { run = '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" } + { run = 'xdg-open "$@"', desc = "Open", for = "linux" }, + { run = 'open "$@"', desc = "Open", for = "macos" }, + { run = '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" }, + { run = 'open -R "$1"', desc = "Reveal", for = "macos" }, + { run = 'explorer /select, "%1"', orphan = true, desc = "Reveal", for = "windows" }, + { run = '''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" }, -] + { run = 'ya pub extract --list "$@"', desc = "Extract here", for = "unix" }, + { run = 'ya pub extract --list %*', 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" }, + { run = 'mpv "$@"', orphan = true, for = "unix" }, + { run = 'mpv "%1"', orphan = true, for = "windows" }, + { run = '''mediainfo "$1"; echo "Press enter to exit"; read''', block = true, desc = "Show media info", for = "unix" }, ] [open] rules = [ + # Folder { name = "*/", use = [ "edit", "open", "reveal" ] }, + # Text { mime = "text/*", use = [ "edit", "reveal" ] }, + + # Archive + { mime = "application/{,g}zip", use = [ "extract", "reveal" ] }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] }, + + # Image { mime = "image/*", use = [ "open", "reveal" ] }, - { mime = "video/*", use = [ "play", "reveal" ] }, - { mime = "audio/*", use = [ "play", "reveal" ] }, + + # Media + { mime = "{audio,video}/*", use = [ "play", "reveal" ] }, { mime = "inode/x-empty", use = [ "edit", "reveal" ] }, + # JSON { 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" ] }, + # Empty file + { mime = "inode/x-empty", use = [ "edit", "reveal" ] }, + # Fallback { mime = "*", use = [ "open", "reveal" ] }, ] @@ -83,46 +90,49 @@ suppress_preload = false [plugin] +fetchers = [ + # Mimetype + { id = "mime", name = "*", run = "mime", if = "!mime", prio = "high" }, +] preloaders = [ - { name = "*", cond = "!mime", exec = "mime", multi = true, prio = "high" }, - # Image - { mime = "image/vnd.djvu", exec = "noop" }, - { mime = "image/*", exec = "image" }, + # example + { mime = "image/{avif,heic,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, # Video - { mime = "video/*", exec = "video" }, + { mime = "video/*", run = "video" }, # PDF - { mime = "application/pdf", exec = "pdf" }, + { mime = "application/pdf", run = "pdf" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/vnd.ms-opentype", run = "font" }, ] previewers = [ - { name = "*/", exec = "folder", sync = true }, + { name = "*/", run = "folder", sync = true }, # Code - { mime = "text/*", exec = "code" }, - { mime = "*/xml", exec = "code" }, - { mime = "*/javascript", exec = "code" }, - { mime = "*/x-wine-extension-ini", exec = "code" }, + { mime = "text/*", run = "code" }, + { mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" }, # JSON - { mime = "application/json", exec = "json" }, + { mime = "application/{json,x-ndjson}", run = "json" }, # Image - { mime = "image/vnd.djvu", exec = "noop" }, - { mime = "image/*", exec = "image" }, + { mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" }, + { mime = "image/*", run = "image" }, # Video - { mime = "video/*", exec = "video" }, + { mime = "video/*", run = "video" }, # PDF - { mime = "application/pdf", exec = "pdf" }, + { mime = "application/pdf", run = "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" }, + { mime = "application/{,g}zip", run = "archive" }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" }, + # Font + { mime = "font/*", run = "font" }, + { mime = "application/vnd.ms-opentype", run = "font" }, # Fallback - { name = "*", exec = "file" }, + { name = "*", run = "file" }, ] [input] +cursor_blink = false + # cd cd_title = "Change directory:" cd_origin = "top-center" @@ -187,6 +197,7 @@ open_offset = [ 0, 1, 50, 7 ] sort_by = "none" sort_sensitive = false sort_reverse = false +sort_translit = false [log] enabled = false diff --git a/chezmoi/dot_config/zsh/functions/functions.zsh b/chezmoi/dot_config/zsh/functions/functions.zsh index 97254f3..d971d4f 100644 --- a/chezmoi/dot_config/zsh/functions/functions.zsh +++ b/chezmoi/dot_config/zsh/functions/functions.zsh @@ -52,11 +52,11 @@ fzf-jq() { echo '' | fzf --print-query --preview="jq -r {q} <$@" } -function ya() { +function yy() { local tmp="$(mktemp -t "yazi-cwd.XXXXX")" yazi "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then - cd -- "$cwd" + \cd -- "$cwd" fi rm -f -- "$tmp" }