Played around with yazi and now the config is tight
Lots of new Keymaps
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#. A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config.
|
#. 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.
|
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
|
||||||
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
|
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
|
||||||
|
|
||||||
@@ -140,6 +141,7 @@ keymap = [
|
|||||||
#Studies
|
#Studies
|
||||||
{ on = [ "g", "j", "b" ], run = "cd \"~/Documents/JKU/Studium/BWL\"", desc = "Goto BWL" },
|
{ on = [ "g", "j", "b" ], run = "cd \"~/Documents/JKU/Studium/BWL\"", desc = "Goto BWL" },
|
||||||
{ on = [ "g", "j", "w" ], run = "cd \"~/Documents/JKU/Work\"", desc = "Goto Work(local)" },
|
{ on = [ "g", "j", "w" ], run = "cd \"~/Documents/JKU/Work\"", desc = "Goto Work(local)" },
|
||||||
|
{ on = [ "g", "w" ], run = "cd \"~/Pictures/Wallpapers\"", desc = "Goto Wallpapers)" },
|
||||||
{ on = [ "g", "o", "p" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Privat/", desc = "Goto Obsidian/Privat" },
|
{ on = [ "g", "o", "p" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Privat/", desc = "Goto Obsidian/Privat" },
|
||||||
{ on = [ "g", "o", "d" ], run = "shell --confirm 'touch $(date +%F).md'", desc = "Create Daily Note in Obsidian" },
|
{ on = [ "g", "o", "d" ], run = "shell --confirm 'touch $(date +%F).md'", desc = "Create Daily Note in Obsidian" },
|
||||||
{ on = [ "g", "o", "w" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Work/", desc = "Goto Obsidian/Work" },
|
{ on = [ "g", "o", "w" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Work/", desc = "Goto Obsidian/Work" },
|
||||||
@@ -150,6 +152,7 @@ keymap = [
|
|||||||
{ on = [ "g", "i", "<Space>" ], run = "cd /Volumes/ipec/intern", desc = "Goto Intern" },
|
{ on = [ "g", "i", "<Space>" ], run = "cd /Volumes/ipec/intern", desc = "Goto Intern" },
|
||||||
{ on = [ "g", "p", "b" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P54_EDIH TBI 80 Brückner\"", desc = "Goto Brückner" },
|
{ on = [ "g", "p", "b" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P54_EDIH TBI 80 Brückner\"", desc = "Goto Brückner" },
|
||||||
{ on = [ "g", "p", "s" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P42b_Senoplast SenoSmartCoex\"", desc = "Goto SenoSmartCoex" },
|
{ on = [ "g", "p", "s" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P42b_Senoplast SenoSmartCoex\"", desc = "Goto SenoSmartCoex" },
|
||||||
|
{ on = [ "g", "p", "n" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P59_EDIH TBI 193 Naku\"", desc = "Goto SenoSmartCoex" },
|
||||||
{ on = [ "g", "i", "p" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen/Projektstatusberichte\"", desc = "Goto Projektstatusberichte" },
|
{ on = [ "g", "i", "p" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen/Projektstatusberichte\"", desc = "Goto Projektstatusberichte" },
|
||||||
{ on = [ "g", "i", "b" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen\"", desc = "Goto Institutsbesprechungen" },
|
{ on = [ "g", "i", "b" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen\"", desc = "Goto Institutsbesprechungen" },
|
||||||
|
|
||||||
@@ -386,3 +389,19 @@ keymap = [
|
|||||||
on = "f"
|
on = "f"
|
||||||
run = "plugin jump-to-char"
|
run = "plugin jump-to-char"
|
||||||
desc = "Jump to char"
|
desc = "Jump to char"
|
||||||
|
|
||||||
|
[[mgr.prepend_keymap]]
|
||||||
|
on = "l"
|
||||||
|
run = "plugin smart-enter"
|
||||||
|
desc = "Enter the child directory, or open the file"
|
||||||
|
|
||||||
|
|
||||||
|
[[plugin.prepend_fetchers]]
|
||||||
|
id = "git"
|
||||||
|
name = "*"
|
||||||
|
run = "git"
|
||||||
|
|
||||||
|
[[plugin.prepend_fetchers]]
|
||||||
|
id = "git"
|
||||||
|
name = "*/"
|
||||||
|
run = "git"
|
||||||
|
|||||||
388
yazi/keymap.toml-1748636568461447
Normal file
388
yazi/keymap.toml-1748636568461447
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
#. 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/keymap.json"
|
||||||
|
|
||||||
|
[manager]
|
||||||
|
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||||
|
{ on = "<C-[>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||||
|
{ on = "q", run = "quit", desc = "Quit the process" },
|
||||||
|
{ on = "Q", run = "quit --no-cwd-file", desc = "Quit the process without outputting cwd-file" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Close the current tab, or quit if it's last" },
|
||||||
|
{ on = "<C-z>", 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 = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<C-u>", run = "arrow -50%", desc = "Move cursor up half page" },
|
||||||
|
{ on = "<C-d>", run = "arrow 50%", desc = "Move cursor down half page" },
|
||||||
|
{ on = "<C-b>", run = "arrow -100%", desc = "Move cursor up one page" },
|
||||||
|
{ on = "<C-f>", run = "arrow 100%", desc = "Move cursor down one page" },
|
||||||
|
|
||||||
|
{ on = "<S-PageUp>", run = "arrow -50%", desc = "Move cursor up half page" },
|
||||||
|
{ on = "<S-PageDown>", run = "arrow 50%", desc = "Move cursor down half page" },
|
||||||
|
{ on = "<PageUp>", run = "arrow -100%", desc = "Move cursor up one page" },
|
||||||
|
{ on = "<PageDown>", 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 = "h", run = "leave", desc = "Go back to the parent directory" },
|
||||||
|
{ on = "l", run = "enter", desc = "Enter the child directory" },
|
||||||
|
|
||||||
|
{ on = "<Left>", run = "leave", desc = "Go back to the parent directory" },
|
||||||
|
{ on = "<Right>", run = "enter", desc = "Enter the child directory" },
|
||||||
|
|
||||||
|
{ on = "H", run = "back", desc = "Go back to the previous directory" },
|
||||||
|
{ on = "L", run = "forward", desc = "Go forward to the next directory" },
|
||||||
|
|
||||||
|
# Toggle
|
||||||
|
{ on = "<Space>", run = [ "toggle", "arrow 1" ], desc = "Toggle the current selection state" },
|
||||||
|
{ on = "<C-a>", run = "toggle_all --state=on", desc = "Select all files" },
|
||||||
|
{ on = "<C-r>", run = "toggle_all", desc = "Invert selection of all files" },
|
||||||
|
|
||||||
|
# Visual mode
|
||||||
|
{ on = "v", run = "visual_mode", desc = "Enter visual mode (selection mode)" },
|
||||||
|
{ on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
|
||||||
|
|
||||||
|
# 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" },
|
||||||
|
|
||||||
|
# Spotting
|
||||||
|
{ on = "<Tab>", run = "spot", desc = "Spot hovered file" },
|
||||||
|
|
||||||
|
# Operation
|
||||||
|
{ on = "o", run = "open", desc = "Open selected files" },
|
||||||
|
{ on = "O", run = "open --interactive", desc = "Open selected files interactively" },
|
||||||
|
{ on = "<Enter>", run = "open", desc = "Open selected files" },
|
||||||
|
{ on = "<S-Enter>", run = "open --interactive", desc = "Open selected files interactively" },
|
||||||
|
{ on = "y", run = "yank", desc = "Yank selected files (copy)" },
|
||||||
|
{ on = "x", run = "yank --cut", desc = "Yank selected files (cut)" },
|
||||||
|
{ on = "p", run = "paste", desc = "Paste yanked files" },
|
||||||
|
{ on = "P", run = "paste --force", desc = "Paste yanked files (overwrite if the destination exists)" },
|
||||||
|
{ on = "-", run = "link", desc = "Symlink the absolute path of yanked files" },
|
||||||
|
{ on = "_", run = "link --relative", desc = "Symlink the relative path of yanked files" },
|
||||||
|
{ on = "<C-->", run = "hardlink", desc = "Hardlink yanked files" },
|
||||||
|
{ on = "Y", run = "unyank", desc = "Cancel the yank status" },
|
||||||
|
{ on = "X", run = "unyank", desc = "Cancel the yank status" },
|
||||||
|
{ on = "d", run = "remove", desc = "Trash selected files" },
|
||||||
|
{ on = "D", run = "remove --permanently", desc = "Permanently delete selected files" },
|
||||||
|
{ on = "a", run = "create", desc = "Create a file (ends with / for directories)" },
|
||||||
|
{ on = "r", run = "rename --cursor=before_ext", desc = "Rename selected file(s)" },
|
||||||
|
{ on = ";", run = "shell --interactive", desc = "Run a shell command" },
|
||||||
|
{ on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" },
|
||||||
|
{ on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
|
||||||
|
{ on = "s", run = "search --via=fd", desc = "Search files by name via fd" },
|
||||||
|
{ on = "S", run = "search --via=rg", desc = "Search files by content via ripgrep" },
|
||||||
|
{ on = "<C-s>", run = "escape --search", desc = "Cancel the ongoing search" },
|
||||||
|
{ on = "z", run = "plugin zoxide", desc = "Jump to a directory via zoxide" },
|
||||||
|
{ on = "Z", run = "plugin fzf", desc = "Jump to a file/directory via fzf" },
|
||||||
|
|
||||||
|
# Linemode
|
||||||
|
{ on = [ "m", "s" ], run = "linemode size", desc = "Linemode: size" },
|
||||||
|
{ on = [ "m", "p" ], run = "linemode permissions", desc = "Linemode: permissions" },
|
||||||
|
{ on = [ "m", "b" ], run = "linemode btime", desc = "Linemode: btime" },
|
||||||
|
{ on = [ "m", "m" ], run = "linemode mtime", desc = "Linemode: mtime" },
|
||||||
|
{ on = [ "m", "o" ], run = "linemode owner", desc = "Linemode: owner" },
|
||||||
|
{ on = [ "m", "n" ], run = "linemode none", desc = "Linemode: none" },
|
||||||
|
|
||||||
|
# Copy
|
||||||
|
{ on = [ "c", "c" ], run = "copy path", desc = "Copy the file path" },
|
||||||
|
{ on = [ "c", "d" ], run = "copy dirname", desc = "Copy the directory path" },
|
||||||
|
{ on = [ "c", "f" ], run = "copy filename", desc = "Copy the filename" },
|
||||||
|
{ on = [ "c", "n" ], run = "copy name_without_ext", desc = "Copy the filename without extension" },
|
||||||
|
|
||||||
|
# Filter
|
||||||
|
{ on = "f", run = "filter --smart", desc = "Filter files" },
|
||||||
|
|
||||||
|
# Find
|
||||||
|
{ on = "/", run = "find --smart", desc = "Find next file" },
|
||||||
|
{ on = "?", run = "find --previous --smart", desc = "Find previous file" },
|
||||||
|
{ on = "n", run = "find_arrow", desc = "Goto the next found" },
|
||||||
|
{ on = "N", run = "find_arrow --previous", desc = "Goto the previous found" },
|
||||||
|
|
||||||
|
# Sorting
|
||||||
|
{ on = [ ",", "m" ], run = [ "sort mtime --reverse=no", "linemode mtime" ], desc = "Sort by modified time" },
|
||||||
|
{ on = [ ",", "M" ], run = [ "sort mtime --reverse", "linemode mtime" ], desc = "Sort by modified time (reverse)" },
|
||||||
|
{ on = [ ",", "b" ], run = [ "sort btime --reverse=no", "linemode btime" ], desc = "Sort by birth time" },
|
||||||
|
{ on = [ ",", "B" ], run = [ "sort btime --reverse", "linemode btime" ], desc = "Sort by birth 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", "linemode size" ], desc = "Sort by size" },
|
||||||
|
{ on = [ ",", "S" ], run = [ "sort size --reverse", "linemode size" ], desc = "Sort by size (reverse)" },
|
||||||
|
{ on = [ ",", "r" ], run = "sort random --reverse=no", desc = "Sort randomly" },
|
||||||
|
|
||||||
|
# Goto
|
||||||
|
{ on = [ "g", "h" ], run = "cd ~", desc = "Go home" },
|
||||||
|
{ on = [ "g", "c" ], run = "cd ~/.config", desc = "Goto ~/.config" },
|
||||||
|
{ on = [ "g", "v" ], run = "cd /Volumes", desc = "Goto /Volumes" },
|
||||||
|
#Media and Docs
|
||||||
|
{ on = [ "g", "d" ], run = "cd ~/Downloads", desc = "Goto ~/Downloads" },
|
||||||
|
{ on = [ "g", "D" ], run = "cd ~/Documents", desc = "Goto ~/Documents" },
|
||||||
|
{ on = [ "g", "t" , "<Space>" ], run = "cd ~/Torrents", desc = "Goto ~/Torrents" },
|
||||||
|
{ on = [ "g", "t", "b"], run = "cd ~/Torrents/Books", desc = "Goto Books" },
|
||||||
|
{ on = [ "g", "t", "a"], run = "cd ~/Torrents/Audiobooks", desc = "Goto Books" },
|
||||||
|
{ on = [ "g", "t", "s"], run = "cd ~/Torrents/Shows", desc = "Goto Shows" },
|
||||||
|
{ on = [ "g", "t", "m"], run = "cd ~/Torrents/Movies", desc = "Goto Shows" },
|
||||||
|
{ on = [ "g", "s" ], run = "cd \"~/Music/Sheet Music/Alto Saxophone\"", desc = "Goto Sax Sheets" },
|
||||||
|
#Studies
|
||||||
|
{ on = [ "g", "j", "b" ], run = "cd \"~/Documents/JKU/Studium/BWL\"", desc = "Goto BWL" },
|
||||||
|
{ on = [ "g", "j", "w" ], run = "cd \"~/Documents/JKU/Work\"", desc = "Goto Work(local)" },
|
||||||
|
{ on = [ "g", "o", "p" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Privat/", desc = "Goto Obsidian/Privat" },
|
||||||
|
{ on = [ "g", "o", "d" ], run = "shell --confirm 'touch $(date +%F).md'", desc = "Create Daily Note in Obsidian" },
|
||||||
|
{ on = [ "g", "o", "w" ], run = "cd ~/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/Work/", desc = "Goto Obsidian/Work" },
|
||||||
|
#Work Related - Network drive
|
||||||
|
{ on = [ "g", "a", "<Space>" ], run = "cd /Volumes/AK127132", desc = "Goto AK127132" },
|
||||||
|
{ on = [ "g", "a", "z" ], run = "cd /Volumes/AK127132/Zeitaufzeichnung", desc = "Goto Zeitaufzeichnung" },
|
||||||
|
|
||||||
|
{ on = [ "g", "i", "<Space>" ], run = "cd /Volumes/ipec/intern", desc = "Goto Intern" },
|
||||||
|
{ on = [ "g", "p", "b" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P54_EDIH TBI 80 Brückner\"", desc = "Goto Brückner" },
|
||||||
|
{ on = [ "g", "p", "s" ], run = "cd \"/Volumes/ipec/intern/02_Projekte/P42b_Senoplast SenoSmartCoex\"", desc = "Goto SenoSmartCoex" },
|
||||||
|
{ on = [ "g", "i", "p" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen/Projektstatusberichte\"", desc = "Goto Projektstatusberichte" },
|
||||||
|
{ on = [ "g", "i", "b" ], run = "cd \"/Volumes/ipec/intern/05_Institutsbesprechungen\"", desc = "Goto Institutsbesprechungen" },
|
||||||
|
|
||||||
|
{ on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Jump interactively" },
|
||||||
|
|
||||||
|
|
||||||
|
{ on = "R", run = "open -a Finder .", desc = "Open current folder in Finder" },
|
||||||
|
# Tabs
|
||||||
|
{ on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" },
|
||||||
|
|
||||||
|
{ 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 = "[", run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
|
||||||
|
{ on = "]", run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
|
||||||
|
|
||||||
|
{ on = "{", run = "tab_swap -1", desc = "Swap current tab with previous tab" },
|
||||||
|
{ on = "}", run = "tab_swap 1", desc = "Swap current tab with next tab" },
|
||||||
|
|
||||||
|
# Tasks
|
||||||
|
{ on = "w", run = "tasks_show", desc = "Show task manager" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "close", desc = "Close task manager" },
|
||||||
|
{ on = "<C-[>", run = "close", desc = "Close task manager" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Close task manager" },
|
||||||
|
{ on = "w", run = "close", desc = "Close task manager" },
|
||||||
|
|
||||||
|
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Enter>", run = "inspect", desc = "Inspect the task" },
|
||||||
|
{ on = "x", run = "cancel", desc = "Cancel the task" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[spot]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "close", desc = "Close the spot" },
|
||||||
|
{ on = "<C-[>", run = "close", desc = "Close the spot" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Close the spot" },
|
||||||
|
{ on = "<Tab>", run = "close", desc = "Close the spot" },
|
||||||
|
|
||||||
|
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
{ on = "h", run = "swipe -1", desc = "Swipe to the next file" },
|
||||||
|
{ on = "l", run = "swipe 1", desc = "Swipe to the previous file" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
{ on = "<Left>", run = "swipe -1", desc = "Swipe to the next file" },
|
||||||
|
{ on = "<Right>", run = "swipe 1", desc = "Swipe to the previous file" },
|
||||||
|
|
||||||
|
# Copy
|
||||||
|
{ on = [ "c", "c" ], run = "copy cell", desc = "Copy selected cell" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[pick]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "close", desc = "Cancel pick" },
|
||||||
|
{ on = "<C-[>", run = "close", desc = "Cancel pick" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Cancel pick" },
|
||||||
|
{ on = "<Enter>", run = "close --submit", desc = "Submit the pick" },
|
||||||
|
|
||||||
|
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Cancel input" },
|
||||||
|
{ on = "<Enter>", run = "close --submit", desc = "Submit input" },
|
||||||
|
{ on = "<Esc>", run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||||
|
{ on = "<C-[>", run = "escape", desc = "Go back the normal mode, or cancel input" },
|
||||||
|
|
||||||
|
# Mode
|
||||||
|
{ 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", run = "move -1", desc = "Move back a character" },
|
||||||
|
{ on = "l", run = "move 1", desc = "Move forward a character" },
|
||||||
|
{ on = "<Left>", run = "move -1", desc = "Move back a character" },
|
||||||
|
{ on = "<Right>", run = "move 1", desc = "Move forward a character" },
|
||||||
|
{ on = "<C-b>", run = "move -1", desc = "Move back a character" },
|
||||||
|
{ on = "<C-f>", run = "move 1", desc = "Move forward a character" },
|
||||||
|
|
||||||
|
# Word-wise movement
|
||||||
|
{ 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 = "<A-b>", run = "backward", desc = "Move back to the start of the current or previous word" },
|
||||||
|
{ on = "<A-f>", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
|
||||||
|
|
||||||
|
# Line-wise movement
|
||||||
|
{ on = "0", run = "move -999", desc = "Move to the BOL" },
|
||||||
|
{ on = "$", run = "move 999", desc = "Move to the EOL" },
|
||||||
|
{ on = "<C-a>", run = "move -999", desc = "Move to the BOL" },
|
||||||
|
{ on = "<C-e>", run = "move 999", desc = "Move to the EOL" },
|
||||||
|
{ on = "<Home>", run = "move -999", desc = "Move to the BOL" },
|
||||||
|
{ on = "<End>", run = "move 999", desc = "Move to the EOL" },
|
||||||
|
|
||||||
|
# Delete
|
||||||
|
{ on = "<Backspace>", run = "backspace", desc = "Delete the character before the cursor" },
|
||||||
|
{ on = "<Delete>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||||
|
{ on = "<C-h>", run = "backspace", desc = "Delete the character before the cursor" },
|
||||||
|
{ on = "<C-d>", run = "backspace --under", desc = "Delete the character under the cursor" },
|
||||||
|
|
||||||
|
# Kill
|
||||||
|
{ on = "<C-u>", run = "kill bol", desc = "Kill backwards to the BOL" },
|
||||||
|
{ on = "<C-k>", run = "kill eol", desc = "Kill forwards to the EOL" },
|
||||||
|
{ on = "<C-w>", run = "kill backward", desc = "Kill backwards to the start of the current word" },
|
||||||
|
{ on = "<A-d>", run = "kill forward", desc = "Kill forwards to the end of the current word" },
|
||||||
|
|
||||||
|
# Cut/Yank/Paste
|
||||||
|
{ 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", run = "undo", desc = "Undo the last operation" },
|
||||||
|
{ on = "<C-r>", run = "redo", desc = "Redo the last operation" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[confirm]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "close", desc = "Cancel the confirm" },
|
||||||
|
{ on = "<C-[>", run = "close", desc = "Cancel the confirm" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Cancel the confirm" },
|
||||||
|
{ on = "<Enter>", run = "close --submit", desc = "Submit the confirm" },
|
||||||
|
|
||||||
|
{ on = "n", run = "close", desc = "Cancel the confirm" },
|
||||||
|
{ on = "y", run = "close --submit", desc = "Submit the confirm" },
|
||||||
|
|
||||||
|
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[completion]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Cancel completion" },
|
||||||
|
{ on = "<Tab>", run = "close --submit", desc = "Submit the completion" },
|
||||||
|
{ on = "<Enter>", run = [ "close --submit", "close_input --submit" ], desc = "Submit the completion and input" },
|
||||||
|
|
||||||
|
{ on = "<A-k>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<A-j>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<C-p>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<C-n>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
# Help
|
||||||
|
{ on = "~", run = "help", desc = "Open help" },
|
||||||
|
{ on = "<F3>", run = "help", desc = "Open help" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[help]
|
||||||
|
|
||||||
|
keymap = [
|
||||||
|
{ on = "<Esc>", run = "escape", desc = "Clear the filter, or hide the help" },
|
||||||
|
{ on = "<C-[>", run = "escape", desc = "Clear the filter, or hide the help" },
|
||||||
|
{ on = "<C-c>", run = "close", desc = "Hide the help" },
|
||||||
|
|
||||||
|
# Navigation
|
||||||
|
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
|
||||||
|
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
|
||||||
|
|
||||||
|
# Filtering
|
||||||
|
{ on = "f", run = "filter", desc = "Apply a filter for the help items" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[manager.prepend_keymap]]
|
||||||
|
on = "f"
|
||||||
|
run = "plugin jump-to-char"
|
||||||
|
desc = "Jump to char"
|
||||||
@@ -1,5 +1,22 @@
|
|||||||
[plugin]
|
[[plugin.deps]]
|
||||||
deps = [{ use = "yazi-rs/plugins:jump-to-char", rev = "600614a" }]
|
use = "yazi-rs/plugins:jump-to-char"
|
||||||
|
rev = "c0ad8a3"
|
||||||
|
hash = "30fc0b37f03a597b92d387268319450f"
|
||||||
|
|
||||||
|
[[plugin.deps]]
|
||||||
|
use = "Reledia/glow"
|
||||||
|
rev = "2da96e3"
|
||||||
|
hash = "f9ee1436e3b853508d87f7d49dce56e6"
|
||||||
|
|
||||||
|
[[plugin.deps]]
|
||||||
|
use = "yazi-rs/plugins:smart-enter"
|
||||||
|
rev = "2ad42fa"
|
||||||
|
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
||||||
|
|
||||||
|
[[plugin.deps]]
|
||||||
|
use = "yazi-rs/plugins:git"
|
||||||
|
rev = "2ad42fa"
|
||||||
|
hash = "e01006bfb38951ea89031bd918b20dbb"
|
||||||
|
|
||||||
[flavor]
|
[flavor]
|
||||||
deps = []
|
deps = []
|
||||||
|
|||||||
21
yazi/plugins/full-border.yazi/LICENSE
Normal file
21
yazi/plugins/full-border.yazi/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 yazi-rs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
32
yazi/plugins/full-border.yazi/README.md
Normal file
32
yazi/plugins/full-border.yazi/README.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# full-border.yazi
|
||||||
|
|
||||||
|
Add a full border to Yazi to make it look fancier.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ya pkg add yazi-rs/plugins:full-border
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Add this to your `init.lua` to enable the plugin:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require("full-border"):setup()
|
||||||
|
```
|
||||||
|
|
||||||
|
Or you can customize the border type:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require("full-border"):setup {
|
||||||
|
-- Available values: ui.Border.PLAIN, ui.Border.ROUNDED
|
||||||
|
type = ui.Border.ROUNDED,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||||
43
yazi/plugins/full-border.yazi/main.lua
Normal file
43
yazi/plugins/full-border.yazi/main.lua
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
--- @since 25.2.26
|
||||||
|
|
||||||
|
local function setup(_, opts)
|
||||||
|
local type = opts and opts.type or ui.Border.ROUNDED
|
||||||
|
local old_build = Tab.build
|
||||||
|
|
||||||
|
Tab.build = function(self, ...)
|
||||||
|
local bar = function(c, x, y)
|
||||||
|
if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then
|
||||||
|
return ui.Bar(ui.Edge.TOP)
|
||||||
|
end
|
||||||
|
|
||||||
|
return ui.Bar(ui.Edge.TOP)
|
||||||
|
:area(
|
||||||
|
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) }
|
||||||
|
)
|
||||||
|
:symbol(c)
|
||||||
|
end
|
||||||
|
|
||||||
|
local c = self._chunks
|
||||||
|
self._chunks = {
|
||||||
|
c[1]:pad(ui.Pad.y(1)),
|
||||||
|
c[2]:pad(ui.Pad(1, c[3].w > 0 and 0 or 1, 1, c[1].w > 0 and 0 or 1)),
|
||||||
|
c[3]:pad(ui.Pad.y(1)),
|
||||||
|
}
|
||||||
|
|
||||||
|
local style = th.mgr.border_style
|
||||||
|
self._base = ya.list_merge(self._base or {}, {
|
||||||
|
ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style),
|
||||||
|
ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style),
|
||||||
|
ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):style(style),
|
||||||
|
|
||||||
|
bar("┬", c[1].right - 1, c[1].y),
|
||||||
|
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||||
|
bar("┬", c[2].right, c[2].y),
|
||||||
|
bar("┴", c[2].right, c[2].bottom - 1),
|
||||||
|
})
|
||||||
|
|
||||||
|
old_build(self, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return { setup = setup }
|
||||||
21
yazi/plugins/git.yazi/LICENSE
Normal file
21
yazi/plugins/git.yazi/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 yazi-rs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
75
yazi/plugins/git.yazi/README.md
Normal file
75
yazi/plugins/git.yazi/README.md
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# git.yazi
|
||||||
|
|
||||||
|
Show the status of Git file changes as linemode in the file list.
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ya pkg add yazi-rs/plugins:git
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Add the following to your `~/.config/yazi/init.lua`:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require("git"):setup()
|
||||||
|
```
|
||||||
|
|
||||||
|
And register it as fetchers in your `~/.config/yazi/yazi.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[plugin.prepend_fetchers]]
|
||||||
|
id = "git"
|
||||||
|
name = "*"
|
||||||
|
run = "git"
|
||||||
|
|
||||||
|
[[plugin.prepend_fetchers]]
|
||||||
|
id = "git"
|
||||||
|
name = "*/"
|
||||||
|
run = "git"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Advanced
|
||||||
|
|
||||||
|
You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
|
||||||
|
|
||||||
|
- `th.git.modified`
|
||||||
|
- `th.git.added`
|
||||||
|
- `th.git.untracked`
|
||||||
|
- `th.git.ignored`
|
||||||
|
- `th.git.deleted`
|
||||||
|
- `th.git.updated`
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- ~/.config/yazi/init.lua
|
||||||
|
th.git = th.git or {}
|
||||||
|
th.git.modified = ui.Style():fg("blue")
|
||||||
|
th.git.deleted = ui.Style():fg("red"):bold()
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also customize the text of the status sign with:
|
||||||
|
|
||||||
|
- `th.git.modified_sign`
|
||||||
|
- `th.git.added_sign`
|
||||||
|
- `th.git.untracked_sign`
|
||||||
|
- `th.git.ignored_sign`
|
||||||
|
- `th.git.deleted_sign`
|
||||||
|
- `th.git.updated_sign`
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- ~/.config/yazi/init.lua
|
||||||
|
th.git = th.git or {}
|
||||||
|
th.git.modified_sign = "M"
|
||||||
|
th.git.deleted_sign = "D"
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||||
228
yazi/plugins/git.yazi/main.lua
Normal file
228
yazi/plugins/git.yazi/main.lua
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
--- @since 25.5.31
|
||||||
|
|
||||||
|
local WINDOWS = ya.target_family() == "windows"
|
||||||
|
|
||||||
|
-- The code of supported git status,
|
||||||
|
-- also used to determine which status to show for directories when they contain different statuses
|
||||||
|
-- see `bubble_up`
|
||||||
|
local CODES = {
|
||||||
|
excluded = 100, -- ignored directory
|
||||||
|
ignored = 6, -- ignored file
|
||||||
|
untracked = 5,
|
||||||
|
modified = 4,
|
||||||
|
added = 3,
|
||||||
|
deleted = 2,
|
||||||
|
updated = 1,
|
||||||
|
unknown = 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
local PATTERNS = {
|
||||||
|
{ "!$", CODES.ignored },
|
||||||
|
{ "?$", CODES.untracked },
|
||||||
|
{ "[MT]", CODES.modified },
|
||||||
|
{ "[AC]", CODES.added },
|
||||||
|
{ "D", CODES.deleted },
|
||||||
|
{ "U", CODES.updated },
|
||||||
|
{ "[AD][AD]", CODES.updated },
|
||||||
|
}
|
||||||
|
|
||||||
|
local function match(line)
|
||||||
|
local signs = line:sub(1, 2)
|
||||||
|
for _, p in ipairs(PATTERNS) do
|
||||||
|
local path, pattern, code = nil, p[1], p[2]
|
||||||
|
if signs:find(pattern) then
|
||||||
|
path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4)
|
||||||
|
path = WINDOWS and path:gsub("/", "\\") or path
|
||||||
|
end
|
||||||
|
if not path then
|
||||||
|
elseif path:find("[/\\]$") then
|
||||||
|
-- Mark the ignored directory as `excluded`, so we can process it further within `propagate_down`
|
||||||
|
return code == CODES.ignored and CODES.excluded or code, path:sub(1, -2)
|
||||||
|
else
|
||||||
|
return code, path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function root(cwd)
|
||||||
|
local is_worktree = function(url)
|
||||||
|
local file, head = io.open(tostring(url)), nil
|
||||||
|
if file then
|
||||||
|
head = file:read(8)
|
||||||
|
file:close()
|
||||||
|
end
|
||||||
|
return head == "gitdir: "
|
||||||
|
end
|
||||||
|
|
||||||
|
repeat
|
||||||
|
local next = cwd:join(".git")
|
||||||
|
local cha = fs.cha(next)
|
||||||
|
if cha and (cha.is_dir or is_worktree(next)) then
|
||||||
|
return tostring(cwd)
|
||||||
|
end
|
||||||
|
cwd = cwd.parent
|
||||||
|
until not cwd
|
||||||
|
end
|
||||||
|
|
||||||
|
local function bubble_up(changed)
|
||||||
|
local new, empty = {}, Url("")
|
||||||
|
for path, code in pairs(changed) do
|
||||||
|
if code ~= CODES.ignored then
|
||||||
|
local url = Url(path).parent
|
||||||
|
while url and url ~= empty do
|
||||||
|
local s = tostring(url)
|
||||||
|
new[s] = (new[s] or CODES.unknown) > code and new[s] or code
|
||||||
|
url = url.parent
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return new
|
||||||
|
end
|
||||||
|
|
||||||
|
local function propagate_down(excluded, cwd, repo)
|
||||||
|
local new, rel = {}, cwd:strip_prefix(repo)
|
||||||
|
for _, path in ipairs(excluded) do
|
||||||
|
if rel:starts_with(path) then
|
||||||
|
-- If `cwd` is a subdirectory of an excluded directory, also mark it as `excluded`
|
||||||
|
new[tostring(cwd)] = CODES.excluded
|
||||||
|
elseif cwd == repo:join(path).parent then
|
||||||
|
-- If `path` is a direct subdirectory of `cwd`, mark it as `ignored`
|
||||||
|
new[path] = CODES.ignored
|
||||||
|
else
|
||||||
|
-- Skipping, we only care about `cwd` itself and its direct subdirectories for maximum performance
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return new
|
||||||
|
end
|
||||||
|
|
||||||
|
local add = ya.sync(function(st, cwd, repo, changed)
|
||||||
|
st.dirs[cwd] = repo
|
||||||
|
st.repos[repo] = st.repos[repo] or {}
|
||||||
|
for path, code in pairs(changed) do
|
||||||
|
if code == CODES.unknown then
|
||||||
|
st.repos[repo][path] = nil
|
||||||
|
elseif code == CODES.excluded then
|
||||||
|
-- Mark the directory with a special value `excluded` so that it can be distinguished during UI rendering
|
||||||
|
st.dirs[path] = CODES.excluded
|
||||||
|
else
|
||||||
|
st.repos[repo][path] = code
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ya.render()
|
||||||
|
end)
|
||||||
|
|
||||||
|
local remove = ya.sync(function(st, cwd)
|
||||||
|
local repo = st.dirs[cwd]
|
||||||
|
if not repo then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
ya.render()
|
||||||
|
st.dirs[cwd] = nil
|
||||||
|
if not st.repos[repo] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, r in pairs(st.dirs) do
|
||||||
|
if r == repo then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
st.repos[repo] = nil
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function setup(st, opts)
|
||||||
|
st.dirs = {} -- Mapping between a directory and its corresponding repository
|
||||||
|
st.repos = {} -- Mapping between a repository and the status of each of its files
|
||||||
|
|
||||||
|
opts = opts or {}
|
||||||
|
opts.order = opts.order or 1500
|
||||||
|
|
||||||
|
local t = th.git or {}
|
||||||
|
local styles = {
|
||||||
|
[CODES.ignored] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("darkgray"),
|
||||||
|
[CODES.untracked] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("magenta"),
|
||||||
|
[CODES.modified] = t.modified and ui.Style(t.modified) or ui.Style():fg("yellow"),
|
||||||
|
[CODES.added] = t.added and ui.Style(t.added) or ui.Style():fg("green"),
|
||||||
|
[CODES.deleted] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("red"),
|
||||||
|
[CODES.updated] = t.updated and ui.Style(t.updated) or ui.Style():fg("yellow"),
|
||||||
|
}
|
||||||
|
local signs = {
|
||||||
|
[CODES.ignored] = t.ignored_sign or "",
|
||||||
|
[CODES.untracked] = t.untracked_sign or "?",
|
||||||
|
[CODES.modified] = t.modified_sign or "",
|
||||||
|
[CODES.added] = t.added_sign or "",
|
||||||
|
[CODES.deleted] = t.deleted_sign or "",
|
||||||
|
[CODES.updated] = t.updated_sign or "",
|
||||||
|
}
|
||||||
|
|
||||||
|
Linemode:children_add(function(self)
|
||||||
|
local url = self._file.url
|
||||||
|
local repo = st.dirs[tostring(url.base)]
|
||||||
|
local code
|
||||||
|
if repo then
|
||||||
|
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)]
|
||||||
|
end
|
||||||
|
|
||||||
|
if not code or signs[code] == "" then
|
||||||
|
return ""
|
||||||
|
elseif self._file.is_hovered then
|
||||||
|
return ui.Line { " ", signs[code] }
|
||||||
|
else
|
||||||
|
return ui.Line { " ", ui.Span(signs[code]):style(styles[code]) }
|
||||||
|
end
|
||||||
|
end, opts.order)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function fetch(_, job)
|
||||||
|
local cwd = job.files[1].url.base
|
||||||
|
local repo = root(cwd)
|
||||||
|
if not repo then
|
||||||
|
remove(tostring(cwd))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local paths = {}
|
||||||
|
for _, file in ipairs(job.files) do
|
||||||
|
paths[#paths + 1] = tostring(file.url)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- stylua: ignore
|
||||||
|
local output, err = Command("git")
|
||||||
|
:cwd(tostring(cwd))
|
||||||
|
:arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||||
|
:arg(paths)
|
||||||
|
:stdout(Command.PIPED)
|
||||||
|
:output()
|
||||||
|
if not output then
|
||||||
|
return true, Err("Cannot spawn `git` command, error: %s", err)
|
||||||
|
end
|
||||||
|
|
||||||
|
local changed, excluded = {}, {}
|
||||||
|
for line in output.stdout:gmatch("[^\r\n]+") do
|
||||||
|
local code, path = match(line)
|
||||||
|
if code == CODES.excluded then
|
||||||
|
excluded[#excluded + 1] = path
|
||||||
|
else
|
||||||
|
changed[path] = code
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if job.files[1].cha.is_dir then
|
||||||
|
ya.dict_merge(changed, bubble_up(changed))
|
||||||
|
end
|
||||||
|
ya.dict_merge(changed, propagate_down(excluded, cwd, Url(repo)))
|
||||||
|
|
||||||
|
-- Reset the status of any files that don't appear in the output of `git status` to `unknown`,
|
||||||
|
-- so that cleaning up outdated statuses from `st.repos`
|
||||||
|
for _, path in ipairs(paths) do
|
||||||
|
local s = path:sub(#repo + 2)
|
||||||
|
changed[s] = changed[s] or CODES.unknown
|
||||||
|
end
|
||||||
|
|
||||||
|
add(tostring(cwd), repo, changed)
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return { setup = setup, fetch = fetch }
|
||||||
7
yazi/plugins/glow.yazi/LICENSE
Normal file
7
yazi/plugins/glow.yazi/LICENSE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright © 2024 Reledia <reledia@prontonmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
30
yazi/plugins/glow.yazi/README.md
Normal file
30
yazi/plugins/glow.yazi/README.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# glow.yazi
|
||||||
|
|
||||||
|
Plugin for [Yazi](https://github.com/sxyazi/yazi) to preview markdown files with [glow](https://github.com/charmbracelet/glow). To install, run the below mentioned command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ya pack -a Reledia/glow
|
||||||
|
```
|
||||||
|
|
||||||
|
then include it in your `yazi.toml` to use:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[plugin]
|
||||||
|
prepend_previewers = [
|
||||||
|
{ name = "*.md", run = "glow" },
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure you have [glow](https://github.com/charmbracelet/glow) installed, and can be found in `PATH`.
|
||||||
|
|
||||||
|
## Feature
|
||||||
|
|
||||||
|
+ You can modify line wrap in `main.lua`, the current value is 55.
|
||||||
|
+ You can press `ctrl+e` to scroll up and `ctrl+y` to scroll down the readme file in preview panel in yazi: (add this to `keymap.toml`)
|
||||||
|
```toml
|
||||||
|
prepend_keymap = [
|
||||||
|
# glow.yazi
|
||||||
|
{ on = ["<C-e>"], run = "seek 5" },
|
||||||
|
{ on = ["<C-y>"], run = "seek -5" },
|
||||||
|
]
|
||||||
|
```
|
||||||
64
yazi/plugins/glow.yazi/main.lua
Normal file
64
yazi/plugins/glow.yazi/main.lua
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M:peek(job)
|
||||||
|
-- Set a fixed width of 50 characters for the preview
|
||||||
|
local preview_width = 55
|
||||||
|
|
||||||
|
local child = Command("glow")
|
||||||
|
:args({
|
||||||
|
"--style",
|
||||||
|
"dark",
|
||||||
|
"--width",
|
||||||
|
tostring(preview_width), -- Use fixed width instead of job.area.w
|
||||||
|
tostring(job.file.url),
|
||||||
|
})
|
||||||
|
:env("CLICOLOR_FORCE", "1")
|
||||||
|
:stdout(Command.PIPED)
|
||||||
|
:stderr(Command.PIPED)
|
||||||
|
:spawn()
|
||||||
|
|
||||||
|
if not child then
|
||||||
|
return require("code").peek(job)
|
||||||
|
end
|
||||||
|
|
||||||
|
local limit = job.area.h
|
||||||
|
local i, lines = 0, ""
|
||||||
|
repeat
|
||||||
|
local next, event = child:read_line()
|
||||||
|
if event == 1 then
|
||||||
|
return require("code").peek(job)
|
||||||
|
elseif event ~= 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
i = i + 1
|
||||||
|
if i > job.skip then
|
||||||
|
lines = lines .. next
|
||||||
|
end
|
||||||
|
until i >= job.skip + limit
|
||||||
|
|
||||||
|
child:start_kill()
|
||||||
|
if job.skip > 0 and i < job.skip + limit then
|
||||||
|
ya.mgr_emit("peek", {
|
||||||
|
tostring(math.max(0, i - limit)),
|
||||||
|
only_if = job.file.url,
|
||||||
|
upper_bound = true
|
||||||
|
})
|
||||||
|
else
|
||||||
|
lines = lines:gsub("\t", string.rep(" ", rt.preview.tab_size))
|
||||||
|
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:seek(job)
|
||||||
|
local h = cx.active.current.hovered
|
||||||
|
if not h or h.url ~= job.file.url then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
ya.mgr_emit('peek', {
|
||||||
|
math.max(0, cx.active.preview.skip + job.units),
|
||||||
|
only_if = job.file.url,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -7,7 +7,7 @@ https://github.com/yazi-rs/plugins/assets/17523360/aac9341c-b416-4e0c-aaba-889d4
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pack -a yazi-rs/plugins:jump-to-char
|
ya pkg add yazi-rs/plugins:jump-to-char
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -15,7 +15,7 @@ ya pack -a yazi-rs/plugins:jump-to-char
|
|||||||
Add this to your `~/.config/yazi/keymap.toml`:
|
Add this to your `~/.config/yazi/keymap.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = "f"
|
on = "f"
|
||||||
run = "plugin jump-to-char"
|
run = "plugin jump-to-char"
|
||||||
desc = "Jump to char"
|
desc = "Jump to char"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
--- @since 25.5.28
|
||||||
|
|
||||||
local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
|
local AVAILABLE_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789."
|
||||||
|
|
||||||
local changed = ya.sync(function(st, new)
|
local changed = ya.sync(function(st, new)
|
||||||
@@ -22,9 +24,9 @@ return {
|
|||||||
|
|
||||||
local kw = escape(cands[idx].on)
|
local kw = escape(cands[idx].on)
|
||||||
if changed(kw) then
|
if changed(kw) then
|
||||||
ya.manager_emit("find_do", { "^" .. kw })
|
ya.emit("find_do", { "^" .. kw })
|
||||||
else
|
else
|
||||||
ya.manager_emit("find_arrow", {})
|
ya.emit("find_arrow", {})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
21
yazi/plugins/smart-enter.yazi/LICENSE
Normal file
21
yazi/plugins/smart-enter.yazi/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 yazi-rs
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
40
yazi/plugins/smart-enter.yazi/README.md
Normal file
40
yazi/plugins/smart-enter.yazi/README.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# smart-enter.yazi
|
||||||
|
|
||||||
|
[`Open`][open] files or [`enter`][enter] directories all in one key!
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ya pkg add yazi-rs/plugins:smart-enter
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Bind your <kbd>l</kbd> key to the plugin, in your `~/.config/yazi/keymap.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[mgr.prepend_keymap]]
|
||||||
|
on = "l"
|
||||||
|
run = "plugin smart-enter"
|
||||||
|
desc = "Enter the child directory, or open the file"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Advanced
|
||||||
|
|
||||||
|
By default, `--hovered` is passed to the [`open`][open] command, make the behavior consistent with [`enter`][enter] avoiding accidental triggers,
|
||||||
|
which means both will only target the currently hovered file.
|
||||||
|
|
||||||
|
If you still want `open` to target multiple selected files, add this to your `~/.config/yazi/init.lua`:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
require("smart-enter"):setup {
|
||||||
|
open_multi = true,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||||
|
|
||||||
|
[open]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.open
|
||||||
|
[enter]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.enter
|
||||||
11
yazi/plugins/smart-enter.yazi/main.lua
Normal file
11
yazi/plugins/smart-enter.yazi/main.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
--- @since 25.5.31
|
||||||
|
--- @sync entry
|
||||||
|
|
||||||
|
local function setup(self, opts) self.open_multi = opts.open_multi end
|
||||||
|
|
||||||
|
local function entry(self)
|
||||||
|
local h = cx.active.current.hovered
|
||||||
|
ya.emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi })
|
||||||
|
end
|
||||||
|
|
||||||
|
return { entry = entry, setup = setup }
|
||||||
11
yazi/scripts/create_date_folder.lua
Normal file
11
yazi/scripts/create_date_folder.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local function get_date()
|
||||||
|
return os.date("%Y-%m-%d")
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
name = "create_date_folder",
|
||||||
|
entry = function()
|
||||||
|
local date_folder = get_date()
|
||||||
|
os.execute("mkdir -p " .. vim.fn.shellescape(date_folder))
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Temporarily disable all config for testing
|
||||||
max_width=3000
|
max_width=3000
|
||||||
max_height=3000
|
max_height=3000
|
||||||
|
|
||||||
@@ -6,9 +7,8 @@ play = [
|
|||||||
{ run = 'open -a IINA "$@"', orphan = true, for = "unix", desc='IINA'}
|
{ run = 'open -a IINA "$@"', orphan = true, for = "unix", desc='IINA'}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# [mgr]
|
||||||
[mgr]
|
# ratio = [2, 6, 5] # left, center, right pane width ratios
|
||||||
ratio = [2, 6, 5] # left, center, right pane width ratios
|
|
||||||
|
|
||||||
[plugin]
|
[plugin]
|
||||||
prepend_previewers = [
|
prepend_previewers = [
|
||||||
|
|||||||
11
yazi/yazi.toml-1748636568460526
Normal file
11
yazi/yazi.toml-1748636568460526
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
max_width=3000
|
||||||
|
max_height=3000
|
||||||
|
|
||||||
|
[opener]
|
||||||
|
play = [
|
||||||
|
{ run = 'open -a IINA "$@"', orphan = true, for = "unix", desc='IINA'}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[manager]
|
||||||
|
ratio = [2, 6, 5] # left, center, right pane width ratios
|
||||||
Reference in New Issue
Block a user