updated yazi config
No files matched your search
@@ -6,172 +6,178 @@
|
||||
[mgr]
|
||||
# ~/.config/yazi/keymap.toml
|
||||
|
||||
prepend_keymap = [
|
||||
###############################################################################
|
||||
### omni-trash ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "R"
|
||||
run = "plugin omni-trash"
|
||||
desc = "Open Omni Trash"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"R",
|
||||
], run = "plugin omni-trash", desc = "Open Omni Trash" },
|
||||
###############################################################################
|
||||
### lazy git ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["g", "i"]
|
||||
run = "plugin lazygit"
|
||||
desc = "run lazygit"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"g",
|
||||
"i",
|
||||
], run = "plugin lazygit", desc = "run lazygit" },
|
||||
###############################################################################
|
||||
### restore-tab ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "<C-t>"
|
||||
run = "plugin close-and-restore-tab restore"
|
||||
desc = "Restore the previously closed tab"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "<C-w>"
|
||||
run = "close"
|
||||
desc = "Close the current tab, or quit if it's last"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"<C-t>",
|
||||
], run = "plugin close-and-restore-tab restore", desc = "Restore the previously closed tab" },
|
||||
{ on = [
|
||||
"<C-w>",
|
||||
], run = "close", desc = "Close the current tab, or quit if it's last" },
|
||||
###############################################################################
|
||||
### projects ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "s"]
|
||||
run = "plugin projects save"
|
||||
desc = "Save current project"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "l"]
|
||||
run = "plugin projects load"
|
||||
desc = "Load project"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "P"]
|
||||
run = "plugin projects load_last"
|
||||
desc = "Load last project"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "d"]
|
||||
run = "plugin projects delete"
|
||||
desc = "Delete project"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "D"]
|
||||
run = "plugin projects delete_all"
|
||||
desc = "Delete all projects"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "m"]
|
||||
run = "plugin projects 'merge current'"
|
||||
desc = "Merge current tab to other projects"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["P", "M"]
|
||||
run = "plugin projects 'merge all'"
|
||||
desc = "Merge current project to other projects"
|
||||
|
||||
### yapfg ###l
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["A", "G"]
|
||||
run = "plugin yafg"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"P",
|
||||
"s",
|
||||
], run = "plugin projects save", desc = "Save current project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"l",
|
||||
], run = "plugin projects load", desc = "Load project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"P",
|
||||
], run = "plugin projects load_last", desc = "Load last project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"d",
|
||||
], run = "plugin projects delete", desc = "Delete project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"D",
|
||||
], run = "plugin projects delete_all", desc = "Delete all projects" },
|
||||
{ on = [
|
||||
"P",
|
||||
"m",
|
||||
], run = "plugin projects 'merge current'", desc = "Merge current tab to other projects" },
|
||||
{ on = [
|
||||
"P",
|
||||
"M",
|
||||
], run = "plugin projects 'merge all'", desc = "Merge current project to other projects" },
|
||||
###############################################################################
|
||||
### yapfg ###
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"A",
|
||||
"G",
|
||||
], run = "plugin yafg" },
|
||||
###############################################################################
|
||||
### lsblk ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "M"
|
||||
run = "plugin lsblk-mount"
|
||||
desc = "Open the drive mount manager"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"M",
|
||||
], run = "plugin lsblk-mount", desc = "Open the drive mount manager" },
|
||||
###############################################################################
|
||||
### chmod ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["C", "m"]
|
||||
run = "plugin chmod"
|
||||
desc = "Chmod on selected files"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"C",
|
||||
"m",
|
||||
], run = "plugin chmod", desc = "Chmod on selected files" },
|
||||
###############################################################################
|
||||
### whoosh ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "["
|
||||
run = "plugin whoosh jump_by_key"
|
||||
desc = "Jump bookmark by key"
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"[",
|
||||
], run = "plugin whoosh jump_by_key", desc = "Jump bookmark by key" },
|
||||
# Direct fuzzy search access
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "}"
|
||||
run = "plugin whoosh jump_by_fzf"
|
||||
desc = "Direct fuzzy search for bookmarks"
|
||||
{ on = [
|
||||
"}",
|
||||
], run = "plugin whoosh jump_by_fzf", desc = "Direct fuzzy search for bookmarks" },
|
||||
# Basic bookmark operations
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "a"]
|
||||
run = "plugin whoosh save"
|
||||
desc = "Add bookmark (hovered file/directory)"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "A"]
|
||||
run = "plugin whoosh save_cwd"
|
||||
desc = "Add bookmark (current directory)"
|
||||
{ on = [
|
||||
"]",
|
||||
"a",
|
||||
], run = "plugin whoosh save", desc = "Add bookmark (hovered file/directory)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"A",
|
||||
], run = "plugin whoosh save_cwd", desc = "Add bookmark (current directory)" },
|
||||
# Temporary bookmarks
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "t"]
|
||||
run = "plugin whoosh save_temp"
|
||||
desc = "Add temporary bookmark (hovered file/directory)"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "T"]
|
||||
run = "plugin whoosh save_cwd_temp"
|
||||
desc = "Add temporary bookmark (current directory)"
|
||||
{ on = [
|
||||
"]",
|
||||
"t",
|
||||
], run = "plugin whoosh save_temp", desc = "Add temporary bookmark (hovered file/directory)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"T",
|
||||
], run = "plugin whoosh save_cwd_temp", desc = "Add temporary bookmark (current directory)" },
|
||||
# Jump to bookmarks
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "<A-k>"
|
||||
run = "plugin whoosh jump_key_k"
|
||||
desc = "Jump directly to bookmark with key k"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "f"]
|
||||
run = "plugin whoosh jump_by_fzf"
|
||||
desc = "Jump bookmark by fzf"
|
||||
{ on = [
|
||||
"<A-k>",
|
||||
], run = "plugin whoosh jump_key_k", desc = "Jump directly to bookmark with key k" },
|
||||
{ on = [
|
||||
"]",
|
||||
"f",
|
||||
], run = "plugin whoosh jump_by_fzf", desc = "Jump bookmark by fzf" },
|
||||
# Delete bookmarks
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "d"]
|
||||
run = "plugin whoosh delete_by_key"
|
||||
desc = "Delete bookmark by key"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "D"]
|
||||
run = "plugin whoosh delete_by_fzf"
|
||||
desc = "Delete bookmarks by fzf (use TAB to select multiple)"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "C"]
|
||||
run = "plugin whoosh delete_all"
|
||||
desc = "Delete all user bookmarks"
|
||||
{ on = [
|
||||
"]",
|
||||
"d",
|
||||
], run = "plugin whoosh delete_by_key", desc = "Delete bookmark by key" },
|
||||
{ on = [
|
||||
"]",
|
||||
"D",
|
||||
], run = "plugin whoosh delete_by_fzf", desc = "Delete bookmarks by fzf (use TAB to select multiple)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"C",
|
||||
], run = "plugin whoosh delete_all", desc = "Delete all user bookmarks" },
|
||||
# Rename bookmarks
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "r"]
|
||||
run = "plugin whoosh rename_by_key"
|
||||
desc = "Rename bookmark by key"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["]", "R"]
|
||||
run = "plugin whoosh rename_by_fzf"
|
||||
desc = "Rename bookmark by fzf"
|
||||
|
||||
{ on = [
|
||||
"]",
|
||||
"r",
|
||||
], run = "plugin whoosh rename_by_key", desc = "Rename bookmark by key" },
|
||||
{ on = [
|
||||
"]",
|
||||
"R",
|
||||
], run = "plugin whoosh rename_by_fzf", desc = "Rename bookmark by fzf" },
|
||||
###############################################################################
|
||||
### eza-preview ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "t"]
|
||||
run = "plugin eza-preview"
|
||||
desc = "Toggle tree/list dir preview"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "-"]
|
||||
run = "plugin eza-preview inc-level"
|
||||
desc = "Increment tree level"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "_"]
|
||||
run = "plugin eza-preview dec-level"
|
||||
desc = "Decrement tree level"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "$"]
|
||||
run = "plugin eza-preview toggle-follow-symlinks"
|
||||
desc = "Toggle tree follow symlinks"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "*"]
|
||||
run = "plugin eza-preview toggle-hidden"
|
||||
desc = "Toggle hidden files"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "g", "i"]
|
||||
run = "plugin eza-preview toggle-git-ignore"
|
||||
desc = "Toggle .gitignore files"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["E", "g", "s"]
|
||||
run = "plugin eza-preview toggle-git-status"
|
||||
desc = "Toggle showing git status"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"E",
|
||||
"t",
|
||||
], run = "plugin eza-preview", desc = "Toggle tree/list dir preview" },
|
||||
{ on = [
|
||||
"E",
|
||||
"-",
|
||||
], run = "plugin eza-preview inc-level", desc = "Increment tree level" },
|
||||
{ on = [
|
||||
"E",
|
||||
"_",
|
||||
], run = "plugin eza-preview dec-level", desc = "Decrement tree level" },
|
||||
{ on = [
|
||||
"E",
|
||||
"$",
|
||||
], run = "plugin eza-preview toggle-follow-symlinks", desc = "Toggle tree follow symlinks" },
|
||||
{ on = [
|
||||
"E",
|
||||
"*",
|
||||
], run = "plugin eza-preview toggle-hidden", desc = "Toggle hidden files" },
|
||||
{ on = [
|
||||
"E",
|
||||
"g",
|
||||
"i",
|
||||
], run = "plugin eza-preview toggle-git-ignore", desc = "Toggle .gitignore files" },
|
||||
{ on = [
|
||||
"E",
|
||||
"g",
|
||||
"s",
|
||||
], run = "plugin eza-preview toggle-git-status", desc = "Toggle showing git status" },
|
||||
###############################################################################
|
||||
### smart-enter ###
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "l"
|
||||
run = "plugin smart-enter"
|
||||
desc = "Enter the child directory, or open the file"
|
||||
|
||||
###############################################################################
|
||||
{ on = [
|
||||
"l",
|
||||
], run = "plugin smart-enter", desc = "Enter the child directory, or open the file" },
|
||||
]
|
||||
|
||||
keymap = [
|
||||
{ on = "<Esc>", run = "escape", desc = "Exit visual mode, clear selection, or cancel search" },
|
||||
|
||||
@@ -125,9 +125,10 @@ fetch_workers = 5
|
||||
preload_workers = 2
|
||||
process_workers = 5
|
||||
bizarre_retry = 3
|
||||
image_alloc = 536870912 # 512MB
|
||||
# image_alloc = 536870912 # 512MB
|
||||
image_bound = [10000, 10000]
|
||||
suppress_preload = false
|
||||
image_alloc = 1073741824 # = 1024*1024*1024 = 1024MB
|
||||
|
||||
[plugin]
|
||||
fetchers = [
|
||||
@@ -141,52 +142,16 @@ fetchers = [
|
||||
# { id = "current-size", name = "*", run = "current-size", prio = "normal" },
|
||||
]
|
||||
|
||||
|
||||
prepend_fetchers = [
|
||||
### git ###
|
||||
[[plugin.prepend_fetchers]]
|
||||
url = "*"
|
||||
run = "git"
|
||||
group = "git"
|
||||
[[plugin.prepend_fetchers]]
|
||||
url = "*/"
|
||||
run = "git"
|
||||
group = "git"
|
||||
|
||||
{ url = "*", run = "git", group = "git" },
|
||||
{ url = "*/", run = "git", group = "git" },
|
||||
### mime-ext ###
|
||||
[[plugin.prepend_fetchers]]
|
||||
url = "local://*"
|
||||
run = "mime-ext.local"
|
||||
prio = "high"
|
||||
group = "mime"
|
||||
[[plugin.prepend_fetchers]]
|
||||
url = "remote://*"
|
||||
run = "mime-ext.remote"
|
||||
prio = "high"
|
||||
group = "mime"
|
||||
|
||||
### mediainfo ###
|
||||
prepend_preloaders = [
|
||||
# Replace magick, image, video with mediainfo
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
# .srt subtitle, adobe illustrator, adobe photoshop file
|
||||
{ mime = "application/{subrip,postscript,illustrator,dvb.ait,vnd.adobe.illustrator,eps}", run = "mediainfo" },
|
||||
|
||||
# Sometimes AI file is recognized as "application/pdf". Lmao.
|
||||
# In this case use file extension instead:
|
||||
{ url = "*.{ai,eps,ait}", run = "mediainfo" },
|
||||
|
||||
# Hide metadata by default.
|
||||
# Example for image mimetype:
|
||||
{ mime = "{image}/*", run = "mediainfo --no-metadata" },
|
||||
|
||||
# Hide image preview by default.
|
||||
# Example for video mimetype:
|
||||
{ mime = "{video}/*", run = "mediainfo --no-preview" },
|
||||
|
||||
# NOTE: Use both --no-metadata and --no-preview will display nothing. :)
|
||||
# Make sure both of your previewers and preloaders has the same arguments (--no-metadata and --no-preview)
|
||||
{ url = "local://*", run = "mime-ext.local", prio = "high", group = "mime" },
|
||||
{ url = "remote://*", run = "mime-ext.remote", prio = "high", group = "mime" },
|
||||
]
|
||||
|
||||
|
||||
spotters = [
|
||||
# Multi-file
|
||||
{ mime = "multi/*", run = "multi" },
|
||||
@@ -236,49 +201,25 @@ preloaders = [
|
||||
{ mime = "trash/**", run = "trash" },
|
||||
]
|
||||
|
||||
### exifaudio ###
|
||||
[[plugin.prepend_previewers]]
|
||||
mime = "audio/*"
|
||||
run = "exifaudio"
|
||||
|
||||
### eza-preview ###
|
||||
[[plugin.prepend_previewers]]
|
||||
url = "*/"
|
||||
run = "eza-preview"
|
||||
|
||||
prepend_previewers = [
|
||||
### rich-preview ###
|
||||
{ url = "*.csv", run = "rich-preview" }, # for csv files
|
||||
{ url = "*.md", run = "rich-preview" }, # for markdown (.md) files
|
||||
{ url = "*.rst", run = "rich-preview" }, # for restructured text (.rst) files
|
||||
{ url = "*.ipynb", run = "rich-preview" }, # for jupyter notebooks (.ipynb)
|
||||
{ url = "*.json", run = "rich-preview" }, # for json (.json) files
|
||||
# { url = "*.lang_type", run = "rich-preview"} # for particular language files eg. .py, .go., .lua, etc.
|
||||
|
||||
# ### eza-preview ###
|
||||
# { url = "*/", run = "eza-preview" },
|
||||
|
||||
prepend_preloaders = [
|
||||
### mediainfo ###
|
||||
# Replace magick, image, video with mediainfo
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
# .srt subtitle, adobe illustrator, adobe photoshop file
|
||||
{ mime = "application/{subrip,postscript,illustrator,dvb.ait,vnd.adobe.illustrator,eps}", run = "mediainfo" },
|
||||
|
||||
# Sometimes AI file is recognized as "application/pdf". Lmao.
|
||||
# In this case use file extension instead:
|
||||
{ url = "*.{ai,eps,ait}", run = "mediainfo" },
|
||||
|
||||
# Hide metadata by default.
|
||||
# Example for image mimetype:
|
||||
{ mime = "{image}/*", run = "mediainfo --no-metadata" },
|
||||
|
||||
# Hide image preview by default.
|
||||
# Example for video mimetype:
|
||||
{ mime = "{video}/*", run = "mediainfo --no-preview" },
|
||||
|
||||
# NOTE: Use both --no-metadata and --no-preview will display nothing. :)
|
||||
# Make sure both of your previewers and preloaders has the same arguments (--no-metadata and --no-preview)
|
||||
]
|
||||
|
||||
previewers = [
|
||||
{ url = "*/", run = "folder" },
|
||||
# Code
|
||||
@@ -317,6 +258,36 @@ previewers = [
|
||||
{ url = "*", run = "file" },
|
||||
]
|
||||
|
||||
prepend_previewers = [
|
||||
### rich-preview ###
|
||||
{ url = "*.csv", run = "rich-preview" }, # for csv files
|
||||
{ url = "*.md", run = "rich-preview" }, # for markdown (.md) files
|
||||
{ url = "*.rst", run = "rich-preview" }, # for restructured text (.rst) files
|
||||
{ url = "*.ipynb", run = "rich-preview" }, # for jupyter notebooks (.ipynb)
|
||||
{ url = "*.json", run = "rich-preview" }, # for json (.json) files
|
||||
# { url = "*.lang_type", run = "rich-preview"} # for particular language files eg. .py, .go., .lua, etc.
|
||||
### exifaudio ###
|
||||
{ mime = "audio/*", run = "exifaudio" },
|
||||
### eza-preview ###
|
||||
{ url = "*/", run = "eza-preview" },
|
||||
### mediainfo ###
|
||||
# Replace magick, image, video with mediainfo
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
# .srt subtitle, adobe illustrator, adobe photoshop file
|
||||
{ mime = "application/{subrip,postscript,illustrator,dvb.ait,vnd.adobe.illustrator,eps}", run = "mediainfo" },
|
||||
# Sometimes AI file is recognized as "application/pdf". Lmao.
|
||||
# In this case use file extension instead:
|
||||
{ url = "*.{ai,eps,ait}", run = "mediainfo" },
|
||||
# Hide metadata by default.
|
||||
# Example for image mimetype:
|
||||
{ mime = "{image}/*", run = "mediainfo --no-metadata" },
|
||||
# Hide image preview by default.
|
||||
# Example for video mimetype:
|
||||
{ mime = "{video}/*", run = "mediainfo --no-preview" },
|
||||
# NOTE: Use both --no-metadata and --no-preview will display nothing. :)
|
||||
# Make sure both of your previewers and preloaders has the same arguments (--no-metadata and --no-preview)
|
||||
]
|
||||
|
||||
[input]
|
||||
cursor_blink = false
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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.
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Catppuccin
|
||||
|
||||
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.
|
||||
@@ -1,36 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Catppuccin Mocha Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
```sh
|
||||
ya pkg add yazi-rs/flavors:catppuccin-mocha
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Set the content of your `theme.toml` to enable it as your _dark_ flavor:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "catppuccin-mocha"
|
||||
```
|
||||
|
||||
Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor.
|
||||
|
||||
See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details.
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,187 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#94e2d5" }
|
||||
|
||||
# TODO: remove
|
||||
# Hovered
|
||||
hovered = { reversed = true }
|
||||
preview_hovered = { underline = true }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#f9e2af", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#f5c2e7", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#a6e3a1", bg = "#a6e3a1" }
|
||||
marker_cut = { fg = "#f38ba8", bg = "#f38ba8" }
|
||||
marker_marked = { fg = "#94e2d5", bg = "#94e2d5" }
|
||||
marker_selected = { fg = "#f9e2af", bg = "#f9e2af" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#1e1e2e", bg = "#a6e3a1" }
|
||||
count_cut = { fg = "#1e1e2e", bg = "#f38ba8" }
|
||||
count_selected = { fg = "#1e1e2e", bg = "#f9e2af" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#7f849c" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
|
||||
inactive = { fg = "#89b4fa", bg = "#313244" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
|
||||
normal_main = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
|
||||
normal_alt = { fg = "#89b4fa", bg = "#313244" }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#1e1e2e", bg = "#94e2d5", bold = true }
|
||||
select_alt = { fg = "#94e2d5", bg = "#313244" }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true }
|
||||
unset_alt = { fg = "#f2cdcd", bg = "#313244" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status bar {{{
|
||||
|
||||
[status]
|
||||
# Permissions
|
||||
perm_sep = { fg = "#7f849c" }
|
||||
perm_type = { fg = "#89b4fa" }
|
||||
perm_read = { fg = "#f9e2af" }
|
||||
perm_write = { fg = "#f38ba8" }
|
||||
perm_exec = { fg = "#a6e3a1" }
|
||||
|
||||
# Progress
|
||||
progress_label = { fg = "#ffffff", bold = true }
|
||||
progress_normal = { fg = "#a6e3a1", bg = "#45475a" }
|
||||
progress_error = { fg = "#f9e2af", bg = "#f38ba8" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Pick {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#89b4fa" }
|
||||
active = { fg = "#f5c2e7", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#89b4fa" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#89b4fa" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tasks {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#89b4fa" }
|
||||
title = {}
|
||||
hovered = { fg = "#f5c2e7", bold = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
mask = { bg = "#313244" }
|
||||
cand = { fg = "#94e2d5" }
|
||||
rest = { fg = "#9399b2" }
|
||||
desc = { fg = "#f5c2e7" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#585b70" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#94e2d5" }
|
||||
run = { fg = "#f5c2e7" }
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#313244", bg = "#cdd6f4" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#89b4fa" }
|
||||
title = { fg = "#89b4fa" }
|
||||
tbl_col = { fg = "#94e2d5" }
|
||||
tbl_cell = { fg = "#f5c2e7", bg = "#45475a" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notification {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#a6e3a1" }
|
||||
title_warn = { fg = "#f9e2af" }
|
||||
title_error = { fg = "#f38ba8" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
|
||||
rules = [
|
||||
# Image
|
||||
{ mime = "image/*", fg = "#94e2d5" },
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#f9e2af" },
|
||||
# Archive
|
||||
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#f5c2e7" },
|
||||
# Document
|
||||
{ mime = "application/{pdf,doc,rtf}", fg = "#a6e3a1" },
|
||||
# Virtual file system
|
||||
{ mime = "vfs/{absent,stale}", fg = "#9399b2" },
|
||||
# Fallback
|
||||
{ url = "*", fg = "#cdd6f4" },
|
||||
{ url = "*/", fg = "#89b4fa" },
|
||||
# TODO: remove
|
||||
{ name = "*", fg = "#cdd6f4" },
|
||||
{ name = "*/", fg = "#89b4fa" }
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
Before Width: | Height: | Size: 660 KiB |
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Chromium Oxide
|
||||
|
||||
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.
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Mitchell Hanberg
|
||||
|
||||
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.
|
||||
@@ -1,45 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Example Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
```bash
|
||||
ya pkg add Chromium-3-Oxide/everforest-medium
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```bash
|
||||
ya pack -a Chromium-3-Oxide/everforest-medium
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Add the these lines to your `theme.toml` configuration file to use it:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "everforest-medium"
|
||||
```
|
||||
|
||||
For Yazi versions before 0.4:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
use = "everforest-medium"
|
||||
```
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,229 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#7fbbb3" }
|
||||
|
||||
# Hovered
|
||||
hovered = { reversed = true }
|
||||
preview_hovered = { underline = true }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#dbbc7f", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#d699b6", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Symlink
|
||||
symlink_target = { italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#a7c080", bg = "#a7c080" }
|
||||
marker_cut = { fg = "#e67e80", bg = "#e67e80" }
|
||||
marker_marked = { fg = "#7fbbb3", bg = "#7fbbb3" }
|
||||
marker_selected = { fg = "#dbbc7f", bg = "#dbbc7f" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#343f44", bg = "#a7c080" }
|
||||
count_cut = { fg = "#343f44", bg = "#e67e80" }
|
||||
count_selected = { fg = "#343f44", bg = "#dbbc7f" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#4f585e" }
|
||||
|
||||
# Highlighting
|
||||
syntect_theme = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { bg = "#7fbbb3", bold = true }
|
||||
inactive = { fg = "#7fbbb3", bg = "#4f585e" }
|
||||
|
||||
# Separator
|
||||
sep_inner = { open = "", close = "" }
|
||||
sep_outer = { open = "", close = "" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
normal_main = { fg = "#3d484d", bg = "#a7c080", bold = true }
|
||||
normal_alt = { fg = "#7fbbb3", bg = "#4f585e", bold = true }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#3d484d", bg = "#e67e80", bold = true }
|
||||
select_alt = { fg = "#7fbbb3", bg = "#4f585e", bold = true }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#3d484d", bg = "#7fbbb3", bold = true }
|
||||
unset_alt = { fg = "#7fbbb3", bg = "#4f585e", bold = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status bar {{{
|
||||
|
||||
[status]
|
||||
overall = {}
|
||||
sep_left = { open = "", close = "" }
|
||||
sep_right = { open = "", close = "" }
|
||||
|
||||
# Permissions
|
||||
permissions_s = { fg = "#2d353b" }
|
||||
permissions_t = { fg = "#a7c080" }
|
||||
permissions_r = { fg = "#dbbc7f" }
|
||||
permissions_w = { fg = "#e67e80" }
|
||||
permissions_x = { fg = "#7fbbb3" }
|
||||
|
||||
# Progress
|
||||
progress_label = { bold = true }
|
||||
progress_normal = { fg = "#7fbbb3", bg = "#232a2e" }
|
||||
progress_error = { fg = "#e67e80", bg = "#232a2e" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
cols = 3
|
||||
mask = { bg = "#2d353b" }
|
||||
cand = { fg = "#7fbbb3" }
|
||||
rest = { fg = "#2d353b" }
|
||||
desc = { fg = "#d699b6" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#2d353b" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Confirmation {{{
|
||||
|
||||
[confirm]
|
||||
border = { fg = "#7fbbb3" }
|
||||
title = { fg = "#7fbbb3" }
|
||||
body = {}
|
||||
list = {}
|
||||
btn_yes = { reversed = true }
|
||||
btn_no = {}
|
||||
btn_labels = [ " [Y]es ", " (N)o " ]
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#7fbbb3" }
|
||||
title = { fg = "#7fbbb3" }
|
||||
|
||||
# Table
|
||||
tbl_col = { fg = "#7fbbb3" }
|
||||
tbl_cell = { fg = "#dbbc7f", reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notification {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#a7c080" }
|
||||
title_warn = { fg = "#dbbc7f" }
|
||||
title_error = { fg = "#e67e80" }
|
||||
|
||||
# Icons
|
||||
icon_info = ""
|
||||
icon_warn = ""
|
||||
icon_error = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Picker {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#7fbbb3" }
|
||||
active = { fg = "#d699b6", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#7fbbb3" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#7fbbb3" }
|
||||
active = { reversed = true }
|
||||
inactive = {}
|
||||
|
||||
# Icons
|
||||
icon_file = ""
|
||||
icon_folder = ""
|
||||
icon_command = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Task manager {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#7fbbb3" }
|
||||
title = {}
|
||||
hovered = { fg = "#d699b6", underline = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help menu {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#7fbbb3" }
|
||||
run = { fg = "#d699b6" }
|
||||
desc = {}
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#2d353b", bg = "#d3c6aa" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "#7fbbb3" },
|
||||
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#d699b6" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/*zip", fg = "#e67e80" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#e67e80" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#7fbbb3" },
|
||||
|
||||
# Fallback
|
||||
{ name = "*", fg = "#83c092" },
|
||||
{ name = "*/", fg = "#a7c080" }
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
Before Width: | Height: | Size: 77 KiB |
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Ben Yip
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Subhaditya Nath
|
||||
|
||||
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.
|
||||
@@ -1,32 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Gruvbox Dark Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="https://github.com/bennyyip/i/blob/main/yazi-gruvbox-dark.png?raw=true" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
```bash
|
||||
ya pkg add bennyyip/gruvbox-dark
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Add the these lines to your `theme.toml` configuration file to use it:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "gruvbox-dark"
|
||||
```
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,220 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#83a598" }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#b8bb26", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#fe8019", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Symlink
|
||||
symlink_target = { italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#8ec07c", bg = "#8ec07c" }
|
||||
marker_cut = { fg = "#d3869b", bg = "#d3869b" }
|
||||
marker_marked = { fg = "#83a598", bg = "#83a598" }
|
||||
marker_selected = { fg = "#fbf1c7", bg = "#fbf1c7" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#282828", bg = "#8ec07c" }
|
||||
count_cut = { fg = "#282828", bg = "#d3869b" }
|
||||
count_selected = { fg = "#282828", bg = "#fbf1c7" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#665c54" }
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#282828", bg = "#a89984" }
|
||||
inactive = { fg = "#a89984", bg = "#504945" }
|
||||
|
||||
# Separator
|
||||
sep_inner = { open = "", close = "" }
|
||||
sep_outer = { open = "", close = "" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
normal_main = { fg = "#282828", bg = "#a89984", bold = true }
|
||||
normal_alt = { fg = "#a89984", bg = "#504945" }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#282828", bg = "#fe8019", bold = true }
|
||||
select_alt = { fg = "#a89984", bg = "#504945" }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#282828", bg = "#b8bb26", bold = true }
|
||||
unset_alt = { fg = "#a89984", bg = "#504945" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Indicator of hovered file {{{
|
||||
|
||||
[indicator]
|
||||
parent = { reversed = true }
|
||||
current = { reversed = true }
|
||||
preview = { underline = true }
|
||||
padding = { open = "█", close = "█" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status {{{
|
||||
|
||||
[status]
|
||||
overall = { }
|
||||
sep_left = { open = "\ue0be", close = "\ue0b8" }
|
||||
sep_right = { open = "\ue0be", close = "\ue0b8" }
|
||||
# Permissions
|
||||
perm_sep = { fg = "#665c54" }
|
||||
perm_type = { fg = "#504945" }
|
||||
perm_read = { fg = "#b8bb26" }
|
||||
perm_write = { fg = "#fb4934" }
|
||||
perm_exec = { fg = "#b8bb26" }
|
||||
|
||||
# Progress
|
||||
progress_label = { fg = "#ebdbb2", bold = true }
|
||||
progress_normal = { fg = "#504945", bg = "#3c3836" }
|
||||
progress_error = { fg = "#fb4934", bg = "#3c3836" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
cols = 3
|
||||
mask = { bg = "#3c3836" }
|
||||
cand = { fg = "#83a598" }
|
||||
rest = { fg = "#928374" }
|
||||
desc = { fg = "#fe8019" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#504945" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Confirmation {{{
|
||||
|
||||
[confirm]
|
||||
border = { fg = "#a89984" }
|
||||
title = { fg = "#83a598" }
|
||||
body = { fg = "#fbf1c7" }
|
||||
list = { fg = "#ebdbb2" }
|
||||
btn_yes = { reversed = true, fg = "#ebdbb2" }
|
||||
btn_no = {}
|
||||
btn_labels = [ " [Y]es ", " (N)o " ]
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#83a598" }
|
||||
title = { fg = "#83a598" }
|
||||
|
||||
# Table
|
||||
tbl_col = { fg = "#83a598" }
|
||||
tbl_cell = { fg = "#fabd2f", reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notification {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#8ec07c" }
|
||||
title_warn = { fg = "#fbf1c7" }
|
||||
title_error = { fg = "#d3869b" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Picker {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#458588" }
|
||||
active = { fg = "#d3869b", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#ebdbb2" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#a89984" }
|
||||
active = { reversed = true, fg = "#83a598" }
|
||||
inactive = { fg = "#ebdbb2" }
|
||||
|
||||
|
||||
|
||||
# : Task manager {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#504945" }
|
||||
title = {}
|
||||
hovered = { underline = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#83a598" }
|
||||
run = { fg = "#d3869b" }
|
||||
desc = {}
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#3c3836", bg = "#a89984" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "#d3869b" },
|
||||
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#fabd2f" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/*zip", fg = "#fb4934" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#fb4934" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#689d6a" },
|
||||
|
||||
# Fallback
|
||||
{ url = "*", fg = "#ebdbb2" },
|
||||
{ url = "*/", fg = "#83a598" },
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
placeholder
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 - Matthew Dong
|
||||
|
||||
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.
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,42 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Gruvbox Material Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||

|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
### Using package manager
|
||||
|
||||
```bash
|
||||
ya pkg add matt-dong-123/gruvbox-material
|
||||
```
|
||||
|
||||
### Manual install
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
git clone https://github.com/your-username/gruvbox-material.yazi.git ~/.config/yazi/flavors/gruvbox-material.yazi
|
||||
|
||||
# Windows
|
||||
git clone https://github.com/your-username/gruvbox-material.yazi.git %AppData%\yazi\config\flavors\gruvbox-material.yazi
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Add the these lines to your `theme.toml` configuration file to use it:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "gruvbox-material"
|
||||
```
|
||||
|
||||
## 📜 License
|
||||
|
||||
Check the [LICENSE](LICENSE) file for more details.
|
||||
@@ -1,214 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#89b482" }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#d8a657", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#d3869b", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#a9b665", bg = "#a9b665" }
|
||||
marker_cut = { fg = "#ea6962", bg = "#ea6962" }
|
||||
marker_marked = { fg = "#89b482", bg = "#89b482" }
|
||||
marker_selected = { fg = "#d8a657", bg = "#d8a657" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#282828", bg = "#a9b665" }
|
||||
count_cut = { fg = "#282828", bg = "#ea6962" }
|
||||
count_selected = { fg = "#282828", bg = "#d8a657" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#928374" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#282828", bg = "#7daea3", bold = true }
|
||||
inactive = { fg = "#7daea3", bg = "#32302f" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
|
||||
normal_main = { fg = "#282828", bg = "#7daea3", bold = true }
|
||||
normal_alt = { fg = "#7daea3", bg = "#32302f" }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#282828", bg = "#89b482", bold = true }
|
||||
select_alt = { fg = "#89b482", bg = "#32302f" }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#282828", bg = "#ea6962", bold = true }
|
||||
unset_alt = { fg = "#ea6962", bg = "#32302f" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status bar {{{
|
||||
|
||||
[status]
|
||||
# Permissions
|
||||
perm_sep = { fg = "#928374" }
|
||||
perm_type = { fg = "#7daea3" }
|
||||
perm_read = { fg = "#d8a657" }
|
||||
perm_write = { fg = "#ea6962" }
|
||||
perm_exec = { fg = "#a9b665" }
|
||||
|
||||
# Progress
|
||||
progress_label = { fg = "#ddc7a1", bold = true }
|
||||
progress_normal = { fg = "#a9b665", bg = "#45403d" }
|
||||
progress_error = { fg = "#d8a657", bg = "#ea6962" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Pick {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#7daea3" }
|
||||
active = { fg = "#d3869b", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#7daea3" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#7daea3" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tasks {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#7daea3" }
|
||||
title = {}
|
||||
hovered = { fg = "#d3869b", bold = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
mask = { bg = "#32302f" }
|
||||
cand = { fg = "#89b482" }
|
||||
rest = { fg = "#a89984" }
|
||||
desc = { fg = "#d3869b" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#7c6f64" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#89b482" }
|
||||
run = { fg = "#d3869b" }
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#32302f", bg = "#d4be98" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#7daea3" }
|
||||
title = { fg = "#7daea3" }
|
||||
tbl_col = { fg = "#89b482" }
|
||||
tbl_cell = { fg = "#d3869b", bg = "#45403d" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notification {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#a9b665" }
|
||||
title_warn = { fg = "#d8a657" }
|
||||
title_error = { fg = "#ea6962" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
|
||||
rules = [
|
||||
# Image
|
||||
{ mime = "image/*", fg = "#89b482" },
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#d8a657" },
|
||||
# Archive
|
||||
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#d3869b" },
|
||||
# Document
|
||||
{ mime = "application/{pdf,doc,rtf}", fg = "#a9b665" },
|
||||
# Virtual file system
|
||||
{ mime = "vfs/{absent,stale}", fg = "#a89984" },
|
||||
# Fallback
|
||||
{ url = "*", fg = "#d4be98" },
|
||||
{ url = "*/", fg = "#7daea3" },
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
||||
[icon]
|
||||
|
||||
dirs = [
|
||||
{ name = ".config", text = "", fg = "#d3869b" },
|
||||
{ name = ".git", text = "", fg = "#89b482" },
|
||||
{ name = ".github", text = "", fg = "#7daea3" },
|
||||
{ name = ".npm", text = "", fg = "#7daea3" },
|
||||
{ name = "Desktop", text = "", fg = "#89b482" },
|
||||
{ name = "Development", text = "", fg = "#89b482" },
|
||||
{ name = "Documents", text = "", fg = "#89b482" },
|
||||
{ name = "Downloads", text = "", fg = "#89b482" },
|
||||
{ name = "Library", text = "", fg = "#89b482" },
|
||||
{ name = "Movies", text = "", fg = "#89b482" },
|
||||
{ name = "Music", text = "", fg = "#89b482" },
|
||||
{ name = "Pictures", text = "", fg = "#89b482" },
|
||||
{ name = "Public", text = "", fg = "#89b482" },
|
||||
{ name = "Videos", text = "", fg = "#89b482" },
|
||||
]
|
||||
conds = [
|
||||
# Special files
|
||||
{ if = "orphan", text = "", fg = "#d4be98" },
|
||||
{ if = "link", text = "", fg = "#928374" },
|
||||
{ if = "block", text = "", fg = "#ea6962" },
|
||||
{ if = "char", text = "", fg = "#ea6962" },
|
||||
{ if = "fifo", text = "", fg = "#ea6962" },
|
||||
{ if = "sock", text = "", fg = "#ea6962" },
|
||||
{ if = "sticky", text = "", fg = "#ea6962" },
|
||||
{ if = "dummy", text = "", fg = "#ea6962" },
|
||||
|
||||
# Fallback
|
||||
{ if = "dir", text = "", fg = "#7daea3" },
|
||||
{ if = "exec", text = "", fg = "#a9b665" },
|
||||
{ if = "!dir", text = "", fg = "#d4be98" },
|
||||
]
|
||||
|
Before Width: | Height: | Size: 226 KiB |
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Dmitry Nefedov
|
||||
|
||||
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.
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Dmitry Nefedov
|
||||
|
||||
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.
|
||||
@@ -1,36 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Kanagawa Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
```bash
|
||||
ya pkg add dangooddd/kanagawa
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
> [!Note]
|
||||
> To achieve the look like in the screenshot you also need to install
|
||||
> [full-border](https://github.com/yazi-rs/plugins/tree/main/full-border.yazi) plugin!
|
||||
|
||||
Add these lines to your `theme.toml` configuration file to use it:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "kanagawa"
|
||||
```
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,143 +0,0 @@
|
||||
## Color palette
|
||||
## Check https://github.com/rebelot/kanagawa.nvim for more details
|
||||
# sumiInk0 "#16161d" dark bg
|
||||
# sumiInk3 "#1f1f28" bg
|
||||
# sumiInk4 "#2a2a37"
|
||||
# sumiInk6 "#54546d"
|
||||
# fujiWhite "#dcd7ba" fg
|
||||
# oldWhite "#c8c093" dark fg
|
||||
# fujiGray "#727169"
|
||||
# peachRed "#ff5d62"
|
||||
# autumnRed "#c34043"
|
||||
# crystalBlue "#7e9cd8"
|
||||
# waveRed "#e46876"
|
||||
# carpYellow "#e6c384"
|
||||
# springGreen "#98bb6c"
|
||||
# autumnGreen "#76946a"
|
||||
# oniViolet "#957fb8"
|
||||
# waveAqua1 "#6a9589"
|
||||
# surimiOrange "#ffa066"
|
||||
# waveAqua2 "#7aa89f"
|
||||
|
||||
[mgr]
|
||||
marker_copied = { fg = "#98bb6c", bg = "#98bb6c" }
|
||||
marker_cut = { fg = "#e46876", bg = "#e46876" }
|
||||
marker_marked = { fg = "#957fb8", bg = "#957fb8" }
|
||||
marker_selected = { fg = "#ffa066", bg = "#ffa066" }
|
||||
|
||||
cwd = { fg = "#e6c384" }
|
||||
|
||||
find_keyword = { fg = "#ffa066", bg = "#1f1f28" }
|
||||
find_position = {}
|
||||
|
||||
count_copied = { fg = "#1f1f28", bg = "#98bb6c" }
|
||||
count_cut = { fg = "#1f1f28", bg = "#e46876" }
|
||||
count_selected = { fg = "#1f1f28", bg = "#ffa066" }
|
||||
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#dcd7ba" }
|
||||
|
||||
[indicator]
|
||||
parent = { reversed = true }
|
||||
current = { reversed = true }
|
||||
preview = { reversed = true }
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#1f1f28", bg = "#7e9cd8" }
|
||||
inactive = { fg = "#7e9cd8", bg = "#2a2a37" }
|
||||
|
||||
sep_inner = { open = "", close = "" }
|
||||
sep_outer = { open = "", close = "" }
|
||||
|
||||
|
||||
[mode]
|
||||
normal_main = { fg = "#1f1f28", bg = "#7e9cd8" }
|
||||
normal_alt = { fg = "#7e9cd8", bg = "#2a2a37" }
|
||||
select_main = { fg = "#1f1f28", bg = "#957fb8" }
|
||||
select_alt = { fg = "#957fb8", bg = "#2a2a37" }
|
||||
unset_main = { fg = "#1f1f28", bg = "#e6c384" }
|
||||
unset_alt = { fg = "#e6c384", bg = "#2a2a37" }
|
||||
|
||||
|
||||
[status]
|
||||
sep_left = { open = "", close = "" }
|
||||
sep_right = { open = "", close = "" }
|
||||
overall = { fg = "#c8c093", bg = "#16161d" }
|
||||
|
||||
progress_label = { fg = "#7e9cd8", bold = true }
|
||||
progress_normal = { fg = "#2a2a37", bg = "#1f1f28" }
|
||||
progress_error = { fg = "#2a2a37", bg = "#1f1f28" }
|
||||
|
||||
perm_type = { fg = "#98bb6c" }
|
||||
perm_read = { fg = "#e6c384" }
|
||||
perm_write = { fg = "#ff5d62" }
|
||||
perm_exec = { fg = "#7aa89f" }
|
||||
perm_sep = { fg = "#957fb8" }
|
||||
|
||||
|
||||
[pick]
|
||||
border = { fg = "#7fb4ca" }
|
||||
active = { fg = "#957fb8", bold = true }
|
||||
inactive = {}
|
||||
|
||||
[input]
|
||||
border = { fg = "#7fb4ca" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
[completion]
|
||||
border = { fg = "#7fb4ca" }
|
||||
active = { reversed = true }
|
||||
inactive = {}
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#7fb4ca" }
|
||||
title = {}
|
||||
hovered = { fg = "#957fb8" }
|
||||
|
||||
[which]
|
||||
cols = 2
|
||||
separator = " - "
|
||||
separator_style = { fg = "#727169" }
|
||||
mask = { bg = "#16161d" }
|
||||
rest = { fg = "#727169" }
|
||||
cand = { fg = "#7e9cd8" }
|
||||
desc = { fg = "#54546d" }
|
||||
|
||||
[help]
|
||||
on = { fg = "#7aa89f" }
|
||||
run = { fg = "#957fb8" }
|
||||
desc = {}
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#1f1f28", bg = "#dcd7ba" }
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#98bb6c" }
|
||||
title_warn = { fg = "#e6c384" }
|
||||
title_error = { fg = "#ff5d62" }
|
||||
|
||||
[filetype]
|
||||
rules = [
|
||||
# images
|
||||
{ mime = "image/*", fg = "#e6c384" },
|
||||
|
||||
# media
|
||||
{ mime = "{audio,video}/*", fg = "#957fb8" },
|
||||
|
||||
# archives
|
||||
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#e46876" },
|
||||
|
||||
# documents
|
||||
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#6a9589" },
|
||||
|
||||
# broken links
|
||||
{ url = "*", is = "orphan", fg = "#c34043" },
|
||||
|
||||
# executables
|
||||
{ url = "*", is = "exec", fg = "#76946a" },
|
||||
|
||||
# fallback
|
||||
{ url = "*", fg = "#dcd7ba" },
|
||||
{ url = "*/", fg = "#7e9cd8" },
|
||||
]
|
||||
|
Before Width: | Height: | Size: 163 KiB |
@@ -1,448 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Kanagawa</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#1F1F28</string>
|
||||
<key>caret</key>
|
||||
<string>#C8C093</string>
|
||||
<key>foreground</key>
|
||||
<string>#DCD7BA</string>
|
||||
<key>invisibles</key>
|
||||
<string>#54546D</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#2D4F67</string>
|
||||
<key>selection</key>
|
||||
<string>#2D4F67</string>
|
||||
<key>findHighlight</key>
|
||||
<string>#2D4F67</string>
|
||||
<key>selectionBorder</key>
|
||||
<string>#222218</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#54546D</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comment</string>
|
||||
<key>scope</key>
|
||||
<string>comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#727169</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>String</string>
|
||||
<key>scope</key>
|
||||
<string>string</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#98BB6C</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Number</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#D27E99</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Built-in constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.language</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#FFA066</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>User-defined constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character, constant.other</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6C384</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variable</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>#E6C384</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Ruby's @variable</string>
|
||||
<key>scope</key>
|
||||
<string>variable.other.readwrite.instance</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#E6C384</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>String interpolation</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character.escaped, constant.character.escape, string source, string source.ruby</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#C0A36E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keyword</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E46876</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#957FB8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage type</string>
|
||||
<key>scope</key>
|
||||
<string>storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#957FB8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Class name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#7AA89F</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inherited class</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#7AA89F</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#7E9CD8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function argument</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#b8b4d0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#7FB4CA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag attribute</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#E6C384</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library function</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#7FB4CA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library constant</string>
|
||||
<key>scope</key>
|
||||
<string>support.constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#7FB4CA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library class/type</string>
|
||||
<key>scope</key>
|
||||
<string>support.type, support.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#7AA89F</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library variable</string>
|
||||
<key>scope</key>
|
||||
<string>support.other.variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#FFA066</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
<string>invalid</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string/>
|
||||
<key>foreground</key>
|
||||
<string>#FF5D62</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.deprecated</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#717C7C</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
<string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#957FB8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.header</string>
|
||||
<key>scope</key>
|
||||
<string>meta.diff, meta.diff.header</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#7E9CD8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.deleted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.deleted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#43242B</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.inserted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.inserted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#2B3328</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.changed</string>
|
||||
<key>scope</key>
|
||||
<string>markup.changed</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#49443C</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric.line-number.find-in-files - match</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#54546D</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>entity.name.filename</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#C8C093</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>message.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E82424</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>JSON Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string.begin.json - meta.structure.dictionary.value.json, punctuation.definition.string.end.json - meta.structure.dictionary.value.json</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#9CABCA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>JSON Structure</string>
|
||||
<key>scope</key>
|
||||
<string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#957FB8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
<string>meta.structure.dictionary.value.json string.quoted.double.json</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#ffffff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Escape Characters</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character.escape</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#FF5D62</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Regular Expressions</string>
|
||||
<key>scope</key>
|
||||
<string>string.regexp</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6C384</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>uuid</key>
|
||||
<string>592FC036-6BB7-4676-A2F5-2894D48C8E33</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>semanticClass</key>
|
||||
<string>theme.dark.kanagawa</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,37 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Monokai flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
|
||||
```sh
|
||||
ya pkg add malick-tammal/monokai
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Add it to your `theme.toml` as dark flavor:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "monokai"
|
||||
```
|
||||
|
||||
Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor.
|
||||
|
||||
See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details.
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,182 +0,0 @@
|
||||
#----------------------------------------------------------
|
||||
#-- HACK: Monokai
|
||||
#----------------------------------------------------------
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#78DCE8" }
|
||||
|
||||
# Hovered
|
||||
hovered = { reversed = true }
|
||||
preview_hovered = { underline = true }
|
||||
|
||||
# Find
|
||||
find_symbol = " Finding: "
|
||||
find_keyword = { fg = "#FF6188", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#AB9DF2", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Symlink
|
||||
symlink_target = { fg = "#78DCE8", italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#A9DC76", bg = "#A9DC76" }
|
||||
marker_cut = { fg = "lightred", bg = "lightred" }
|
||||
marker_marked = { fg = "#AB9DF2", bg = "#AB9DF2" }
|
||||
marker_selected = { fg = "#FF6188", bg = "#FF6188" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#221F22", bg = "#A9DC76" }
|
||||
count_cut = { fg = "#221F22", bg = "#FF6188" }
|
||||
count_selected = { fg = "#221F22", bg = "#FFD866" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#727072" }
|
||||
|
||||
# Tabs
|
||||
[tabs]
|
||||
active = { fg = "#221F22", bg = "#FFD866", bold = true }
|
||||
inactive = { fg = "#FFD866", bg = "#221F22" }
|
||||
|
||||
# Separator
|
||||
sep_inner = { open = "", close = "" }
|
||||
sep_outer = { open = "", close = "" }
|
||||
|
||||
# Modes
|
||||
[mode]
|
||||
# Normal mode
|
||||
normal_main = { fg = "#2D2A2E", bg = "#FFD866", bold = true }
|
||||
normal_alt = { fg = "#FFD866", bg = "#403E41" }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#2D2A2E", bg = "#AB9DF2", bold = true }
|
||||
select_alt = { fg = "#AB9DF2", bg = "#403E41" }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { bg = "#FF6188", bold = true }
|
||||
unset_alt = { fg = "#FF6188", bg = "gray" }
|
||||
|
||||
# Status bar
|
||||
[status]
|
||||
overall = {}
|
||||
sep_left = { open = "", close = "" }
|
||||
sep_right = { open = "", close = "" }
|
||||
|
||||
# Permissions
|
||||
perm_sep = { fg = "#727072" }
|
||||
perm_type = { fg = "#A9DC76" }
|
||||
perm_read = { fg = "#FFD866" }
|
||||
perm_write = { fg = "#FF6188" }
|
||||
perm_exec = { fg = "#78DCE8" }
|
||||
|
||||
# Progress
|
||||
progress_label = { bold = true }
|
||||
progress_normal = { fg = "#78DCE8", bg = "#2D2A2E" }
|
||||
progress_error = { fg = "#FF6188", bg = "#2D2A2E" }
|
||||
|
||||
# Which
|
||||
[which]
|
||||
cols = 3
|
||||
mask = { bg = "#2D2A2E" }
|
||||
cand = { fg = "lightcyan" }
|
||||
rest = { fg = "#727072" }
|
||||
desc = { fg = "lightmagenta" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#727072" }
|
||||
|
||||
# Confirmation
|
||||
[confirm]
|
||||
border = { fg = "#FFD866" }
|
||||
title = { fg = "#FFD866" }
|
||||
content = {}
|
||||
list = {}
|
||||
btn_yes = { reversed = true }
|
||||
btn_no = {}
|
||||
btn_labels = [" [Y]es ", " (N)o "]
|
||||
|
||||
# Spotter
|
||||
[spot]
|
||||
border = { fg = "#78DCE8" }
|
||||
title = { fg = "#78DCE8" }
|
||||
|
||||
# Table
|
||||
tbl_col = { fg = "#78DCE8" }
|
||||
tbl_cell = { fg = "#FFD866", reversed = true }
|
||||
|
||||
# Norifications
|
||||
[notify]
|
||||
title_info = { fg = "#A9DC76" }
|
||||
title_warn = { fg = "#FFD866" }
|
||||
title_error = { fg = "#FF6188" }
|
||||
|
||||
# Icons
|
||||
icon_info = ""
|
||||
icon_warn = ""
|
||||
icon_error = ""
|
||||
|
||||
# Picker
|
||||
[pick]
|
||||
border = { fg = "#78DCE8" }
|
||||
active = { fg = "#AB9DF2", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# Input
|
||||
[input]
|
||||
border = { fg = "#78DCE8" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# Completion
|
||||
[cmp]
|
||||
border = { fg = "#78DCE8" }
|
||||
active = { reversed = true }
|
||||
inactive = {}
|
||||
|
||||
# Icons
|
||||
icon_file = ""
|
||||
icon_folder = ""
|
||||
icon_command = ""
|
||||
|
||||
# : Task manager {{{
|
||||
[tasks]
|
||||
border = { fg = "#78DCE8" }
|
||||
title = {}
|
||||
hovered = { fg = "#AB9DF2", underline = true }
|
||||
|
||||
# Help menu
|
||||
[help]
|
||||
on = { fg = "#78DCE8" }
|
||||
run = { fg = "#AB9DF2" }
|
||||
desc = {}
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#221F22", bg = "#FDFFF1" }
|
||||
|
||||
# File-specific styles
|
||||
[filetype]
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "#FFD866" },
|
||||
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#A9DC76" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#FF6188" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf}", fg = "#78DCE8" },
|
||||
|
||||
# Empty files
|
||||
{ mime = "inode/empty", fg = "#FF6188" },
|
||||
|
||||
# Special files
|
||||
{ url = "*", is = "orphan", bg = "#FF6188" },
|
||||
{ url = "*", is = "exec", fg = "#A9DC76" },
|
||||
|
||||
# Dummy files
|
||||
{ url = "*", is = "dummy", bg = "#FF6188" },
|
||||
{ url = "*/", is = "dummy", bg = "#FF6188" },
|
||||
|
||||
# Fallback
|
||||
{ url = "*/", fg = "#FC9767", bold = true },
|
||||
]
|
||||
|
Before Width: | Height: | Size: 797 KiB |
@@ -1,300 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>gutterSettings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#49483E</string>
|
||||
<key>divider</key>
|
||||
<string>#75715E</string>
|
||||
<key>foreground</key>
|
||||
<string>#75715E</string>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>Monokai</string>
|
||||
<key>semanticClass</key>
|
||||
<string>theme.dark.monokai</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#272822</string>
|
||||
<key>caret</key>
|
||||
<string>#F8F8F0</string>
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F2</string>
|
||||
<key>invisibles</key>
|
||||
<string>#49483E</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#49483E</string>
|
||||
<key>selection</key>
|
||||
<string>#49483E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comment</string>
|
||||
<key>scope</key>
|
||||
<string>comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#75715E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>String</string>
|
||||
<key>scope</key>
|
||||
<string>string</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6DB74</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Number</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Built-in constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.language</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>User-defined constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character, constant.other</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variable</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keyword</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage type</string>
|
||||
<key>scope</key>
|
||||
<string>storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Class name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>underline</string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inherited class</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic underline</string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function argument</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#FD971F</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag attribute</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library function</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library constant</string>
|
||||
<key>scope</key>
|
||||
<string>support.constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library class/type</string>
|
||||
<key>scope</key>
|
||||
<string>support.type, support.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library variable</string>
|
||||
<key>scope</key>
|
||||
<string>support.other.variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
<string>invalid</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#F92672</string>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.deprecated</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#AE81FF</string>
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>uuid</key>
|
||||
<string>D8D5E82E-3D5B-46B5-B38E-8C841C21347D</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Mintass
|
||||
|
||||
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.
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Rosé Pine
|
||||
|
||||
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.
|
||||
@@ -1,36 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Rosé Pine Moon Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
```sh
|
||||
ya pkg add Mintass/rose-pine-moon
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
To set it as your dark flavor, change the content of your `theme.toml` to:
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
dark = "rose-pine-moon"
|
||||
```
|
||||
|
||||
Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor.
|
||||
|
||||
See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details.
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,253 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : App {{{
|
||||
|
||||
[app]
|
||||
overall = { bg = "#232136" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#9ccfd8" }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#f6c177", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#c4a7e7", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Symlink
|
||||
symlink_target = { italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#3e8fb0", bg = "#3e8fb0" }
|
||||
marker_cut = { fg = "#eb6f92", bg = "#eb6f92" }
|
||||
marker_marked = { fg = "#ea9a97", bg = "#ea9a97" }
|
||||
marker_selected = { fg = "#f6c177", bg = "#f6c177" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#e0def4", bg = "#3e8fb0" }
|
||||
count_cut = { fg = "#e0def4", bg = "#eb6f92" }
|
||||
count_selected = { fg = "#232136", bg = "#f6c177" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#56526e" }
|
||||
|
||||
# Highlighting
|
||||
syntect_theme = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#e0def4", bg = "#3e8fb0", bold = true }
|
||||
inactive = { fg = "#3e8fb0", bg = "#e0def4" }
|
||||
|
||||
# Separator
|
||||
sep_inner = { open = "", close = "" }
|
||||
sep_outer = { open = "", close = "" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
normal_main = { fg = "#232136", bg = "#9ccfd8", bold = true }
|
||||
normal_alt = { fg = "#232136", bg = "#e0def4", bold = true }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#232136", bg = "#eb6f92", bold = true }
|
||||
select_alt = { fg = "#232136", bg = "#e0def4", bold = true }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#232136", bg = "#eb6f92", bold = true }
|
||||
unset_alt = { fg = "#232136", bg = "#e0def4", bold = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Indicator of hovered file {{{
|
||||
|
||||
[indicator]
|
||||
parent = { reversed = true }
|
||||
current = { reversed = true }
|
||||
preview = { underline = true }
|
||||
padding = { open = "", close = "" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status bar {{{
|
||||
|
||||
[status]
|
||||
overall = { bg = "#232136" }
|
||||
sep_left = { open = "", close = "" }
|
||||
sep_right = { open = "", close = "" }
|
||||
|
||||
# Permissions
|
||||
perm_sep = { fg = "#6e6a86" }
|
||||
perm_type = { fg = "#c4a7e7" }
|
||||
perm_read = { fg = "#f6c177" }
|
||||
perm_write = { fg = "#eb6f92" }
|
||||
perm_exec = { fg = "#9ccfd8" }
|
||||
|
||||
# Progress
|
||||
progress_label = { fg = "#e0def4", bold = true }
|
||||
progress_normal = { fg = "#3e8fb0", bg = "#2a283e" }
|
||||
progress_error = { fg = "#eb6f92", bg = "#2a283e" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
cols = 3
|
||||
mask = { bg = "#2a273f" }
|
||||
cand = { fg = "#9ccfd8" }
|
||||
rest = { fg = "#6e6a86" }
|
||||
desc = { fg = "#f6c177" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#6e6a86" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Confirmation {{{
|
||||
|
||||
[confirm]
|
||||
border = { fg = "#56526e" }
|
||||
title = { fg = "#eb6f92", bold = true }
|
||||
body = { fg = "#e0def4" }
|
||||
list = { fg = "#e0def4" }
|
||||
btn_yes = { fg = "#232136", bg = "#3e8fb0", bold = true }
|
||||
btn_no = { fg = "#232136", bg = "#e0def4", bold = true }
|
||||
btn_labels = [ " [y]es ", " (n)o " ]
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#56526e" }
|
||||
title = { fg = "#9ccfd8", bold = true }
|
||||
|
||||
# Table
|
||||
tbl_col = { fg = "#9ccfd8" }
|
||||
tbl_cell = { fg = "#232136", bg = "#f6c177", bold = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notification {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#3e8fb0" }
|
||||
title_warn = { fg = "#f6c177" }
|
||||
title_error = { fg = "#eb6f92" }
|
||||
|
||||
# Icons
|
||||
icon_info = ""
|
||||
icon_warn = ""
|
||||
icon_error = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Picker {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#3e8fb0" }
|
||||
active = { fg = "#c4a7e7", bold = true }
|
||||
inactive = { fg = "#908caa" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#3e8fb0" }
|
||||
title = { bold = true }
|
||||
value = { fg = "#e0def4" }
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#3e8fb0" }
|
||||
active = { bg = "#e0def4", fg = "#232136", bold = true }
|
||||
inactive = { fg = "#908caa" }
|
||||
|
||||
# Icons
|
||||
icon_file = ""
|
||||
icon_folder = ""
|
||||
icon_command = ""
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Task manager {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#3e8fb0" }
|
||||
title = { bold = true }
|
||||
hovered = { fg = "#c4a7e7", bold = true, reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help menu {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#9ccfd8" }
|
||||
run = { fg = "#c4a7e7" }
|
||||
desc = { fg = "#f6c177" }
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#232136", bg = "#e0def4" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "#c4a7e7" },
|
||||
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", fg = "#f6c177" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#eb6f92" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf}", fg = "#ea9a97" },
|
||||
|
||||
# Empty files
|
||||
# { mime = "inode/empty", fg = "#eb6f92" },
|
||||
|
||||
# Special files
|
||||
{ url = "*", is = "orphan", fg = "#232136", bg = "#eb6f92" },
|
||||
{ url = "*", is = "exec", fg = "#9ccfd8" },
|
||||
|
||||
# Dummy files
|
||||
{ url = "*", is = "dummy", fg = "#232136", bg = "#eb6f92" },
|
||||
{ url = "*/", is = "dummy", fg = "#232136", bg = "#eb6f92" },
|
||||
|
||||
# Fallback
|
||||
{ url = "*", fg = "#e0def4" },
|
||||
{ url = "*/", fg = "#3e8fb0" }
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
Before Width: | Height: | Size: 985 KiB |
@@ -1,316 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Rosé Pine Moon</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#232136</string>
|
||||
<key>caret</key>
|
||||
<string>#56526e</string>
|
||||
<key>foreground</key>
|
||||
<string>#e0def4</string>
|
||||
<key>invisibles</key>
|
||||
<string>#2a273f</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#2a283e</string>
|
||||
<key>selection</key>
|
||||
<string>#6e6a86</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comment</string>
|
||||
<key>scope</key>
|
||||
<string>comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#908caa</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>String</string>
|
||||
<key>scope</key>
|
||||
<string>string, punctuation.definition.string</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#f6c177</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Number</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#f6c177</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Built-in constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.language</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#f6c177</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>User-defined constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character, constant.other</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#f6c177</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variable</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#e0def4</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keyword</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#3e8fb0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#9ccfd8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage type</string>
|
||||
<key>scope</key>
|
||||
<string>storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#9ccfd8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Class name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#3e8fb0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inherited class</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic </string>
|
||||
<key>foreground</key>
|
||||
<string>#3e8fb0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#ea9a97</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function argument</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#c4a7e7</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#3e8fb0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag attribute</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#c4a7e7</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library function</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#ea9a97</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library constant</string>
|
||||
<key>scope</key>
|
||||
<string>support.constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#f6c177</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library class/type</string>
|
||||
<key>scope</key>
|
||||
<string>support.type, support.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#9ccfd8</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library variable</string>
|
||||
<key>scope</key>
|
||||
<string>support.other.variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#eb6f92</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
<string>invalid</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#eb6f92</string>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#e0def4</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.deprecated</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#c4a7e7</string>
|
||||
<key>foreground</key>
|
||||
<string>#e0def4</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation, Operators</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation, keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#908caa</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>semanticClass</key>
|
||||
<string>theme.dark.rosé-pine-moon</string>
|
||||
<key>author</key>
|
||||
<string>arrrgi</string>
|
||||
<key>comment</key>
|
||||
<string>All natural pine, faux fur and a bit of soho vibes for the classy minimalist</string>
|
||||
<key>uuid</key>
|
||||
<string>CC28B8FB-96BA-43EB-B71F-5AA3D3EBB0BB</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 - sxyazi
|
||||
|
||||
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.
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Himanshu
|
||||
|
||||
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.
|
||||
@@ -1,47 +0,0 @@
|
||||
<div align="center">
|
||||
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
|
||||
</div>
|
||||
|
||||
<h3 align="center">
|
||||
Tokyo Night Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
|
||||
</h3>
|
||||
|
||||
## 👀 Preview
|
||||
|
||||
<img src="preview.png" width="600" />
|
||||
|
||||
## 🎨 Installation
|
||||
|
||||
### Using package manager
|
||||
|
||||
```bash
|
||||
ya pkg add BennyOe/tokyo-night
|
||||
```
|
||||
|
||||
### Manual install
|
||||
|
||||
```bash
|
||||
# Linux/macOS
|
||||
git clone https://github.com/BennyOe/tokyo-night.yazi.git ~/.config/yazi/flavors/tokyo-night.yazi
|
||||
|
||||
# Windows
|
||||
git clone https://github.com/BennyOe/tokyo-night.yazi.git %AppData%\yazi\config\flavors\tokyo-night.yazi
|
||||
```
|
||||
|
||||
## ⚙️ Usage
|
||||
|
||||
Add the these lines to your `theme.toml` configuration file to use it:
|
||||
|
||||
|
||||
```toml
|
||||
[flavor]
|
||||
use = "tokyo-night"
|
||||
# For Yazi 0.4 and above
|
||||
dark = "tokyo-night"
|
||||
```
|
||||
|
||||
## 📜 License
|
||||
|
||||
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
|
||||
|
||||
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
|
||||
@@ -1,201 +0,0 @@
|
||||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# : Manager {{{
|
||||
|
||||
[mgr]
|
||||
cwd = { fg = "#7aa2f7" }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "#f7768e", bold = true, italic = true, underline = true }
|
||||
find_position = { fg = "#bb9af7", bg = "reset", bold = true, italic = true }
|
||||
|
||||
# Marker
|
||||
marker_copied = { fg = "#9ece6a", bg = "#9ece6a" }
|
||||
marker_cut = { fg = "#e0af68", bg = "#f7768e" }
|
||||
marker_marked = { fg = "#7aa2f7", bg = "#7dcfff" }
|
||||
marker_selected = { fg = "#e0af68", bg = "#e0af68" }
|
||||
|
||||
# Count
|
||||
count_copied = { fg = "#1a1b26", bg = "#9ece6a" }
|
||||
count_cut = { fg = "#1a1b26", bg = "#e0af68" }
|
||||
count_selected = { fg = "#1a1b26", bg = "#7aa2f7" }
|
||||
|
||||
# Border
|
||||
border_symbol = "│"
|
||||
border_style = { fg = "#414868" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#292e42", bg = "#7aa2f7", bold = true }
|
||||
inactive = { fg = "#7aa2f7", bg = "#292e42" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
|
||||
normal_main = { fg = "#292e42", bg = "#7aa2f7", bold = true }
|
||||
normal_alt = { fg = "#7aa2f7", bg = "#292e42" }
|
||||
|
||||
# Select mode
|
||||
select_main = { fg = "#292e42", bg = "#9ece6a", bold = true }
|
||||
select_alt = { fg = "#7aa2f7", bg = "#292e42" }
|
||||
|
||||
# Unset mode
|
||||
unset_main = { fg = "#292e42", bg = "#bb9af7", bold = true }
|
||||
unset_alt = { fg = "#7aa2f7", bg = "#292e42" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Status bar {{{
|
||||
|
||||
[status]
|
||||
overall = { fg = "#7aa2f7" }
|
||||
sep_left = { open = "", close = "" }
|
||||
sep_right = { open = "", close = "" }
|
||||
|
||||
|
||||
# Progress
|
||||
progress_label = { fg = "#292e42", bold = true }
|
||||
progress_normal = { fg = "#7aa2f7", bg = "#292e42" }
|
||||
progress_error = { fg = "#f7768e", bg = "#292e42" }
|
||||
|
||||
# Permissions
|
||||
perm_sep = { fg = "#7aa2f7" }
|
||||
perm_type = { fg = "#9ece6a" }
|
||||
perm_read = { fg = "#e0af68" }
|
||||
perm_write = { fg = "#f7768e" }
|
||||
perm_exec = { fg = "#bb9af7" }
|
||||
|
||||
|
||||
# : }}}
|
||||
|
||||
# : Pick {{{
|
||||
|
||||
[pick]
|
||||
border = { fg = "#7aa2f7" }
|
||||
active = { fg = "#bb9af7", bold = true }
|
||||
inactive = {}
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Input {{{
|
||||
|
||||
[input]
|
||||
border = { fg = "#7aa2f7" }
|
||||
title = {}
|
||||
value = {}
|
||||
selected = { reversed = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Completion {{{
|
||||
|
||||
[cmp]
|
||||
border = { fg = "#7aa2f7" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Tasks {{{
|
||||
|
||||
[tasks]
|
||||
border = { fg = "#7aa2f7" }
|
||||
title = {}
|
||||
hovered = { fg = "#bb9af7", underline = true }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Which {{{
|
||||
|
||||
[which]
|
||||
mask = { bg = "#414868" }
|
||||
cand = { fg = "#9ece6a" }
|
||||
rest = { fg = "#a9b1d6" }
|
||||
desc = { fg = "#bb9af7" }
|
||||
separator = " "
|
||||
separator_style = { fg = "#626880" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Help {{{
|
||||
|
||||
[help]
|
||||
on = { fg = "#9ece6a" }
|
||||
run = { fg = "#bb9af7" }
|
||||
hovered = { reversed = true, bold = true }
|
||||
footer = { fg = "#1a1b26", bg = "#a9b1d6" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Spotter {{{
|
||||
|
||||
[spot]
|
||||
border = { fg = "#7aa2f7" }
|
||||
title = { fg = "#7aa2f7" }
|
||||
tbl_col = { fg = "#9ece6a" }
|
||||
tbl_cell = { fg = "#bb9af7", bg = "#292e42" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Notify {{{
|
||||
|
||||
[notify]
|
||||
title_info = { fg = "#9ece6a" }
|
||||
title_warn = { fg = "#f7768e" }
|
||||
title_error = { fg = "#e0af68" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : File-specific styles {{{
|
||||
|
||||
[filetype]
|
||||
|
||||
rules = [
|
||||
# Images
|
||||
{ mime = "image/*", fg = "#e0af68" },
|
||||
|
||||
# Media
|
||||
{ mime = "video/*", fg = "#f7768e" },
|
||||
{ mime = "audio/*", fg = "#f7768e" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/zip", fg = "#bb9af7" },
|
||||
{ mime = "application/x-tar", fg = "#bb9af7" },
|
||||
{ mime = "application/x-bzip*", fg = "#bb9af7" },
|
||||
{ mime = "application/x-bzip2", fg = "#bb9af7" },
|
||||
{ mime = "application/x-7z-compressed", fg = "#bb9af7" },
|
||||
{ mime = "application/x-rar", fg = "#bb9af7" },
|
||||
{ mime = "application/x-xz", fg = "#bb9af7" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/doc", fg = "#9ece6a" },
|
||||
{ mime = "application/epub+zip", fg = "#9ece6a" },
|
||||
{ mime = "application/pdf", fg = "#9ece6a" },
|
||||
{ mime = "application/rtf", fg = "#9ece6a" },
|
||||
{ mime = "application/vnd.*", fg = "#9ece6a" },
|
||||
|
||||
# Special files
|
||||
{ mime = "*", is = "orphan", fg = "#f29cb4", bg = "#93000a" },
|
||||
{ mime = "application/*exec*", fg = "#f7768e" },
|
||||
|
||||
# Fallback
|
||||
{ url = "*", fg = "#c6d0f5" },
|
||||
{ url = "*/", fg = "#7aa2f7" },
|
||||
]
|
||||
|
||||
# : }}}
|
||||
|
Before Width: | Height: | Size: 712 KiB |
@@ -1,358 +0,0 @@
|
||||
-- Change this to switch themes
|
||||
-- local THEME = "kanagawa"
|
||||
-- local THEME = "catppuccin-mocha"
|
||||
-- local THEME = "everforest-medium"
|
||||
-- local THEME = "gruvbox-material"
|
||||
-- local THEME = "tokyo-night"
|
||||
local THEME = "rose_pine-moon"
|
||||
|
||||
-- local theme_colors = {
|
||||
-- rose_pine = {
|
||||
-- primary = "#c4a7e7", -- iris/mauve (purple-like color from rose-pine palette)
|
||||
-- secondary = "#6e6a86", -- muted/subtle (comparable to comment/gray colors)
|
||||
-- yanked = "#9ccfd8", -- foam (cyan-like accent color)
|
||||
-- cut = "#eb6f92", -- love (red-like accent color)
|
||||
-- },
|
||||
-- carbonfox = {
|
||||
-- primary = "#78a9ff",
|
||||
-- secondary = "#525252",
|
||||
-- yanked = "#3ddbd9",
|
||||
-- cut = "#ff7eb6",
|
||||
-- },
|
||||
-- kanagawa = {
|
||||
-- primary = "#7e9cd8",
|
||||
-- secondary = "#54546d",
|
||||
-- yanked = "#7aa89f",
|
||||
-- cut = "#e82424",
|
||||
-- },
|
||||
-- sonokai = {
|
||||
-- primary = "#76cce0",
|
||||
-- secondary = "#7f8490",
|
||||
-- yanked = "#fc5d7c",
|
||||
-- cut = "#f85e84",
|
||||
-- },
|
||||
-- catppuccin = {
|
||||
-- primary = "#89b4fa",
|
||||
-- secondary = "#6c7086",
|
||||
-- yanked = "#94e2d5",
|
||||
-- cut = "#f38ba8",
|
||||
-- },
|
||||
-- dracula = {
|
||||
-- primary = "#bd93f9", -- purple
|
||||
-- secondary = "#6272a4", -- comment
|
||||
-- yanked = "#8be9fd", -- cyan
|
||||
-- cut = "#ff5555", -- red
|
||||
-- },
|
||||
-- everforest = {
|
||||
-- primary = "#7fbbb3", -- aqua
|
||||
-- secondary = "#859289", -- gray
|
||||
-- yanked = "#a7c080", -- green
|
||||
-- cut = "#e67e80", -- red
|
||||
-- },
|
||||
-- gruvbox = {
|
||||
-- primary = "#7daea3", -- aqua
|
||||
-- secondary = "#7c6f64", -- gray
|
||||
-- yanked = "#a9b665", -- green
|
||||
-- cut = "#ea6962", -- red
|
||||
-- },
|
||||
-- nightfox = {
|
||||
-- primary = "#719cd6", -- blue
|
||||
-- secondary = "#738091", -- comment
|
||||
-- yanked = "#63cdcf", -- cyan
|
||||
-- cut = "#c94f6d", -- red
|
||||
-- },
|
||||
-- onedark = {
|
||||
-- primary = "#61afef", -- blue
|
||||
-- secondary = "#5c6370", -- gray
|
||||
-- yanked = "#56b6c2", -- cyan
|
||||
-- cut = "#e06c75", -- red
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- eocal c = theme_colors[THEME]
|
||||
|
||||
-- require("yaziline"):setup({
|
||||
-- color = c.primary,
|
||||
-- secondary_color = c.secondary,
|
||||
-- default_files_color = "darkgray",
|
||||
-- selected_files_color = "white",
|
||||
-- yanked_files_color = c.yanked,
|
||||
-- cut_files_color = c.cut,
|
||||
-- separator_style = "angly", -- "angly" | "curvy" | "liney" | "empty"
|
||||
-- separator_open = "",
|
||||
-- separator_close = "",
|
||||
-- separator_open_thin = "",
|
||||
-- separator_close_thin = "",
|
||||
-- separator_head = "",
|
||||
-- separator_tail = "",
|
||||
|
||||
-- select_symbol = "",
|
||||
-- yank_symbol = "",
|
||||
|
||||
-- filename_max_length = 24, -- truncate when filename > 24
|
||||
-- filename_truncate_length = 6, -- leave 6 chars on both sides
|
||||
-- filename_truncate_separator = "...",
|
||||
-- })
|
||||
|
||||
require("recycle-bin"):setup({
|
||||
trash_dir = "~/.local/share/Trash/",
|
||||
})
|
||||
|
||||
-- require("omp"):setup({ config = "/home/liph/.config/yazi/omp/omp.toml" })
|
||||
|
||||
require("mime-ext"):setup({
|
||||
-- with_files = {
|
||||
-- tex = "text/makefile",
|
||||
-- },
|
||||
|
||||
with_exts = {
|
||||
tex = "text/makefile",
|
||||
},
|
||||
})
|
||||
|
||||
require("full-border"):setup({
|
||||
type = ui.Border.ROUNDED,
|
||||
})
|
||||
|
||||
-- git-yazi plugin
|
||||
-- th.git = th.git or {}
|
||||
-- th.git.modified = ui.Style():fg("blue")
|
||||
-- th.git.deleted = ui.Style():fg("red"):bold()
|
||||
require("git"):setup()
|
||||
-- whoosh plugin
|
||||
-- You can configure your bookmarks using simplified syntax
|
||||
-- local bookmarks = {
|
||||
-- { tag = "Documents", path = "~/Documents", key = "D" },
|
||||
-- }
|
||||
|
||||
-- You can also configure bookmarks with key arrays
|
||||
-- local bookmarks = {
|
||||
-- { tag = "Desktop", path = "~/Desktop", key = { "d", "D" } },
|
||||
-- { tag = "Documents", path = "~/Documents", key = { "d", "d" } },
|
||||
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
|
||||
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
|
||||
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
|
||||
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
|
||||
-- { tag = "Downloads", path = "~/Downloads", key = "o" },
|
||||
-- }
|
||||
|
||||
require("whoosh"):setup({
|
||||
-- Configuration bookmarks (cannot be deleted through plugin)
|
||||
bookmarks = bookmarks,
|
||||
|
||||
-- Notification settings
|
||||
jump_notify = false,
|
||||
|
||||
-- Key generation for auto-assigning bookmark keys
|
||||
keys = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
|
||||
-- Configure the built-in menu action hotkeys
|
||||
-- false - hide menu item
|
||||
special_keys = {
|
||||
create_temp = "<Enter>", -- Create a temporary bookmark from the menu
|
||||
fuzzy_search = "<Space>", -- Launch fuzzy search (fzf)
|
||||
history = "<Tab>", -- Open directory history
|
||||
previous_dir = "<Backspace>", -- Jump back to the previous directory
|
||||
},
|
||||
|
||||
-- File path for storing user bookmarks
|
||||
bookmarks_path = (
|
||||
ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\plugins\\whoosh.yazi\\bookmarks"
|
||||
) or (os.getenv("HOME") .. "/.config/yazi/plugins/whoosh.yazi/bookmarks"),
|
||||
|
||||
-- Replace home directory with "~"
|
||||
home_alias_enabled = true, -- Toggle home aliasing in displays
|
||||
|
||||
-- Path truncation in navigation menu
|
||||
path_truncate_enabled = false, -- Enable/disable path truncation
|
||||
path_max_depth = 3, -- Maximum path depth before truncation
|
||||
|
||||
-- Path truncation in fuzzy search (fzf)
|
||||
fzf_path_truncate_enabled = false, -- Enable/disable path truncation in fzf
|
||||
fzf_path_max_depth = 5, -- Maximum path depth before truncation in fzf
|
||||
|
||||
-- Long folder name truncation
|
||||
path_truncate_long_names_enabled = false, -- Enable in navigation menu
|
||||
fzf_path_truncate_long_names_enabled = false, -- Enable in fzf
|
||||
path_max_folder_name_length = 20, -- Max length in navigation menu
|
||||
fzf_path_max_folder_name_length = 20, -- Max length in fzf
|
||||
|
||||
-- History directory settings
|
||||
history_size = 10, -- Number of directories in history (default 10)
|
||||
history_fzf_path_truncate_enabled = false, -- Enable/disable path truncation by depth for history
|
||||
history_fzf_path_max_depth = 5, -- Maximum path depth before truncation for history (default 5)
|
||||
history_fzf_path_truncate_long_names_enabled = false, -- Enable/disable long folder name truncation for history
|
||||
history_fzf_path_max_folder_name_length = 30, -- Maximum length for folder names in history (default 30)
|
||||
})
|
||||
|
||||
-- projetc plugin
|
||||
require("projects"):setup({
|
||||
event = {
|
||||
save = {
|
||||
enable = true,
|
||||
name = "project-saved",
|
||||
},
|
||||
load = {
|
||||
enable = true,
|
||||
name = "project-loaded",
|
||||
},
|
||||
delete = {
|
||||
enable = true,
|
||||
name = "project-deleted",
|
||||
},
|
||||
delete_all = {
|
||||
enable = true,
|
||||
name = "project-deleted-all",
|
||||
},
|
||||
merge = {
|
||||
enable = true,
|
||||
name = "project-merged",
|
||||
},
|
||||
},
|
||||
save = {
|
||||
method = "yazi", -- yazi | lua
|
||||
yazi_load_event = "@projects-load", -- event name when loading projects in `yazi` method
|
||||
lua_save_path = "", -- path of saved file in `lua` method, comment out or assign explicitly
|
||||
-- default value:
|
||||
-- windows: "%APPDATA%/yazi/state/projects.json"
|
||||
-- unix: "~/.local/state/yazi/projects.json"
|
||||
},
|
||||
last = {
|
||||
update_after_save = true,
|
||||
update_after_load = true,
|
||||
update_before_quit = false,
|
||||
load_after_start = false,
|
||||
},
|
||||
merge = {
|
||||
event = "projects-merge",
|
||||
quit_after_merge = false,
|
||||
},
|
||||
notify = {
|
||||
enable = true,
|
||||
title = "Projects",
|
||||
timeout = 3,
|
||||
level = "info",
|
||||
},
|
||||
})
|
||||
|
||||
-- yafg plugin
|
||||
require("yafg"):setup({
|
||||
editor = "nvim", -- Editor command (default: "hx")
|
||||
args = { "--noplugin" }, -- Additional editor arguments (default: {})
|
||||
file_arg_format = "+{row} {file}", -- File argument format (default: "{file}:{row}:{col}")
|
||||
})
|
||||
|
||||
require("simple-tag"):setup({
|
||||
-- UI display mode (icon, text, hidden)
|
||||
ui_mode = "icon", -- (Optional)
|
||||
|
||||
-- Disable tag key hints (popup in bottom right corner)
|
||||
hints_disabled = false, -- (Optional)
|
||||
|
||||
-- linemode order: adjusts icon/text position. For example, if you want icon to be on the most left of linemode then set linemode_order larger than 1000.
|
||||
-- More info: https://github.com/sxyazi/yazi/blob/077faacc9a84bb5a06c5a8185a71405b0cb3dc8a/yazi-plugin/preset/components/linemode.lua#L4-L5
|
||||
linemode_order = 500, -- (Optional)
|
||||
|
||||
-- You can backup/restore this folder within the same OS (Linux, windows, or MacOS).
|
||||
-- But you can't restore backed up folder in the different OS because they use difference absolute path.
|
||||
-- save_path = -- full path to save tags folder (Optional)
|
||||
-- - Linux/MacOS: os.getenv("HOME") .. "/.config/yazi/tags"
|
||||
-- - Windows: os.getenv("APPDATA") .. "\\yazi\\config\\tags"
|
||||
|
||||
-- Set tag colors
|
||||
colors = { -- (Optional)
|
||||
-- Set this same value with `theme.toml` > [mgr] > hovered > reversed
|
||||
-- Default theme use "reversed = true".
|
||||
-- More info: https://github.com/sxyazi/yazi/blob/077faacc9a84bb5a06c5a8185a71405b0cb3dc8a/yazi-config/preset/theme-dark.toml#L25
|
||||
reversed = true, -- (Optional)
|
||||
|
||||
-- More colors: https://yazi-rs.github.io/docs/configuration/theme#types.color
|
||||
-- format: [tag key] = "color"
|
||||
["*"] = "#bf68d9", -- (Optional)
|
||||
["$"] = "green",
|
||||
["!"] = "#cc9057",
|
||||
["1"] = "cyan",
|
||||
["p"] = "red",
|
||||
},
|
||||
|
||||
-- Set tag icons. Only show when ui_mode = "icon".
|
||||
-- Any text or nerdfont icons should work as long as you use nerdfont to render yazi.
|
||||
-- Default icon from mactag.yazi: ●; Some generic icons: , ,
|
||||
-- More icon from nerd fonts: https://www.nerdfonts.com/cheat-sheet
|
||||
icons = { -- (Optional)
|
||||
-- default icon
|
||||
default = "",
|
||||
|
||||
-- format: [tag key] = "tag icon"
|
||||
["*"] = "*",
|
||||
["$"] = "",
|
||||
["!"] = "",
|
||||
["p"] = "",
|
||||
},
|
||||
})
|
||||
-- require("omp"):setup({
|
||||
-- config = "/home/liph/.config/ohmyposh/yazi-zen.json",
|
||||
-- })
|
||||
|
||||
-- default config
|
||||
require("fchar"):setup({
|
||||
-- if true: f -> file, File, FILE
|
||||
insensitive = true,
|
||||
-- if true: f -> file, .file, @file, #file, ...file
|
||||
skip_symbols = true,
|
||||
-- if {"yazi-"}: f -> file, yazi-file
|
||||
skip_prefix = {},
|
||||
-- start: f -> file
|
||||
-- word: f -> file, also-file
|
||||
-- all: f -> file, also-file, alsofile, elf
|
||||
search_location = "start",
|
||||
aliases = {},
|
||||
})
|
||||
|
||||
-- aliases for German
|
||||
require("fchar"):setup({
|
||||
aliases = {
|
||||
a = "ä",
|
||||
o = "ö",
|
||||
u = "ü",
|
||||
s = "ß",
|
||||
},
|
||||
})
|
||||
|
||||
-- you may want to turn off the search regex from
|
||||
-- showing up in the header by doing this
|
||||
function Header:flags()
|
||||
local cwd = self._current.cwd
|
||||
local filter = self._current.files.filter
|
||||
|
||||
local t = {}
|
||||
if cwd.is_search then
|
||||
t[#t + 1] = string.format("search: %s", cwd.domain)
|
||||
end
|
||||
if filter then
|
||||
t[#t + 1] = string.format("filter: %s", filter)
|
||||
end
|
||||
return #t == 0 and "" or " (" .. table.concat(t, ", ") .. ")"
|
||||
end
|
||||
|
||||
require("dupes"):setup({
|
||||
-- Global settings
|
||||
save_op = false, -- Save results to file by default
|
||||
-- auto_confirm = true, -- Skip confirmation for apply (use with caution!)
|
||||
|
||||
profiles = {
|
||||
-- Interactive mode: recursively scan and display duplicates
|
||||
interactive = {
|
||||
args = { "-r" },
|
||||
},
|
||||
-- Apply mode: recursively scan and DELETE duplicates
|
||||
apply = {
|
||||
args = { "-r", "-N", "-d" },
|
||||
save_op = true, -- Save results before deletion
|
||||
},
|
||||
-- Custom profile example (uncomment to use)
|
||||
-- custom = {
|
||||
-- args = { "-r", "-s", }, -- Your custom jdupes flags
|
||||
-- },
|
||||
},
|
||||
})
|
||||
@@ -1,536 +0,0 @@
|
||||
[mgr]
|
||||
prepend_keymap = [
|
||||
|
||||
|
||||
### smart-paste plugin ###
|
||||
{ on = "P", run = "plugin smart-paste", desc = "Paste into the hovered directory or CWD" },
|
||||
|
||||
### open-with-cmd plugin ###
|
||||
{ on = "o", run = "plugin open-with-cmd -- block", desc = "Open with command in the terminal" },
|
||||
{ on = "O", run = "plugin open-with-cmd", desc = "Open with command" },
|
||||
|
||||
### bypass plugin ###
|
||||
{ on = [
|
||||
"L",
|
||||
], run = "plugin bypass", desc = "Recursively enter child directory, skipping children with only a single subdirectory" },
|
||||
{ on = [
|
||||
"H",
|
||||
], run = "plugin bypass reverse", desc = "Recursively enter parent directory, skipping parents with only a single subdirectory" },
|
||||
|
||||
### recycle-bin plugin
|
||||
{ on = [
|
||||
"R",
|
||||
"b",
|
||||
], run = "plugin recycle-bin", desc = "Open Recycle Bin menu" },
|
||||
|
||||
### dupes plugin ###
|
||||
{ on = [
|
||||
"<A-J>",
|
||||
"i",
|
||||
], run = "plugin dupes interactive", desc = "Run dupes interactive" },
|
||||
{ on = [
|
||||
"<A-J>",
|
||||
"o",
|
||||
], run = "plugin dupes override", desc = "Run dupes override" },
|
||||
{ on = [
|
||||
"<A-J>",
|
||||
"d",
|
||||
], run = "plugin dupes dry", desc = "Run dupes dry" },
|
||||
{ on = [
|
||||
"<A-J>",
|
||||
"a",
|
||||
], run = "plugin dupes apply", desc = "Run dupes apply" },
|
||||
{ on = [
|
||||
"<A-J>",
|
||||
"c",
|
||||
], run = "plugin dupes custom", desc = "Run dupes custom" },
|
||||
|
||||
### toggle-pane plugin ###
|
||||
{ on = "W", run = "plugin toggle-pane max-preview", desc = "Maximize or restore the preview pane" },
|
||||
{ on = "E", run = "plugin toggle-pane min-preview", desc = "Minimize or restore the preview pane" },
|
||||
|
||||
### what size plugin ###
|
||||
{ on = "i", run = "plugin what-size", desc = "Calc size of selection or cwd" },
|
||||
|
||||
### rsync plugin ###
|
||||
{ on = [
|
||||
"R",
|
||||
], run = "plugin rsync", desc = "Copy files using rsync" },
|
||||
|
||||
### yafg plugin ###
|
||||
{ on = [
|
||||
"F",
|
||||
"G",
|
||||
], run = "plugin yafg" },
|
||||
|
||||
###### GIT ######
|
||||
### open-git-remote plugin ###
|
||||
{ on = [
|
||||
"g",
|
||||
"l",
|
||||
], run = "plugin open-git-remote", desc = "open git remote url" },
|
||||
### lazygit plugin ###
|
||||
{ on = [
|
||||
"g",
|
||||
"i",
|
||||
], run = "plugin lazygit", desc = "run lazygit" },
|
||||
### vcs-files plugin ###
|
||||
{ on = [
|
||||
"g",
|
||||
"c",
|
||||
], run = "plugin vcs-files", desc = "Show Git file changes" },
|
||||
|
||||
### mount plugin ###
|
||||
{ on = "M", run = "plugin mount" },
|
||||
|
||||
# ### smart-enter plugin ###
|
||||
{ on = "l", run = "plugin smart-enter", desc = "Enter the child directory, or open the file" },
|
||||
|
||||
### f-char plugin ###
|
||||
{ on = "f", run = "plugin fchar", desc = "Jump to char" },
|
||||
# ### jump-to-char plugin ###
|
||||
# { on = "f", run = "plugin jump-to-char", desc = "Jump to char" },
|
||||
|
||||
### whoosh plugin ###
|
||||
{ on = "[", run = "plugin whoosh jump_by_key", desc = "Jump bookmark by key" },
|
||||
# Direct fuzzy search access
|
||||
{ on = "}", run = "plugin whoosh jump_by_fzf", desc = "Direct fuzzy search for bookmarks" },
|
||||
# Basic bookmark operations
|
||||
{ on = [
|
||||
"]",
|
||||
"a",
|
||||
], run = "plugin whoosh save", desc = "Add bookmark (hovered file/directory)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"A",
|
||||
], run = "plugin whoosh save_cwd", desc = "Add bookmark (current directory)" },
|
||||
# Temporary bookmarks
|
||||
{ on = [
|
||||
"]",
|
||||
"t",
|
||||
], run = "plugin whoosh save_temp", desc = "Add temporary bookmark (hovered file/directory)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"T",
|
||||
], run = "plugin whoosh save_cwd_temp", desc = "Add temporary bookmark (current directory)" },
|
||||
# Jump to bookmarks
|
||||
{ on = "<A-k>", run = "plugin whoosh jump_key_k", desc = "Jump directly to bookmark with key k" },
|
||||
{ on = [
|
||||
"]",
|
||||
"f",
|
||||
], run = "plugin whoosh jump_by_fzf", desc = "Jump bookmark by fzf" },
|
||||
# Delete bookmarks
|
||||
{ on = [
|
||||
"]",
|
||||
"d",
|
||||
], run = "plugin whoosh delete_by_key", desc = "Delete bookmark by key" },
|
||||
{ on = [
|
||||
"]",
|
||||
"D",
|
||||
], run = "plugin whoosh delete_by_fzf", desc = "Delete bookmarks by fzf (use TAB to select multiple)" },
|
||||
{ on = [
|
||||
"]",
|
||||
"C",
|
||||
], run = "plugin whoosh delete_all", desc = "Delete all user bookmarks" },
|
||||
# Rename Bookmarks
|
||||
{ on = [
|
||||
"]",
|
||||
"r",
|
||||
], run = "plugin whoosh rename_by_key", desc = "Rename bookmark by key" },
|
||||
{ on = [
|
||||
"]",
|
||||
"R",
|
||||
], run = "plugin whoosh rename_by_fzf", desc = "Rename bookmark by fzf" },
|
||||
# Navigation
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
|
||||
# { on = [
|
||||
# "q",
|
||||
# "q",
|
||||
# ], run = "quit", desc = "Exit the process" },
|
||||
{ on = [
|
||||
"<C-q>",
|
||||
], run = "close", desc = "Close the current tab, or quit if it is last tab" },
|
||||
|
||||
### projects plugin ###
|
||||
{ on = [
|
||||
"P",
|
||||
"p",
|
||||
], run = "plugin projects 'load SomeProject'", desc = "Load the 'SomeProject' project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"s",
|
||||
], run = "plugin projects save", desc = "Save current project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"l",
|
||||
], run = "plugin projects load", desc = "Load project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"P",
|
||||
], run = "plugin projects load_last", desc = "Load last project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"d",
|
||||
], run = "plugin projects delete", desc = "Delete project" },
|
||||
{ on = [
|
||||
"P",
|
||||
"D",
|
||||
], run = "plugin projects delete_all", desc = "Delete all projects" },
|
||||
{ on = [
|
||||
"P",
|
||||
"m",
|
||||
], run = "plugin projects 'merge current'", desc = "Merge current tab to other projects" },
|
||||
{ on = [
|
||||
"P",
|
||||
"M",
|
||||
], run = "plugin projects 'merge all'", desc = "Merge current project to other projects" },
|
||||
|
||||
### fazif plugin ###
|
||||
{ on = [
|
||||
"b",
|
||||
"d",
|
||||
], run = "plugin fazif faziffd", desc = "Find files/directories with fd and fzf" },
|
||||
{ on = [
|
||||
"b",
|
||||
"D",
|
||||
], run = "plugin fazif faziffdr", desc = "Find files/directories with fd and fzf" },
|
||||
{ on = [
|
||||
"b",
|
||||
"r",
|
||||
], run = "plugin fazif fazifrg", desc = "Find content in files with ripgrep and fzf" },
|
||||
{ on = [
|
||||
"b",
|
||||
"R",
|
||||
], run = "plugin fazif fazifrga", desc = "Find content in documents with ripgrep-all and fzf" },
|
||||
|
||||
### Tagging plugin ###
|
||||
# TOGGLE TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"t",
|
||||
"k",
|
||||
], run = "plugin simple-tag -- toggle-tag", desc = "Toggle a tag (press any key)" },
|
||||
{ on = [
|
||||
"'",
|
||||
], run = "plugin simple-tag -- toggle-tag --keys=!", desc = "Toggle tag(s) with fixed tag key(s) = (! and 1 and q)" },
|
||||
{ on = [
|
||||
"-",
|
||||
], run = "plugin simple-tag -- toggle-tag --keys=1", desc = "Toggle tag(s) with fixed tag key(s) = (! and 1 and q)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"t",
|
||||
"i",
|
||||
], run = "plugin simple-tag -- toggle-tag --input", desc = "Toggle tag(s) with value from (input box)" },
|
||||
# ADD TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"a",
|
||||
"k",
|
||||
], run = "plugin simple-tag -- add-tag", desc = "Add a tag (press any key)" },
|
||||
# { on = [ "t", "a", "f" ], run = "plugin simple-tag -- add-tag --keys=!1q", desc = "Add tag(s) with fixed tag keys = (! and 1 and q)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"a",
|
||||
"i",
|
||||
], run = "plugin simple-tag -- add-tag --input", desc = "Add tag(s) with value from (input box)" },
|
||||
# REMOVE/DELETE TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"d",
|
||||
"k",
|
||||
], run = "plugin simple-tag -- remove-tag", desc = "Remove a tag (press any key)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"d",
|
||||
"f",
|
||||
], run = "plugin simple-tag -- remove-tag --keys=!1q", desc = "Remove tag(s) with fixed tag keys = (! and 1 and q)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"d",
|
||||
"i",
|
||||
], run = "plugin simple-tag -- remove-tag --input", desc = "Remove tag(s) with value from (input box)" },
|
||||
# REPLACE ALL OLD TAG(S) WITH NEW TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"r",
|
||||
"k",
|
||||
], run = "plugin simple-tag -- replace-tag", desc = "Replace with a new tag (press any key)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"r",
|
||||
"f",
|
||||
], run = "plugin simple-tag -- replace-tag --keys=!1q", desc = "Replace tag(s) with fixed tag keys = (! and 1 and q)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"r",
|
||||
"i",
|
||||
], run = "plugin simple-tag -- replace-tag --input", desc = "Replace tag(s) with value from (input box)" },
|
||||
# EDIT TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"e",
|
||||
], run = "plugin simple-tag -- edit-tag ", desc = "Edit tag(s) (input box)" },
|
||||
# CLEAR TAG(S)
|
||||
{ on = [
|
||||
"t",
|
||||
"c",
|
||||
], run = "plugin simple-tag -- clear", desc = "Clear all tags from selected or hovered files" },
|
||||
# CHANGE UI
|
||||
{ on = [
|
||||
"t",
|
||||
"u",
|
||||
"s",
|
||||
], run = "plugin simple-tag -- toggle-ui", desc = "Toggle tag indicator (icon > tag key > hidden)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"u",
|
||||
"h",
|
||||
], run = "plugin simple-tag -- toggle-ui --mode=hidden", desc = "Hide all tags indicator" },
|
||||
# FILTER FILES/FOLDERS BY TAGS:
|
||||
{ on = [
|
||||
"t",
|
||||
"f",
|
||||
], run = "plugin simple-tag -- filter", desc = "Filter files/folders by a tag (press any key)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"F",
|
||||
], run = "plugin simple-tag -- filter --input", desc = "Filter files/folders by tag(s) (input box)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"F",
|
||||
], run = "plugin simple-tag -- filter --input --mode=or", desc = "Filter files/folders by contain tags (input box)" },
|
||||
# VISUAL SELECT FILES/FOLDERS BY TAGS:
|
||||
# Available selection actions:
|
||||
# replace → Replaces the current selection list with files/folders that have the selected tag.
|
||||
# unite → Combines the currently selected files/folders with those that have the selected tag.
|
||||
# intersect → Keeps only the files/folders that are present in both the current selection and the tagged items.
|
||||
# subtract → Deselects files/folders that have the selected tag from the current selection.
|
||||
# exclude → Combines the currently selected files/folders with the tagged items, then deselects any overlapping items between the current selection and the tagged items.
|
||||
# undo → Undos or redoes the last selection action.
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"t",
|
||||
], run = "plugin simple-tag -- toggle-select", desc = "Select a selection action then select a tag key (toggle-select)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"t",
|
||||
], run = "plugin simple-tag -- toggle-select --keys=!1q", desc = "" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"r",
|
||||
], run = "plugin simple-tag -- replace-select", desc = "replace-select" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"u",
|
||||
], run = "plugin simple-tag -- unite-select", desc = "unite-select" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"i",
|
||||
], run = "plugin simple-tag -- intersect-select", desc = "intersect-select" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"s",
|
||||
], run = "plugin simple-tag -- subtract-select", desc = "subtract-select" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"e",
|
||||
], run = "plugin simple-tag -- exclude-select", desc = "exclude-select" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"e",
|
||||
], run = "plugin simple-tag -- replace-select --keys=!1q", desc = "Replaces the current selection list with files/folders that have (! and 1 and q) tag(s)" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"R",
|
||||
], run = "plugin simple-tag -- replace-select --input", desc = "replace-select --input" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"U",
|
||||
], run = "plugin simple-tag -- unite-select --input", desc = "unite-select --input" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"I",
|
||||
], run = "plugin simple-tag -- intersect-select --input", desc = "intersect-select --input" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"S",
|
||||
], run = "plugin simple-tag -- subtract-select --input", desc = "subtract-select --input" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"E",
|
||||
], run = "plugin simple-tag -- exclude-select --input", desc = "exclude-select --input" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"R",
|
||||
], run = "plugin simple-tag -- replace-select --input --mode=or", desc = "replace-select --input --mode=or" },
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"R",
|
||||
], run = "plugin simple-tag -- replace-select --keys=!1q --mode=or", desc = "replace-select --keys=!1q --mode=or" },
|
||||
# Undo/Redo selection (only works after using 5 modes above)
|
||||
{ on = [
|
||||
"t",
|
||||
"s",
|
||||
"u",
|
||||
], run = "plugin simple-tag -- undo-select", desc = "Undos/Redos the last selection action" },
|
||||
|
||||
# Directory navigation
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
{ on = [
|
||||
"h",
|
||||
], run = "leave", desc = "Go back to parent directory" },
|
||||
{ on = [
|
||||
"l",
|
||||
], run = "enter", desc = "Enter directory" },
|
||||
# File operations
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "open", desc = "Open selected files" },
|
||||
{ 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 = [
|
||||
"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 or directory" },
|
||||
{ on = [
|
||||
"r",
|
||||
], run = "rename --cursor=before_ext", desc = "Rename selected file" },
|
||||
# Selection
|
||||
{ on = [
|
||||
"e",
|
||||
], run = [
|
||||
"select --state=none",
|
||||
"arrow 1",
|
||||
], desc = "Toggle selection" },
|
||||
{ on = [
|
||||
"v",
|
||||
], run = "visual_mode", desc = "Enter visual mode" },
|
||||
{ on = [
|
||||
"V",
|
||||
], run = "visual_mode --unset", desc = "Enter visual mode (unset)" },
|
||||
# Search
|
||||
{ on = [
|
||||
"/",
|
||||
], run = "find --smart", desc = "Find file" },
|
||||
{ on = [
|
||||
"n",
|
||||
], run = "find_arrow", desc = "Go to next found" },
|
||||
{ on = [
|
||||
"N",
|
||||
], run = "find_arrow --previous", desc = "Go to previous found" },
|
||||
# Tabs
|
||||
{ on = [
|
||||
"T",
|
||||
], run = "tab_create --current", desc = "Create new tab" },
|
||||
{ on = [
|
||||
"1",
|
||||
], run = "tab_switch 0", desc = "Switch to tab 1" },
|
||||
{ on = [
|
||||
"2",
|
||||
], run = "tab_switch 1", desc = "Switch to tab 2" },
|
||||
{ on = [
|
||||
"3",
|
||||
], run = "tab_switch 2", desc = "Switch to tab 3" },
|
||||
]
|
||||
|
||||
[tasks]
|
||||
prepend_keymap = [
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "close", desc = "Close task manager" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
]
|
||||
|
||||
[select]
|
||||
prepend_keymap = [
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "close", desc = "Cancel selection" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "close --submit", desc = "Submit selection" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
]
|
||||
|
||||
[input]
|
||||
prepend_keymap = [
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "close", desc = "Cancel input" },
|
||||
{ on = [
|
||||
"<Enter>",
|
||||
], run = "close --submit", desc = "Submit input" },
|
||||
]
|
||||
|
||||
[completion]
|
||||
prepend_keymap = [
|
||||
{ on = [
|
||||
"<Tab>",
|
||||
], run = "close --submit", desc = "Submit completion" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
]
|
||||
|
||||
[help]
|
||||
prepend_keymap = [
|
||||
{ on = [
|
||||
"<Esc>",
|
||||
], run = "escape", desc = "Clear filter or exit help" },
|
||||
{ on = [
|
||||
"q",
|
||||
], run = "close", desc = "Exit help" },
|
||||
{ on = [
|
||||
"k",
|
||||
], run = "arrow -1", desc = "Move cursor up" },
|
||||
{ on = [
|
||||
"j",
|
||||
], run = "arrow 1", desc = "Move cursor down" },
|
||||
]
|
||||
@@ -1,163 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||
"palette": {
|
||||
"gb_bright_aqua": "#8ec07c",
|
||||
"gb_bright_blue": "#6272a4",
|
||||
"gb_bright_green": "#b8bb26",
|
||||
"gb_bright_orange": "#fe8019",
|
||||
"gb_bright_purple": "#d3869b",
|
||||
"gb_bright_red": "#fb4934",
|
||||
"gb_bright_yellow": "#fabd2f",
|
||||
"gb_dark0": "#282828",
|
||||
"gb_dark0_hard": "#1d2021",
|
||||
"gb_dark0_soft": "#32302f",
|
||||
"gb_dark1": "#3c3836",
|
||||
"gb_dark2": "#504945",
|
||||
"gb_dark3": "#665c54",
|
||||
"gb_dark4": "#7c6f64",
|
||||
"gb_dark4_256": "#7c6f64",
|
||||
"gb_faded_aqua": "#427b58",
|
||||
"gb_faded_blue": "#076678",
|
||||
"gb_faded_green": "#79740e",
|
||||
"gb_faded_orange": "#af3a03",
|
||||
"gb_faded_purple": "#8f3f71",
|
||||
"gb_faded_red": "#9d0006",
|
||||
"gb_faded_yellow": "#b57614",
|
||||
"gb_gray_244": "#928374",
|
||||
"gb_gray_245": "#928374",
|
||||
"gb_light0": "#fbf1c7",
|
||||
"gb_light0_hard": "#f9f5d7",
|
||||
"gb_light0_soft": "#f2e5bc",
|
||||
"gb_light1": "#ebdbb2",
|
||||
"gb_light2": "#d5c4a1",
|
||||
"gb_light3": "#bdae93",
|
||||
"gb_light4": "#a89984",
|
||||
"gb_light4_256": "#a89984",
|
||||
"gb_neutral_aqua": "#689d6a",
|
||||
"gb_neutral_blue": "#458588",
|
||||
"gb_neutral_green": "#98971a",
|
||||
"gb_neutral_orange": "#d65d0e",
|
||||
"gb_neutral_purple": "#b16286",
|
||||
"gb_neutral_red": "#cc241d",
|
||||
"gb_neutral_yellow": "#d79921"
|
||||
},
|
||||
"var": {
|
||||
"Dir": "",
|
||||
"Documents": "📝",
|
||||
"Downloads": "📥",
|
||||
"Duration": "\u231b",
|
||||
"Exit": "\u21a9\ufe0f",
|
||||
"GitHub": "\ueba1",
|
||||
"Home": "🏠",
|
||||
"Host": " ",
|
||||
"LeftDelim": "\ue0b3",
|
||||
"LeftSep": "\ue0b2",
|
||||
"LeftSepRound": "\ue0b6",
|
||||
"Music": "🎵",
|
||||
"Pictures": "🖼\ufe0f",
|
||||
"RightDelim": "\ue0b1",
|
||||
"RightSep": "\ue0b0",
|
||||
"RightSepRound": "\ue0b4",
|
||||
"Tag": "🔖 ",
|
||||
"Time": "🕓",
|
||||
"root": "🔴",
|
||||
"ssh": "🌐",
|
||||
"user": ""
|
||||
},
|
||||
"pwd": "osc7",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "prompt",
|
||||
"alignment": "left",
|
||||
"segments": [
|
||||
{
|
||||
"properties": {
|
||||
"cache_duration": "none"
|
||||
},
|
||||
"leading_diamond": "\ue0b6",
|
||||
"trailing_diamond": "\ue0b0",
|
||||
"template": "{{if .Root}}{{.Var.root}}{{else}}{{.Var.user}}{{end}}{{.UserName}} {{.Var.Host}}{{ .HostName }}{{ if .SSHSession }} {{.Var.ssh}}{{ end }}",
|
||||
"foreground": "p:gb_dark0_hard",
|
||||
"background": "p:gb_bright_purple",
|
||||
"type": "session",
|
||||
"style": "diamond"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"cache_duration": "none",
|
||||
"folder_icon": "\ueaf7",
|
||||
"folder_separator_icon": " \ue0b1 ",
|
||||
"home_icon": "🏠",
|
||||
"mapped_locations": {},
|
||||
"max_depth": 2,
|
||||
"max_width": 6,
|
||||
"mixed_threshold": 6,
|
||||
"style": "mixed"
|
||||
},
|
||||
"leading_diamond": "<transparent,#427b58>\ue0b0</>",
|
||||
"trailing_diamond": "\ue0b0",
|
||||
"template": "<#f1fa8c,#427b58>{{.Var.Dir}}</><#427b58,p:gb_bright_aqua>{{.Var.RightSep}}</><transparent,p:gb_bright_aqua> {{ .Path}}</>",
|
||||
"foreground": "transparent",
|
||||
"background": "p:gb_bright_aqua",
|
||||
"type": "path",
|
||||
"style": "diamond"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"branch_max_length": 35,
|
||||
"cache_duration": "none",
|
||||
"fetch_stash_count": true,
|
||||
"fetch_status": true,
|
||||
"fetch_upstream_icon": true,
|
||||
"status_formats": {
|
||||
"Added": " %d",
|
||||
"Deleted": " %d",
|
||||
"Modified": " %d",
|
||||
"Untracked": " %d",
|
||||
"Unmerged": " %d"
|
||||
}
|
||||
},
|
||||
"leading_diamond": "<transparent,background>\ue0b0</>",
|
||||
"trailing_diamond": "\ue0b0",
|
||||
"template": " {{ .UpstreamIcon }} {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }} -> {{.Upstream}}{{ end }}{{ if .Working.Changed }}<p:gb_faded_red> {{ .Working.String }}</>{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }}{{ end }}{{ if .Staging.Changed }} <p:gb_faded_green>{{ .Staging.String }}</>{{ end }}{{ if gt .StashCount 0 }} \uf51e {{ .StashCount }}{{ end }} ",
|
||||
"foreground": "#193549",
|
||||
"background": "#fffb38",
|
||||
"type": "git",
|
||||
"style": "diamond",
|
||||
"background_templates": [
|
||||
"{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
|
||||
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}",
|
||||
"{{ if gt .Ahead 0 }}#B388FF{{ end }}",
|
||||
"{{ if gt .Behind 0 }}#B388FF{{ end }}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"cache_duration": "none",
|
||||
"fetch_version": true
|
||||
},
|
||||
"template": " \ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} ",
|
||||
"foreground": "#ffffff",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "#6CA35E",
|
||||
"type": "node",
|
||||
"style": "powerline"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"cache_duration": "none",
|
||||
"display_mode": "files",
|
||||
"fetch_virtual_env": false
|
||||
},
|
||||
"template": " \ue235 {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} ",
|
||||
"foreground": "#111111",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "#FFDE57",
|
||||
"type": "python",
|
||||
"style": "powerline"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 3
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
|
||||
pwd = "osc7"
|
||||
version = 3
|
||||
|
||||
[palette]
|
||||
gb_bright_path = "#7daea3"
|
||||
gb_bright_git = "#d8a657"
|
||||
gb_dark0_hard = "#3e7fb0"
|
||||
gb_faded_green = "#79740e"
|
||||
gb_faded_red = "#ea9a97"
|
||||
gb_text = "#d3869b"
|
||||
|
||||
[var]
|
||||
user = ""
|
||||
ssh = "🌐"
|
||||
|
||||
# LEFT SIDE PROMPT
|
||||
[[blocks]]
|
||||
type = "prompt"
|
||||
alignment = "left"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = '{{ .HostName }} '
|
||||
foreground = 'magenta'
|
||||
background = 'transparent'
|
||||
type = 'text'
|
||||
style = 'plain'
|
||||
|
||||
[[blocks.segments]]
|
||||
template = '{{ .UserName }} '
|
||||
foreground = 'magenta'
|
||||
background = 'transparent'
|
||||
type = 'text'
|
||||
style = 'plain'
|
||||
|
||||
# [blocks.segments.properties]
|
||||
# cache_duration = "none"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = "{{ .Path }} "
|
||||
foreground = "blue"
|
||||
background = "transparent"
|
||||
type = "path"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
style = "full"
|
||||
enable_hyperlink = true
|
||||
|
||||
[[blocks.segments]]
|
||||
template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}</>'
|
||||
foreground = "yellow"
|
||||
background = "transparent"
|
||||
type = "git"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
fetch_status = true
|
||||
|
||||
[blocks.segments.properties.status_formats]
|
||||
Added = "+%d"
|
||||
Deleted = "-%d"
|
||||
Modified = "~%d"
|
||||
Untracked = "?%d"
|
||||
|
||||
# RIGHT SIDE PROMPT
|
||||
[[blocks]]
|
||||
type = "rprompt"
|
||||
alignment = "right"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ .Full }}"
|
||||
foreground = "p:gb_faded_green"
|
||||
background = "transparent"
|
||||
type = "node"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
display_mode = "files"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ if .Venv }}({{ .Venv }}) {{ end }}{{ .Full }}"
|
||||
foreground = "p:gb_faded_green"
|
||||
background = "transparent"
|
||||
type = "python"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
display_mode = "always"
|
||||
fetch_virtual_env = true
|
||||
|
||||
# NEWLINE FOR INPUT
|
||||
[[blocks]]
|
||||
type = "prompt"
|
||||
alignment = "left"
|
||||
newline = true
|
||||
|
||||
[[blocks.segments]]
|
||||
template = "❯ "
|
||||
foreground = "p:gb_bright_aqua"
|
||||
background = "transparent"
|
||||
type = "text"
|
||||
style = "plain"
|
||||
@@ -1,157 +0,0 @@
|
||||
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
|
||||
pwd = "osc7"
|
||||
version = 3
|
||||
|
||||
[palette]
|
||||
gb_bright_aqua = "#8ec07c"
|
||||
gb_bright_blue = "#83a598"
|
||||
gb_bright_green = "#b8bb26"
|
||||
gb_bright_orange = "#fe8019"
|
||||
gb_bright_purple = "#d3869b"
|
||||
gb_bright_red = "#fb4934"
|
||||
gb_bright_yellow = "#fabd2f"
|
||||
gb_dark0 = "#282828"
|
||||
gb_dark0_hard = "#1d2021"
|
||||
gb_dark0_soft = "#32302f"
|
||||
gb_dark1 = "#3c3836"
|
||||
gb_dark2 = "#504945"
|
||||
gb_dark3 = "#665c54"
|
||||
gb_dark4 = "#7c6f64"
|
||||
gb_dark4_256 = "#7c6f64"
|
||||
gb_faded_aqua = "#427b58"
|
||||
gb_faded_blue = "#076678"
|
||||
gb_faded_green = "#79740e"
|
||||
gb_faded_orange = "#af3a03"
|
||||
gb_faded_purple = "#8f3f71"
|
||||
gb_faded_red = "#9d0006"
|
||||
gb_faded_yellow = "#b57614"
|
||||
gb_gray_244 = "#928374"
|
||||
gb_gray_245 = "#928374"
|
||||
gb_light0 = "#fbf1c7"
|
||||
gb_light0_hard = "#f9f5d7"
|
||||
gb_light0_soft = "#f2e5bc"
|
||||
gb_light1 = "#ebdbb2"
|
||||
gb_light2 = "#d5c4a1"
|
||||
gb_light3 = "#bdae93"
|
||||
gb_light4 = "#a89984"
|
||||
gb_light4_256 = "#a89984"
|
||||
gb_neutral_aqua = "#689d6a"
|
||||
gb_neutral_blue = "#458588"
|
||||
gb_neutral_green = "#98971a"
|
||||
gb_neutral_orange = "#d65d0e"
|
||||
gb_neutral_purple = "#b16286"
|
||||
gb_neutral_red = "#cc241d"
|
||||
gb_neutral_yellow = "#d79921"
|
||||
|
||||
[var]
|
||||
Dir = "📂"
|
||||
Documents = "📝"
|
||||
Downloads = "📥"
|
||||
Duration = "⌛"
|
||||
Exit = "↩️"
|
||||
GitHub = ""
|
||||
Home = "🏠"
|
||||
Host = " "
|
||||
LeftDelim = ""
|
||||
LeftSep = ""
|
||||
LeftSepRound = ""
|
||||
Music = "🎵"
|
||||
Pictures = "🖼️"
|
||||
RightDelim = ""
|
||||
RightSep = ""
|
||||
RightSepRound = ""
|
||||
Tag = "🔖 "
|
||||
Time = "🕓"
|
||||
root = "🔴"
|
||||
ssh = "🌐"
|
||||
user = "👤"
|
||||
|
||||
[[blocks]]
|
||||
type = "prompt"
|
||||
alignment = "left"
|
||||
|
||||
[[blocks.segments]]
|
||||
leading_diamond = ""
|
||||
trailing_diamond = ""
|
||||
template = "{{if .Root}}{{.Var.root}}{{else}}{{.Var.user}}{{end}}{{.UserName}} {{.Var.Host}}{{ .HostName }}{{ if .SSHSession }} {{.Var.ssh}}{{ end }}"
|
||||
foreground = "p:gb_dark0_hard"
|
||||
background = "p:gb_bright_purple"
|
||||
type = "session"
|
||||
style = "diamond"
|
||||
|
||||
[blocks.segments.properties]
|
||||
cache_duration = "none"
|
||||
|
||||
[[blocks.segments]]
|
||||
leading_diamond = "<transparent,#427b58></>"
|
||||
trailing_diamond = ""
|
||||
template = "<#fabd2f,#427b58>{{.Var.Dir}}</><#427b58,p:gb_bright_aqua>{{.Var.RightSep}}</><transparent,p:gb_bright_aqua> {{ .Path}}</>"
|
||||
foreground = "transparent"
|
||||
background = "p:gb_bright_aqua"
|
||||
type = "path"
|
||||
style = "diamond"
|
||||
|
||||
[blocks.segments.properties]
|
||||
cache_duration = "none"
|
||||
folder_icon = ""
|
||||
folder_separator_icon = " "
|
||||
home_icon = "🏠"
|
||||
mapped_locations = {}
|
||||
max_depth = 2
|
||||
max_width = 6
|
||||
mixed_threshold = 6
|
||||
style = "mixed"
|
||||
|
||||
[[blocks.segments]]
|
||||
leading_diamond = "<transparent,background></>"
|
||||
trailing_diamond = ""
|
||||
template = " {{ .UpstreamIcon }} {{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }} -> {{.Upstream}}{{ end }}{{ if .Working.Changed }}<p:gb_faded_red> {{ .Working.String }}</>{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }}{{ end }}{{ if .Staging.Changed }} <p:gb_faded_green>{{ .Staging.String }}</>{{ end }}{{ if gt .StashCount 0 }} {{ .StashCount }}{{ end }} "
|
||||
foreground = "#193549"
|
||||
background = "#fffb38"
|
||||
type = "git"
|
||||
style = "diamond"
|
||||
background_templates = [
|
||||
"{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}",
|
||||
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}",
|
||||
"{{ if gt .Ahead 0 }}#B388FF{{ end }}",
|
||||
"{{ if gt .Behind 0 }}#B388FF{{ end }}",
|
||||
]
|
||||
|
||||
[blocks.segments.properties]
|
||||
branch_max_length = 35
|
||||
cache_duration = "none"
|
||||
fetch_stash_count = true
|
||||
fetch_status = true
|
||||
fetch_upstream_icon = true
|
||||
|
||||
[blocks.segments.properties.status_formats]
|
||||
Added = " %d"
|
||||
Deleted = " %d"
|
||||
Modified = " %d"
|
||||
Untracked = " %d"
|
||||
Unmerged = " %d"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
|
||||
foreground = "#ffffff"
|
||||
powerline_symbol = ""
|
||||
background = "#6CA35E"
|
||||
type = "node"
|
||||
style = "powerline"
|
||||
|
||||
[blocks.segments.properties]
|
||||
cache_duration = "none"
|
||||
fetch_version = true
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
|
||||
foreground = "#111111"
|
||||
powerline_symbol = ""
|
||||
background = "#FFDE57"
|
||||
type = "python"
|
||||
style = "powerline"
|
||||
|
||||
[blocks.segments.properties]
|
||||
cache_duration = "none"
|
||||
display_mode = "files"
|
||||
fetch_virtual_env = false
|
||||
@@ -1,103 +0,0 @@
|
||||
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
|
||||
pwd = "osc7"
|
||||
version = 3
|
||||
|
||||
[palette]
|
||||
gb_bright_path = "#9ccdf8"
|
||||
gb_bright_git = "#f6c177"
|
||||
gb_dark0_hard = "#3e7fb0"
|
||||
gb_faded_green = "#79740e"
|
||||
gb_faded_red = "#ea9a97"
|
||||
gb_text = "#c4a7e7"
|
||||
|
||||
[var]
|
||||
user = ""
|
||||
ssh = "🌐"
|
||||
|
||||
# LEFT SIDE PROMPT
|
||||
[[blocks]]
|
||||
type = "prompt"
|
||||
alignment = "left"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = '{{ .HostName }} '
|
||||
foreground = 'p:gb_text'
|
||||
background = 'transparent'
|
||||
type = 'text'
|
||||
style = 'plain'
|
||||
|
||||
[[blocks.segments]]
|
||||
template = '{{ .UserName }} '
|
||||
foreground = 'p:gb_text'
|
||||
background = 'transparent'
|
||||
type = 'text'
|
||||
style = 'plain'
|
||||
|
||||
# [blocks.segments.properties]
|
||||
# cache_duration = "none"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = "{{ .Path }} "
|
||||
foreground = "p:gb_bright_path"
|
||||
background = "transparent"
|
||||
type = "path"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
style = "full"
|
||||
enable_hyperlink = true
|
||||
|
||||
[[blocks.segments]]
|
||||
template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}</>'
|
||||
foreground = "p:gb_bright_git"
|
||||
background = "transparent"
|
||||
type = "git"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
fetch_status = true
|
||||
|
||||
[blocks.segments.properties.status_formats]
|
||||
Added = "+%d"
|
||||
Deleted = "-%d"
|
||||
Modified = "~%d"
|
||||
Untracked = "?%d"
|
||||
|
||||
# RIGHT SIDE PROMPT
|
||||
[[blocks]]
|
||||
type = "rprompt"
|
||||
alignment = "right"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ .Full }}"
|
||||
foreground = "p:gb_faded_green"
|
||||
background = "transparent"
|
||||
type = "node"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
display_mode = "files"
|
||||
|
||||
[[blocks.segments]]
|
||||
template = " {{ if .Venv }}({{ .Venv }}) {{ end }}{{ .Full }}"
|
||||
foreground = "p:gb_faded_green"
|
||||
background = "transparent"
|
||||
type = "python"
|
||||
style = "plain"
|
||||
|
||||
[blocks.segments.properties]
|
||||
display_mode = "always"
|
||||
fetch_virtual_env = true
|
||||
|
||||
# NEWLINE FOR INPUT
|
||||
[[blocks]]
|
||||
type = "prompt"
|
||||
alignment = "left"
|
||||
newline = true
|
||||
|
||||
[[blocks.segments]]
|
||||
template = "❯ "
|
||||
foreground = "p:gb_bright_aqua"
|
||||
background = "transparent"
|
||||
type = "text"
|
||||
style = "plain"
|
||||
@@ -1,174 +0,0 @@
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:smart-enter"
|
||||
rev = "4e55902"
|
||||
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:git"
|
||||
rev = "4e55902"
|
||||
hash = "36a484acf6a0a0219c543ccb4cee218f"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:mount"
|
||||
rev = "4e55902"
|
||||
hash = "e2d4bfccf31e5ab05f46fee4797c5215"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:mime-ext"
|
||||
rev = "4e55902"
|
||||
hash = "48a77ab785d1ee73bc2d7bbe2a4c2090"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "ndtoan96/ouch"
|
||||
rev = "cfb9140"
|
||||
hash = "b5067143415bd2d46c0dfa57319ddcef"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:piper"
|
||||
rev = "4e55902"
|
||||
hash = "2dd68af59418b631b9703a03f606b31f"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "boydaihungst/mediainfo"
|
||||
rev = "90a1652"
|
||||
hash = "7a83bfab51d1d2ba6558cc56bd52539a"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "AnirudhG07/rich-preview"
|
||||
rev = "573b275"
|
||||
hash = "c3e2871c9ef244fd181f203791f9b0d2"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "stelcodes/bunny"
|
||||
rev = "7137a44"
|
||||
hash = "58bfa473bcac8574400e573787954512"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "Lil-Dank/lazygit"
|
||||
rev = "0e56060"
|
||||
hash = "ab2e66065a94cca4886b303518e44bd8"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "MasouShizuka/projects"
|
||||
rev = "eed0657"
|
||||
hash = "ca79de2b3bb2247906e01b2261e5d2bb"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "XYenon/yafg"
|
||||
rev = "6034c67"
|
||||
hash = "11543279fd83ad4cacdfb07d67016928"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "Shallow-Seek/fazif"
|
||||
rev = "6e10488"
|
||||
hash = "c549ff30fb1d1d97c734010fe82f6295"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "GianniBYoung/rsync"
|
||||
rev = "14d2828"
|
||||
hash = "7394430ba473dce1023721622438bf3d"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "llanosrocas/yaziline"
|
||||
rev = "6266926"
|
||||
hash = "9917ab5cb9bdbab7ca7f2501f84f0f11"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "boydaihungst/file-extra-metadata"
|
||||
rev = "4fbb106"
|
||||
hash = "8765a20c837f4be5718f89ab1cf33b4"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:full-border"
|
||||
rev = "68f7d48"
|
||||
hash = "3996fc74044bc44144b323686f887e1"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "pirafrank/what-size"
|
||||
rev = "179ebf6"
|
||||
hash = "57056b9728006881d580ccabe8154a9c"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:toggle-pane"
|
||||
rev = "57f1863"
|
||||
hash = "8a7c58225816a163a6e8730c0adafbc8"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "AminurAlam/yazi-plugins:fchar"
|
||||
rev = "658a099"
|
||||
hash = "b484ff674a30268991b67f819f4625da"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "mshnwq/dupes"
|
||||
rev = "18a9395"
|
||||
hash = "730ddf5e1179f34ccb81f8d5ed564823"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "uhs-robert/recycle-bin"
|
||||
rev = "69d7d4c"
|
||||
hash = "38dac2fc8f4b50bbdaa46e699720a54a"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "Rolv-Apneseth/bypass"
|
||||
rev = "c1e5fcf"
|
||||
hash = "208e77480824f62558a5b037c8569d61"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "Ape/open-with-cmd"
|
||||
rev = "e3d430f"
|
||||
hash = "d29c1ffa99099181faf8c01d1f59aa4c"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:smart-paste"
|
||||
rev = "56971d0"
|
||||
hash = "75fd60b2df7115e0a6ca31a6a804d320"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "larry-oates/open-git-remote"
|
||||
rev = "95b3043"
|
||||
hash = "8d17dcc063217b558a08ed8bb5e9e8ad"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:vcs-files"
|
||||
rev = "56971d0"
|
||||
hash = "5cfd9b2bd3f8ec4e3245e3426a967f82"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "yazi-rs/flavors:catppuccin-mocha"
|
||||
rev = "4a1802a"
|
||||
hash = "b951d27afe197d154f6da9683b46c5f8"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "Mintass/rose-pine-moon"
|
||||
rev = "94385fe"
|
||||
hash = "edbe0dfb5db8ff37281dba62adc7e750"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "Chromium-3-Oxide/everforest-medium"
|
||||
rev = "0158f0f"
|
||||
hash = "a7c36abf0b13289aceb1c20a17c6a63e"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "bennyyip/gruvbox-dark"
|
||||
rev = "619fdc5"
|
||||
hash = "d4c7003ec6dc4efd5d3a050d5c2f2575"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "BennyOe/tokyo-night"
|
||||
rev = "8e6296f"
|
||||
hash = "d9da921c3bd37ba32ee27a8a7a40461f"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "dangooddd/kanagawa"
|
||||
rev = "04985d1"
|
||||
hash = "c69a63981e254a3a06a11c2bf0e6af1d"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "matt-dong-123/gruvbox-material"
|
||||
rev = "6c36491"
|
||||
hash = "564f2335540ee2c440c3b671bc28ac60"
|
||||
|
||||
[[flavor.deps]]
|
||||
use = "malick-tammal/monokai"
|
||||
rev = "e59f6cb"
|
||||
hash = "dcb449d46e30dc020e4b7b59202d2448"
|
||||
@@ -1,9 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2024 Stel Clementine
|
||||
|
||||
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.
|
||||
@@ -1,102 +0,0 @@
|
||||
# bunny.yazi 🐰
|
||||
|
||||
*🩷 Hop around your filesystem 🩷*
|
||||
|
||||
This is a bookmark plugin for [yazi](https://github.com/sxyazi/yazi) which augments the builtin bookmarking abilities into a single menu of `cd` powers designed with user experience (and cuteness) in mind. Bookmarks are referred to as *hops* because users should always feel adorable while using their terminal.
|
||||
|
||||
## Features
|
||||
|
||||
- Create persistent hops in your `init.lua` config file
|
||||
- Create ephemeral hops while using yazi
|
||||
- Hop to any directory open in another tab
|
||||
- Hop back to previous directory (history is associated with tab number)
|
||||
- Hop by fuzzy searching available hops with [fzf](https://github.com/junegunn/fzf) or similar program
|
||||
- Single menu for all functionality, therefore only one keymap is required in your `keymap.toml` file
|
||||
- Hands off: no reads or writes to your filesystem, all state is kept in memory
|
||||
|
||||
<img src="https://i.imgur.com/9OKQJUT.png" alt="bunny.yazi menu open in a terminal"/>
|
||||
|
||||
## Installation
|
||||
|
||||
### With `git`
|
||||
|
||||
```sh
|
||||
git clone https://github.com/stelcodes/bunny.yazi ~/.config/yazi/plugins/bunny.yazi
|
||||
```
|
||||
|
||||
### With `yapack`
|
||||
|
||||
```sh
|
||||
ya pack -a stelcodes/bunny
|
||||
```
|
||||
|
||||
### With Nix (Home Manager + flakes)
|
||||
|
||||
`flake.nix`:
|
||||
```nix
|
||||
inputs = {
|
||||
bunny-yazi = {
|
||||
url = "github:stelcodes/bunny.yazi";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Home Manager config:
|
||||
```nix
|
||||
programs.yazi = {
|
||||
plugins.bunny = "${inputs.bunny-yazi}";
|
||||
initLua = ''
|
||||
require("bunny"):setup({ ... })
|
||||
'';
|
||||
keymap.mgr.prepend_keymap = [
|
||||
{ on = ";"; run = "plugin bunny"; desc = "Start bunny.yazi"; }
|
||||
];
|
||||
};
|
||||
```
|
||||
|
||||
## Configuration
|
||||
`~/.config/yazi/init.lua`:
|
||||
```lua
|
||||
require("bunny"):setup({
|
||||
hops = {
|
||||
{ key = "/", path = "/", },
|
||||
{ key = "t", path = "/tmp", },
|
||||
{ key = "n", path = "/nix/store", desc = "Nix store" },
|
||||
{ key = "~", path = "~", desc = "Home" },
|
||||
{ key = "m", path = "~/Music", desc = "Music" },
|
||||
{ key = "d", path = "~/Desktop", desc = "Desktop" },
|
||||
{ key = "D", path = "~/Documents", desc = "Documents" },
|
||||
{ key = "c", path = "~/.config", desc = "Config files" },
|
||||
{ key = { "l", "s" }, path = "~/.local/share", desc = "Local share" },
|
||||
{ key = { "l", "b" }, path = "~/.local/bin", desc = "Local bin" },
|
||||
{ key = { "l", "t" }, path = "~/.local/state", desc = "Local state" },
|
||||
-- key and path attributes are required, desc is optional
|
||||
},
|
||||
desc_strategy = "path", -- If desc isn't present, use "path" or "filename", default is "path"
|
||||
ephemeral = true, -- Enable ephemeral hops, default is true
|
||||
tabs = true, -- Enable tab hops, default is true
|
||||
notify = false, -- Notify after hopping, default is false
|
||||
fuzzy_cmd = "fzf", -- Fuzzy searching command, default is "fzf"
|
||||
})
|
||||
```
|
||||
|
||||
`~/.config/yazi/keymap.toml`:
|
||||
```toml
|
||||
[[mgr.prepend_keymap]]
|
||||
desc = "Start bunny.yazi"
|
||||
on = ";"
|
||||
run = "plugin bunny"
|
||||
|
||||
# Optionally, add another keymap to immediately fuzzy search bookmarks
|
||||
[[mgr.prepend_keymap]]
|
||||
desc = "Start bunny.yazi fuzzy search"
|
||||
on = "'"
|
||||
run = "plugin bunny fuzzy"
|
||||
```
|
||||
|
||||
## Inspiration
|
||||
|
||||
[yamb.yazi](https://github.com/h-hg/yamb.yazi)
|
||||
|
||||
[nnn bookmarks](https://github.com/jarun/nnn/wiki/Basic-use-cases#add-bookmarks)
|
||||
@@ -1,385 +0,0 @@
|
||||
--- @since 25.5.28
|
||||
local function debug(...)
|
||||
local function toReadableString(val)
|
||||
if type(val) == "table" then
|
||||
local str = "{ "
|
||||
for k, v in pairs(val) do
|
||||
str = str .. "[" .. tostring(k) .. "] = " .. toReadableString(v) .. ", "
|
||||
end
|
||||
return str .. "}"
|
||||
elseif type(val) == "Url" then
|
||||
return "Url:" .. tostring(val)
|
||||
else
|
||||
return tostring(val)
|
||||
end
|
||||
end
|
||||
local args = { ... }
|
||||
local processed_args = {}
|
||||
for _, arg in pairs(args) do
|
||||
table.insert(processed_args, toReadableString(arg))
|
||||
end
|
||||
ya.dbg("BUNNY.YAZI", table.unpack(processed_args))
|
||||
end
|
||||
local function fail(s, ...) ya.notify { title = "bunny.yazi", content = string.format(s, ...), timeout = 4, level = "error" } end
|
||||
local function info(s, ...) ya.notify { title = "bunny.yazi", content = string.format(s, ...), timeout = 2, level = "info" } end
|
||||
|
||||
local get_state = ya.sync(function(state, attr)
|
||||
return state[attr]
|
||||
end)
|
||||
|
||||
local set_state = ya.sync(function(state, attr, value)
|
||||
state[attr] = value
|
||||
end)
|
||||
|
||||
local get_cwd = ya.sync(function(state)
|
||||
return tostring(cx.active.current.cwd) -- Url objects are evil >.<"
|
||||
end)
|
||||
|
||||
local get_current_tab_idx = ya.sync(function(state)
|
||||
return cx.tabs.idx
|
||||
end)
|
||||
|
||||
local get_tabs_as_paths = ya.sync(function(state)
|
||||
local tabs = cx.tabs
|
||||
local active_tab_idx = tabs.idx
|
||||
local result = {}
|
||||
for idx = 1, #tabs, 1 do
|
||||
if idx ~= active_tab_idx and tabs[idx] then
|
||||
result[idx] = tostring(tabs[idx].current.cwd)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end)
|
||||
|
||||
local some = function(...)
|
||||
for _, v in ipairs({ ... }) do
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function filename(pathstr)
|
||||
if pathstr == "/" then return pathstr end
|
||||
local url_name = Url(pathstr):name()
|
||||
if url_name then
|
||||
return tostring(url_name)
|
||||
else
|
||||
return pathstr
|
||||
end
|
||||
end
|
||||
|
||||
local function path_to_desc(path, strategy)
|
||||
if strategy == "filename" then
|
||||
return filename(path)
|
||||
end
|
||||
local home = os.getenv("HOME")
|
||||
if home and home ~= "" then
|
||||
local startPos, endPos = string.find(path, home)
|
||||
-- Only substitute if the match is from the start of path, very important
|
||||
if startPos == 1 then
|
||||
return "~" .. path:sub(endPos + 1)
|
||||
end
|
||||
end
|
||||
return tostring(path)
|
||||
end
|
||||
|
||||
local function sort_hops(hops)
|
||||
local function convert_key(key)
|
||||
local t = type(key)
|
||||
if t == "table" then
|
||||
-- If table, sort by first key string
|
||||
return key[1]
|
||||
elseif t == "string" and string.lower(key) ~= key then
|
||||
-- If uppercase letter (signifying an ephemeral hop), prepend "z"
|
||||
-- so it gets sorted after lowercase persistent hops
|
||||
return "z" .. key
|
||||
end
|
||||
return key
|
||||
end
|
||||
table.sort(hops, function(x, y)
|
||||
return convert_key(x.key) < convert_key(y.key)
|
||||
end)
|
||||
return hops
|
||||
end
|
||||
|
||||
local create_special_hops = function(config)
|
||||
local hops = {}
|
||||
local desc_strategy, tabs, ephemeral = config.desc_strategy, config.tabs, config.ephemeral
|
||||
if ephemeral then
|
||||
table.insert(hops, { key = "<Enter>", desc = "Create hop", path = "__MARK__" })
|
||||
end
|
||||
table.insert(hops, { key = "<Space>", desc = "Fuzzy search", path = "__FUZZY__" })
|
||||
local tabhist = get_state("tabhist")
|
||||
local tab = get_current_tab_idx()
|
||||
if tabhist[tab] and tabhist[tab][2] then
|
||||
local previous_dir = tabhist[tab][2]
|
||||
table.insert(hops, {
|
||||
key = "<Backspace>",
|
||||
path = previous_dir,
|
||||
desc = path_to_desc(previous_dir, desc_strategy)
|
||||
})
|
||||
end
|
||||
if tabs then
|
||||
for idx, tab_path in pairs(get_tabs_as_paths()) do
|
||||
table.insert(hops, {
|
||||
key = tostring(idx),
|
||||
path = tab_path,
|
||||
desc = path_to_desc(tab_path, desc_strategy)
|
||||
})
|
||||
end
|
||||
end
|
||||
return hops
|
||||
end
|
||||
|
||||
local function validate_options(options)
|
||||
local function validate_key(key)
|
||||
local kt = type(key)
|
||||
if not key then
|
||||
return false, "key is missing"
|
||||
elseif kt == "string" then
|
||||
if utf8.len(key) ~= 1 then
|
||||
return false, "key must be single character"
|
||||
end
|
||||
elseif kt == "table" then
|
||||
if #key == 0 then
|
||||
return false, "key cannot be empty table"
|
||||
end
|
||||
for _, char in pairs(key) do
|
||||
if utf8.len(char) ~= 1 then
|
||||
return false, "key list must contain single characters"
|
||||
end
|
||||
end
|
||||
else
|
||||
return false, "key must be string or table"
|
||||
end
|
||||
return true, ""
|
||||
end
|
||||
if type(options) ~= "table" then
|
||||
return "Invalid config"
|
||||
end
|
||||
local hops, desc_strategy, tabs, ephemeral, fuzzy_cmd, notify =
|
||||
options.hops, options.desc_strategy, options.tabs,
|
||||
options.ephemeral, options.fuzzy_cmd, options.notify
|
||||
-- Validate hops
|
||||
if type(hops) == "table" then
|
||||
local used_keys = {}
|
||||
for idx, hop in pairs(hops) do
|
||||
hop.desc = hop.desc or hop.tag or nil -- used to be tag, allow for backwards compat
|
||||
local key_is_validated, key_err = validate_key(hop.key)
|
||||
local err = 'Invalid "hops" config value: #' .. idx .. " "
|
||||
if not key_is_validated then
|
||||
return err .. key_err
|
||||
elseif not hop.path then
|
||||
return err .. 'path is missing'
|
||||
elseif type(hop.path) ~= "string" or string.len(hop.path) == 0 then
|
||||
return err .. 'path must be non-empty string'
|
||||
elseif hop.desc and (type(hop.desc) ~= "string" or string.len(hop.path) == 0) then
|
||||
return err .. 'desc must be non-empty string'
|
||||
end
|
||||
-- Check for duplicate keys
|
||||
if used_keys[hop.key] then
|
||||
return err .. 'needs unique key'
|
||||
end
|
||||
-- Insert hop keys as table keys to easily check for set membership
|
||||
used_keys[hop.key] = true
|
||||
end
|
||||
else
|
||||
return 'Invalid "hops" config value'
|
||||
end
|
||||
-- Validate other options
|
||||
if desc_strategy ~= nil and desc_strategy ~= "path" and desc_strategy ~= "filename" then
|
||||
return 'Invalid "desc_strategy" config value'
|
||||
elseif tabs ~= nil and type(notify) ~= "boolean" then
|
||||
return 'Invalid "tabs" config value'
|
||||
elseif ephemeral ~= nil and type(notify) ~= "boolean" then
|
||||
return 'Invalid "ephemeral" config value'
|
||||
elseif fuzzy_cmd ~= nil and type(fuzzy_cmd) ~= "string" then
|
||||
return 'Invalid "fuzzy_cmd" config value'
|
||||
elseif notify ~= nil and type(notify) ~= "boolean" then
|
||||
return 'Invalid "notify" config value'
|
||||
end
|
||||
end
|
||||
|
||||
-- https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/fzf.lua
|
||||
-- https://github.com/sxyazi/yazi/blob/main/yazi-plugin/src/process/child.rs
|
||||
-- Returns nil if fzf command failed or user exited with escape key
|
||||
local select_fuzzy = function(hops, config)
|
||||
local permit = ui.hide()
|
||||
local child, spawn_err =
|
||||
Command(config.fuzzy_cmd):stdin(Command.PIPED):stdout(Command.PIPED):stderr(Command.INHERIT):spawn()
|
||||
if not child then
|
||||
fail("Command `%s` failed with code %s. Do you have it installed?", config.fuzzy_cmd, spawn_err.code)
|
||||
return
|
||||
end
|
||||
local fuzzy_entries = {}
|
||||
for _, hop in pairs(hops) do
|
||||
local existing_desc = fuzzy_entries[hop.path]
|
||||
if not existing_desc or existing_desc == "" then
|
||||
local fuzzy_desc = hop.desc
|
||||
-- Avoid repeating path in description
|
||||
if fuzzy_desc == hop.path then
|
||||
fuzzy_desc = ""
|
||||
end
|
||||
fuzzy_entries[hop.path] = fuzzy_desc
|
||||
end
|
||||
end
|
||||
-- Build fzf input string
|
||||
local input_lines = {}
|
||||
for entry_path, entry_desc in pairs(fuzzy_entries) do
|
||||
local line = entry_desc .. string.rep(" ", 23 - #entry_desc) .. "\t" .. entry_path
|
||||
table.insert(input_lines, line)
|
||||
end
|
||||
child:write_all(table.concat(input_lines, "\n"))
|
||||
child:flush()
|
||||
local output, output_err = child:wait_with_output()
|
||||
permit:drop()
|
||||
if not output.status.success then
|
||||
if output.status.code ~= 130 then -- user pressed escape to quit
|
||||
fail("Command `%s` failed with code %s", config.fuzzy_cmd, output_err.code)
|
||||
end
|
||||
return
|
||||
end
|
||||
-- Parse fzf output, remove right padded spaces from desc
|
||||
local desc, path = string.match(output.stdout, "^(.-) *\t(.-)\n$")
|
||||
if not desc or not path or path == "" then
|
||||
fail("Failed to parse fuzzy searcher result")
|
||||
return
|
||||
end
|
||||
if desc == "" then
|
||||
desc = path_to_desc(path, config.desc_strategy)
|
||||
end
|
||||
return { desc = desc, path = path }
|
||||
end
|
||||
|
||||
local cd = function(selected_hop, config)
|
||||
local _, dir_list_err = fs.read_dir(Url(selected_hop.path), { limit = 1, resolve = true })
|
||||
if dir_list_err then
|
||||
fail("Invalid directory " .. path_to_desc(selected_hop.path))
|
||||
return
|
||||
end
|
||||
-- Assuming that if I can fs.read_dir, then this will also succeed
|
||||
ya.emit("cd", { selected_hop.path })
|
||||
if config.notify then
|
||||
info('Hopped to ' .. selected_hop.desc)
|
||||
end
|
||||
end
|
||||
|
||||
local attempt_hop = function(hops, config)
|
||||
local cands = {}
|
||||
for _, hop in pairs(create_special_hops(config)) do
|
||||
table.insert(cands, { desc = hop.desc, on = hop.key, path = hop.path })
|
||||
end
|
||||
for _, hop in pairs(hops) do
|
||||
table.insert(cands, { desc = hop.desc, on = hop.key, path = hop.path })
|
||||
end
|
||||
local hops_idx = ya.which { cands = cands }
|
||||
if not hops_idx then return end
|
||||
local selected_hop = cands[hops_idx]
|
||||
-- Handle special hops
|
||||
if selected_hop.path == "__MARK__" then
|
||||
local mark_cands = {};
|
||||
-- Ideally any unicode character would be supported, but yazi.which
|
||||
-- requies a concrete list of candidates
|
||||
local candidate_chars = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
|
||||
'W', 'X', 'Y', 'Z', '`', '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
|
||||
'-', '_', '=', '+', '[', '{', ']', '}', '\\', '|', ';', ':', "'", '"', ',', '<',
|
||||
'.', '>', '/', '?', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
|
||||
}
|
||||
for _, char in pairs(candidate_chars) do
|
||||
table.insert(mark_cands, { on = char })
|
||||
end
|
||||
info("Press a key to create new hop")
|
||||
local char_idx = ya.which { cands = mark_cands, silent = true }
|
||||
if char_idx ~= nil then
|
||||
local selected_char = mark_cands[char_idx].on
|
||||
local cwd = get_cwd()
|
||||
table.insert(hops, { key = selected_char, path = cwd, desc = path_to_desc(cwd, config.desc_strategy) })
|
||||
set_state("hops", sort_hops(hops))
|
||||
end
|
||||
return
|
||||
elseif selected_hop.path == "__FUZZY__" then
|
||||
local fuzzy_hop = select_fuzzy(hops, config)
|
||||
if not fuzzy_hop then return end
|
||||
selected_hop = fuzzy_hop
|
||||
end
|
||||
cd(selected_hop, config)
|
||||
end
|
||||
|
||||
local function init()
|
||||
local options = get_state("options")
|
||||
local err = validate_options(options)
|
||||
if err then
|
||||
set_state("init_error", err)
|
||||
fail(err)
|
||||
return
|
||||
end
|
||||
-- Set default config values
|
||||
local desc_strategy = options.desc_strategy or "path"
|
||||
set_state("config", {
|
||||
desc_strategy = desc_strategy,
|
||||
fuzzy_cmd = some(options.fuzzy_cmd, "fzf"),
|
||||
notify = some(options.notify, false),
|
||||
ephemeral = some(options.ephemeral, true),
|
||||
tabs = some(options.tabs, true),
|
||||
})
|
||||
-- Set hops after ensuring they all have a description
|
||||
local hops = {}
|
||||
for _, hop in pairs(options.hops) do
|
||||
hop.desc = hop.desc or path_to_desc(hop.path, desc_strategy)
|
||||
-- Manually replace ~ from users so we can make a valid Url later to check if dir exists
|
||||
if string.sub(hop.path, 1, 1) == "~" then
|
||||
hop.path = os.getenv("HOME") .. hop.path:sub(2)
|
||||
end
|
||||
table.insert(hops, hop)
|
||||
end
|
||||
set_state("hops", sort_hops(hops))
|
||||
set_state("init", true)
|
||||
end
|
||||
|
||||
return {
|
||||
setup = function(state, options)
|
||||
state.options = options
|
||||
ps.sub("cd", function(body)
|
||||
-- Note: This callback is sync and triggered at startup!
|
||||
local tab = body.tab -- type number
|
||||
-- Very important to turn this into a string because Url has ownership issues
|
||||
-- when passed to standard utility functions >.<'
|
||||
-- https://github.com/sxyazi/yazi/issues/2159
|
||||
local cwd = tostring(cx.active.current.cwd)
|
||||
-- Upon startup this will be nil so initialize if necessary
|
||||
local tabhist = state.tabhist or {}
|
||||
-- tabhist structure:{ <tab_index> = { <current_dir>, <previous_dir?> }, ... }
|
||||
if not tabhist[tab] then
|
||||
-- If fresh tab, initialize tab history table
|
||||
tabhist[tab] = { cwd }
|
||||
else
|
||||
-- Otherwise, shift history table to the right and add cwd to the front
|
||||
tabhist[tab] = { cwd, tabhist[tab][1] }
|
||||
end
|
||||
state.tabhist = tabhist
|
||||
end)
|
||||
end,
|
||||
entry = function(self, job)
|
||||
if not get_state("init") then
|
||||
init()
|
||||
end
|
||||
local init_error = get_state("init_error")
|
||||
if init_error then
|
||||
fail(init_error)
|
||||
return
|
||||
end
|
||||
local hops, config = get_state("hops"), get_state("config")
|
||||
if job.args[1] == "fuzzy" then
|
||||
local fuzzy_hop = select_fuzzy(hops, config)
|
||||
if fuzzy_hop then
|
||||
cd(fuzzy_hop, config)
|
||||
end
|
||||
else
|
||||
attempt_hop(hops, config)
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Rolv Apneseth
|
||||
|
||||
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.
|
||||
@@ -1,50 +0,0 @@
|
||||
# bypass.yazi
|
||||
|
||||
[Yazi](https://github.com/sxyazi/yazi) plugin for bidirectional skipping of directories which only have a single subdirectory
|
||||
|
||||
<https://github.com/Rolv-Apneseth/bypass.yazi/assets/69486699/5487537b-fe01-40e9-bc34-4d1116b491b5>
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Yazi](https://github.com/sxyazi/yazi) v25.3.2+
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
ya pkg add Rolv-Apneseth/bypass
|
||||
```
|
||||
|
||||
### Manual
|
||||
|
||||
```sh
|
||||
# Linux / MacOS
|
||||
git clone https://github.com/Rolv-Apneseth/bypass.yazi.git ~/.config/yazi/plugins/bypass.yazi
|
||||
# Windows
|
||||
git clone https://github.com/Rolv-Apneseth/bypass.yazi.git %AppData%\yazi\config\plugins\bypass.yazi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add this to your `keymap.toml`:
|
||||
|
||||
```toml
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "L" ]
|
||||
run = "plugin bypass"
|
||||
desc = "Recursively enter child directory, skipping children with only a single subdirectory"
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "H" ]
|
||||
run = "plugin bypass reverse"
|
||||
desc = "Recursively enter parent directory, skipping parents with only a single subdirectory"
|
||||
```
|
||||
|
||||
And that's it. You can bind any key you like, including overriding the default `enter` and `leave` bindings by setting them to `l` and `h` respectively.
|
||||
|
||||
Note that if you're using the [smart enter tip](https://yazi-rs.github.io/docs/tips#smart-enter) from the documentation, this plugin can replace that entirely by using this keybind instead:
|
||||
|
||||
```toml
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "l" ]
|
||||
run = "plugin bypass smart-enter"
|
||||
desc = "Open a file, or recursively enter child directory, skipping children with only a single subdirectory"
|
||||
```
|
||||
@@ -1,106 +0,0 @@
|
||||
---@since 25.3.2
|
||||
|
||||
-- For development
|
||||
--[[ local function notify(message) ]]
|
||||
--[[ ya.notify({ title = "Bypass", content = message, timeout = 5 }) ]]
|
||||
--[[ end ]]
|
||||
|
||||
-- `ya.emit` as of 25.5.28
|
||||
local emit = ya.emit or ya.manager_emit
|
||||
|
||||
---Returns the loading state of the current directory
|
||||
---@type fun(): boolean
|
||||
local is_directory_loading = ya.sync(function(_)
|
||||
-- Try to use the v25.4.8 interface
|
||||
local ok, res = pcall(cx.active.current.stage)
|
||||
if ok then
|
||||
return not res
|
||||
-- Fallback to the v25.3.2 interface
|
||||
else
|
||||
return cx.active.current.stage.is_loading
|
||||
end
|
||||
end)
|
||||
|
||||
---Enter hovered item if it is a directory
|
||||
---@type fun(use_smart_enter: boolean): boolean
|
||||
local initial = ya.sync(function(_, use_smart_enter)
|
||||
local hovered = cx.active.current.hovered
|
||||
if hovered == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
if not hovered.cha.is_dir then
|
||||
-- Open file if using "smart enter"
|
||||
if use_smart_enter then
|
||||
emit("escape", { visual = true, select = true })
|
||||
emit("open", { hovered = true })
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
emit("escape", { visual = true, select = true })
|
||||
emit("enter", { hovered = true })
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
---Enter hovered item if it is a directory and is the only item in the parent
|
||||
---@type fun(): boolean
|
||||
local bypass = ya.sync(function(_)
|
||||
local hovered = cx.active.current.hovered
|
||||
|
||||
if hovered == nil or not hovered.cha.is_dir or #cx.active.current.files > 1 then
|
||||
return false
|
||||
end
|
||||
|
||||
emit("enter", { hovered = true })
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
---Leave the CWD, if the CWD has a parent
|
||||
---@type fun(): boolean
|
||||
local initial_rev = ya.sync(function(_)
|
||||
if cx.active.parent == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
emit("escape", { visual = true, select = true })
|
||||
emit("leave", {})
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
---Leave the CWD, if the CWD has a parent and contains only one item
|
||||
---@type fun(): boolean
|
||||
local bypass_rev = ya.sync(function(_)
|
||||
if cx.active.parent == nil or #cx.active.current.files > 1 then
|
||||
return false
|
||||
end
|
||||
|
||||
emit("leave", {})
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
return {
|
||||
entry = function(_, job)
|
||||
-- old version of Yazi will pass args directly, new version passes job. Below code ensures we derive args in both 0.3 and 0.4 Yazi API versions.
|
||||
local args = job.args or job
|
||||
local use_smart_enter = args and args[1] == "smart-enter"
|
||||
local is_reverse = args and args[1] == "reverse"
|
||||
|
||||
-- Initial run, should behave like a regular enter/smart-enter/leave
|
||||
local run = is_reverse and initial_rev() or initial(use_smart_enter)
|
||||
|
||||
while run do
|
||||
-- Wait for directory to have loaded
|
||||
while is_directory_loading() do
|
||||
ya.sleep(0.002)
|
||||
end
|
||||
|
||||
-- Conditional enter/smart-enter/leave
|
||||
run = is_reverse and bypass_rev() or bypass()
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Mshnwq
|
||||
|
||||
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.
|
||||
@@ -1,221 +0,0 @@
|
||||
# Dupes Plugin for Yazi
|
||||
|
||||
Duplicate files plugin for [Yazi](https://github.com/sxyazi/yazi) file manager, leveraging [jdupes](https://codeberg.org/jbruchon/jdupes) for fast and efficient duplicate detection.
|
||||
|
||||
> [!NOTE]
|
||||
> The latest release of Yazi is required at the moment.
|
||||
|
||||
https://github.com/user-attachments/assets/1d87bb52-d326-4720-834c-baac74008d7d
|
||||
|
||||
## Features
|
||||
|
||||
- 🔍 **Fast Duplicate Detection** - Uses jdupes for high-performance scanning
|
||||
- 👁️ **Visual Preview** - See duplicates directly in Yazi with deletion markers
|
||||
- 🧪 **Dry Run Mode** - Preview what will be deleted before applying changes
|
||||
- ⚙️ **Profile System** - Define custom scanning or override profiles for different use cases
|
||||
- 💾 **Export Results** - Save scan results to JSON or text files
|
||||
- 🔒 **Safe by Default** - Confirmation required for destructive operations
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Yazi](https://github.com/sxyazi/yazi) file manager (v25.5.31+)
|
||||
- [jdupes](https://codeberg.org/jbruchon/jdupes) command-line tool
|
||||
|
||||
## Installation
|
||||
|
||||
**Using yazi package manager:**
|
||||
```sh
|
||||
ya pkg add mshnwq/dupes
|
||||
```
|
||||
|
||||
**Using nix home-manager (nixpkgs): (recommended)**
|
||||
```nix
|
||||
{ pkgs, ... }: {
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
plugins = {
|
||||
# jdupes is self contained within
|
||||
dupes = pkgs.yaziPlugins.dupes
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**Using nix home-manager (github):**
|
||||
```nix
|
||||
{ pkgs, ... }: {
|
||||
home.packages = with pkgs; [ jdupes ];
|
||||
programs.yazi = {
|
||||
enable = true;
|
||||
plugins = {
|
||||
dupes = pkgs.fetchFromGitHub {
|
||||
owner = "mshnwq";
|
||||
repo = "dupes.yazi";
|
||||
rev = "4666b6f299c2257c011f622319ae97fab8adbabe";
|
||||
hash = "sha256-v9xuSY/i/trIHHbOPbijd0AmcUb2vufNL9BSjBE6+Vo=";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**Manual installation:**
|
||||
```sh
|
||||
git clone https://github.com/mshnwq/dupes.yazi.git ~/.config/yazi/plugins/dupes.yazi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Configuration in `~/.config/yazi/init.lua`:
|
||||
```lua
|
||||
require("dupes"):setup {
|
||||
-- Global settings
|
||||
save_op = false, -- Save results to file by default
|
||||
-- auto_confirm = true, -- Skip confirmation for apply (use with caution!)
|
||||
|
||||
profiles = {
|
||||
-- Interactive mode: recursively scan and display duplicates
|
||||
interactive = {
|
||||
args = { "-r" },
|
||||
},
|
||||
-- Apply mode: recursively scan and DELETE duplicates
|
||||
apply = {
|
||||
args = { "-r", "-N", "-d" },
|
||||
save_op = true, -- Save results before deletion
|
||||
},
|
||||
-- Custom profile example (uncomment to use)
|
||||
-- custom = {
|
||||
-- args = { "-r", "-s", }, -- Your custom jdupes flags
|
||||
-- },
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Keybindings in `~/.config/yazi/keymap.toml`:
|
||||
```toml
|
||||
[[manager.prepend_keymap]]
|
||||
on = ["<A-J>", "i"]
|
||||
run = "plugin dupes interactive"
|
||||
desc = "Run dupes interactive"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = ["<A-J>", "o"]
|
||||
run = "plugin dupes override"
|
||||
desc = "Run dupes override"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = ["<A-J>", "d"]
|
||||
run = "plugin dupes dry"
|
||||
desc = "Run dupes dry"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = ["<A-J>", "a"]
|
||||
run = "plugin dupes apply"
|
||||
desc = "Run dupes apply"
|
||||
|
||||
# [[mgr.prepend_keymap]]
|
||||
# on = ["<A-J>", "c"]
|
||||
# run = "plugin dupes custom"
|
||||
# desc = "Run dupes custom"
|
||||
```
|
||||
|
||||
### Profiles
|
||||
|
||||
#### 🔍 Interactive Mode
|
||||
Scans for duplicates and displays them in Yazi. Safe to use - no files are deleted.
|
||||
|
||||
```lua
|
||||
interactive = {
|
||||
args = { "-r" }, -- Recursive scan
|
||||
}
|
||||
```
|
||||
#### 🧪 Dry Run Mode (inherits apply mode)
|
||||
Shows what **would** be deleted using the same settings as apply mode. Files marked 'X' will be deleted. The first file in each duplicate set is kept.
|
||||
|
||||
- Normal files: displayed normally (will be kept)
|
||||
- Files marked 'X': will be deleted
|
||||
|
||||
#### ⚠️ Apply Mode
|
||||
**DESTRUCTIVE OPERATION** - Permanently deletes duplicate files.
|
||||
|
||||
```lua
|
||||
apply = {
|
||||
args = { "-r", "-N", "-d" },
|
||||
save_op = true, -- Saves results to dupes.json
|
||||
}
|
||||
```
|
||||
|
||||
#### 🛠️ Override Mode
|
||||
Opens an input dialog where you can enter custom jdupes arguments for one-time scans.
|
||||
|
||||
**Example inputs:**
|
||||
- `-r -s` - Recursive, follow symlinks
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### Global Settings
|
||||
|
||||
```lua
|
||||
require("dupes"):setup {
|
||||
save_op = false, -- Default: don't save results to file
|
||||
auto_confirm = false, -- Default: prompt before deletion
|
||||
profiles = {
|
||||
-- Your profiles here
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### Profile Settings
|
||||
|
||||
Each profile can have:
|
||||
|
||||
```lua
|
||||
profile_name = {
|
||||
args = { "-r", "-N" }, -- jdupes command arguments
|
||||
save_op = true, -- Override global save_op for this profile
|
||||
}
|
||||
```
|
||||
|
||||
### Common jdupes Flags
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-r` | Recursive search in subdirectories |
|
||||
| `-d` | **DELETE duplicates (DESTRUCTIVE!)** |
|
||||
| `-j` | JSON output (added by plugin) |
|
||||
| `-s` | Follows symbolic links |
|
||||
|
||||
See `jdupes --help` for complete flag list.
|
||||
|
||||
## Custom Examples
|
||||
|
||||
### Example: Find duplicates in current directory only
|
||||
```lua
|
||||
shallow = {
|
||||
args = {}, -- No -r flag, current directory only
|
||||
}
|
||||
```
|
||||
|
||||
## Output Files
|
||||
|
||||
When `save_op = true`, results are saved to:
|
||||
|
||||
- **dupes.json** - JSON format
|
||||
- **dupes.txt** - Text format (when destructive)
|
||||
|
||||
Files are saved in the current working directory.
|
||||
|
||||
## License
|
||||
|
||||
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||
|
||||
## Credits
|
||||
|
||||
- [Yazi](https://github.com/sxyazi/yazi) file manager
|
||||
- [jdupes](https://codeberg.org/jbruchon/jdupes) for duplicate detection
|
||||
- [boydaihungst](https://github.com/boydaihungst) for help on Yazi's [Discord](https://discord.gg/qfADduSdJu) channel
|
||||
|
||||
## See Also
|
||||
|
||||
- [jdupes Documentation](https://codeberg.org/jbruchon/jdupes)
|
||||
- [Yazi Plugins](https://yazi-rs.github.io/docs/plugins/overview)
|
||||
@@ -1,600 +0,0 @@
|
||||
--- Dupes Plugin: Dynamic jdupes runner for Yazi file manager
|
||||
--- @since 25.5.31
|
||||
--- @description Finds and manages duplicate files using jdupes
|
||||
|
||||
local M = {}
|
||||
|
||||
-- ============================================================================
|
||||
-- STATE MANAGEMENT
|
||||
-- ============================================================================
|
||||
|
||||
--- Thread-safe state setter
|
||||
--- @param state table The global state object
|
||||
--- @param key string State key to set
|
||||
--- @param value any Value to store
|
||||
local set_state = ya.sync(function(state, key, value) state[key] = value end)
|
||||
|
||||
--- Thread-safe state getter
|
||||
--- @param state table The global state object
|
||||
--- @param key string State key to retrieve
|
||||
--- @return any The stored value
|
||||
local get_state = ya.sync(function(state, key) return state[key] end)
|
||||
|
||||
--- Get current working directory from Yazi context
|
||||
--- @return string Current working directory path
|
||||
local get_cwd = ya.sync(function() return cx.active.current.cwd end)
|
||||
|
||||
-- ============================================================================
|
||||
-- DISPLAY FUNCTIONS
|
||||
-- ============================================================================
|
||||
|
||||
--- Display duplicate files in Yazi's file list
|
||||
--- @param _cwd string Current working directory
|
||||
--- @param data table Parsed JSON data from jdupes output
|
||||
--- @param style boolean If true, shows dry-run preview with deletion markers
|
||||
local function display_dupes(_cwd, data, style)
|
||||
-- Validate input data structure
|
||||
if not data or not data.matchSets then
|
||||
ya.dbg("Invalid or missing matchSets in JSON data")
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = "Invalid JSON data: no matchSets",
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
ya.dbg(string.format("Entering display_dupes, cwd: %s", _cwd))
|
||||
|
||||
-- Create unique ID for this file operation
|
||||
local id = ya.id("ft")
|
||||
|
||||
-- Set search context title based on mode
|
||||
local cwd
|
||||
if style then
|
||||
cwd = _cwd:into_search("Duplicate files Dry Run Preview 'X means will be deleted'")
|
||||
else
|
||||
cwd = _cwd:into_search("Duplicate files")
|
||||
end
|
||||
|
||||
-- Navigate to the search view
|
||||
ya.emit("cd", { Url(cwd) })
|
||||
|
||||
-- Initialize empty file list
|
||||
ya.emit("update_files", {
|
||||
op = fs.op("part", { id = id, url = Url(cwd), files = {} }),
|
||||
})
|
||||
|
||||
-- Build file list from duplicate sets
|
||||
local files = {}
|
||||
for i, matchSet in ipairs(data.matchSets) do
|
||||
local dupe_set = string.format("dup-set-%02d", i)
|
||||
ya.dbg(string.format("Processing group: %s", dupe_set))
|
||||
|
||||
-- Process each file in the duplicate set
|
||||
for j, fileObj in ipairs(matchSet.fileList) do
|
||||
local url = Url(cwd):join(fileObj.filePath)
|
||||
local cha = fs.cha(url, true)
|
||||
|
||||
local file
|
||||
if style then
|
||||
-- In dry-run mode, mark files for deletion (except first one)
|
||||
if j == 1 then
|
||||
-- First file in set: keep it (normal display)
|
||||
file = File { url = url, cha = cha }
|
||||
else
|
||||
-- Subsequent files: mark as dummy (will be deleted)
|
||||
local dcha = Cha {
|
||||
kind = 16,
|
||||
is_dummy = true,
|
||||
len = cha.len,
|
||||
gid = cha.gid,
|
||||
uid = cha.uid,
|
||||
atime = cha.atime,
|
||||
btime = cha.btime,
|
||||
mtime = cha.mtime,
|
||||
perm = cha.perm,
|
||||
}
|
||||
file = File { url = url, cha = dcha }
|
||||
end
|
||||
else
|
||||
-- Normal mode: display all files equally
|
||||
file = File { url = url, cha = cha }
|
||||
end
|
||||
|
||||
table.insert(files, file)
|
||||
ya.dbg(string.format("[Dupes] Added file %s", file.url))
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the file list in Yazi
|
||||
ya.emit("update_files", {
|
||||
op = fs.op("part", { id = id, url = Url(cwd), files = files }),
|
||||
})
|
||||
|
||||
-- NOTE: Finalization with 'done' operation breaks file ordering
|
||||
-- Keeping these commented for future investigation
|
||||
-- ya.emit("update_files", {
|
||||
-- op = fs.op("done", {
|
||||
-- id = id,
|
||||
-- url = Url(cwd),
|
||||
-- cha = Cha({ kind = 16, mode = tonumber("100644", 8) })
|
||||
-- })
|
||||
-- })
|
||||
|
||||
-- Show notification with results
|
||||
local mode_text = style and " (DRY RUN)" or ""
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Found %d files%s", #files, mode_text),
|
||||
level = "info",
|
||||
timeout = 3,
|
||||
}
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- FILE SAVING FUNCTIONS
|
||||
-- ============================================================================
|
||||
|
||||
--- Save jdupes output to file (JSON or plain text)
|
||||
--- @param cwd string Directory to save the file in
|
||||
--- @param stdout string Raw output from jdupes
|
||||
--- @param format string Output format: "json" or "txt"
|
||||
--- @return boolean success True if file was saved successfully
|
||||
local function save_output(cwd, stdout, format)
|
||||
-- Validate format
|
||||
format = format or "json"
|
||||
if format ~= "json" and format ~= "txt" then
|
||||
ya.err(string.format("Invalid format '%s', defaulting to 'json'", format))
|
||||
format = "json"
|
||||
end
|
||||
|
||||
-- Construct file path
|
||||
local file_path = string.format("%s/dupes.%s", cwd, format)
|
||||
|
||||
-- Attempt to write file
|
||||
local file, err = io.open(file_path, "w")
|
||||
if not file then
|
||||
ya.err(string.format("Failed to write dupes.%s to %s: %s", format, file_path, err or "unknown error"))
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Failed to save file: %s", err or "unknown error"),
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
}
|
||||
return false
|
||||
end
|
||||
|
||||
-- Write content and close
|
||||
file:write(stdout)
|
||||
file:close()
|
||||
|
||||
-- Success notification
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Saved dupes.%s to %s", format, file_path),
|
||||
level = "info",
|
||||
timeout = 3,
|
||||
}
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- COMMAND BUILDING AND VALIDATION
|
||||
-- ============================================================================
|
||||
|
||||
--- Build final command arguments with proper flag handling
|
||||
--- @param args table User-provided arguments
|
||||
--- @param no_json boolean Whether to exclude JSON flag
|
||||
--- @return table Final argument list
|
||||
local function build_command_args(args, no_json)
|
||||
-- Check if JSON flag already exists
|
||||
local has_j_flag = false
|
||||
for _, arg in ipairs(args) do
|
||||
if arg:match("^%-[^-]*j") or arg == "-j" then
|
||||
has_j_flag = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- Build final argument list
|
||||
local final_args = {}
|
||||
|
||||
-- Add JSON flag if needed and not disabled
|
||||
if not has_j_flag and not no_json then
|
||||
table.insert(final_args, "-j")
|
||||
end
|
||||
|
||||
-- Add all user arguments
|
||||
for _, arg in ipairs(args) do
|
||||
table.insert(final_args, arg)
|
||||
end
|
||||
|
||||
return final_args
|
||||
end
|
||||
|
||||
--- Execute shell command with proper error handling
|
||||
--- @param cmdline string Base command (e.g., "jdupes")
|
||||
--- @param args table Command arguments
|
||||
--- @return table Command result with status, stdout, stderr
|
||||
local function execute_command(cmdline, args)
|
||||
local argstr = table.concat(args, " ")
|
||||
local full_cmd = string.format("%s . %s 2>&1", cmdline, argstr)
|
||||
|
||||
ya.dbg(string.format("Executing: %s", full_cmd))
|
||||
|
||||
local cmd = Command(get_state("shell")):arg({ "-c", full_cmd }):stdout(Command.PIPED):stderr(Command.PIPED):output()
|
||||
|
||||
-- Log execution results
|
||||
ya.dbg(string.format("Exit code: %s", tostring(cmd.status.code)))
|
||||
|
||||
if cmd.stdout and #cmd.stdout > 0 then
|
||||
ya.dbg(string.format("STDOUT length: %d bytes", #cmd.stdout))
|
||||
end
|
||||
|
||||
if cmd.stderr and #cmd.stderr > 0 then
|
||||
ya.err(string.format("STDERR:\n%s", cmd.stderr))
|
||||
end
|
||||
|
||||
return cmd
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- CORE EXECUTION FUNCTION
|
||||
-- ============================================================================
|
||||
|
||||
--- Execute jdupes with given profile configuration
|
||||
--- @param profile_name string Name of the profile being run
|
||||
--- @param conf table Configuration with cmdline and args
|
||||
--- @param save_to_file boolean Whether to save output to file
|
||||
--- @param no_display boolean Whether to skip displaying results in Yazi
|
||||
--- @param no_json boolean Whether to output plain text instead of JSON
|
||||
local function run_dupes(profile_name, conf, save_to_file, no_display, no_json)
|
||||
-- Validate configuration
|
||||
if not conf then
|
||||
ya.err(string.format("ERROR: Profile '%s' configuration is nil!", profile_name))
|
||||
return
|
||||
end
|
||||
|
||||
if not conf.cmdline then
|
||||
ya.err(string.format("ERROR: Profile '%s' missing cmdline", profile_name))
|
||||
return
|
||||
end
|
||||
|
||||
-- Extract configuration with defaults
|
||||
local cmdline = conf.cmdline
|
||||
local args = conf.args or {}
|
||||
save_to_file = save_to_file or false
|
||||
no_display = no_display or false
|
||||
no_json = no_json or false
|
||||
|
||||
-- Build command arguments
|
||||
local final_args = build_command_args(args, no_json)
|
||||
|
||||
-- Execute command
|
||||
local cwd = get_cwd()
|
||||
local cmd = execute_command(cmdline, final_args)
|
||||
|
||||
-- Handle command results
|
||||
if cmd.status.success then
|
||||
-- Save output to file if requested
|
||||
if save_to_file then
|
||||
local format = no_json and "txt" or "json"
|
||||
save_output(cwd, cmd.stdout, format)
|
||||
end
|
||||
|
||||
-- Display results in Yazi unless suppressed
|
||||
if not no_display and not no_json then
|
||||
local parsed_data = ya.json_decode(cmd.stdout)
|
||||
if parsed_data then
|
||||
local is_dry_run = (profile_name == "dry")
|
||||
display_dupes(cwd, parsed_data, is_dry_run)
|
||||
else
|
||||
ya.err("Failed to parse JSON output from jdupes")
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = "Failed to parse command output",
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
}
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Success notification
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Profile '%s' completed successfully", profile_name),
|
||||
level = "info",
|
||||
timeout = 3,
|
||||
}
|
||||
else
|
||||
-- Error notification with details
|
||||
local error_msg = cmd.stderr or "(no error details available)"
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Command failed:\n%s", error_msg),
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- PROFILE HANDLING
|
||||
-- ============================================================================
|
||||
|
||||
--- Create dry-run configuration from apply profile
|
||||
--- @param apply_conf table Apply profile configuration
|
||||
--- @return table Dry-run configuration
|
||||
local function create_dry_config(apply_conf)
|
||||
local dry_args = {}
|
||||
|
||||
-- Copy all arguments except destructive ones
|
||||
for _, arg in ipairs(apply_conf.args) do
|
||||
if arg ~= "-d" and arg ~= "--delete" then
|
||||
table.insert(dry_args, arg)
|
||||
else
|
||||
ya.dbg(string.format("Excluded destructive flag: %s", arg))
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
cmdline = apply_conf.cmdline,
|
||||
args = dry_args,
|
||||
}
|
||||
end
|
||||
|
||||
--- Parse custom arguments from user input
|
||||
--- @param input string Space-separated argument string
|
||||
--- @return table Parsed arguments
|
||||
local function parse_custom_args(input)
|
||||
local args = {}
|
||||
for arg in input:gmatch("%S+") do
|
||||
table.insert(args, arg)
|
||||
end
|
||||
return args
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- UTILITY FUNCTIONS
|
||||
-- ============================================================================
|
||||
|
||||
--- Recursively dump table contents for debugging
|
||||
--- @param tbl table Table to dump
|
||||
--- @param indent number Current indentation level
|
||||
--- @return table Array of formatted lines
|
||||
local function dump_table(tbl, indent)
|
||||
indent = indent or 0
|
||||
local lines = {}
|
||||
local prefix = string.rep(" ", indent)
|
||||
|
||||
for k, v in pairs(tbl or {}) do
|
||||
if type(v) == "table" then
|
||||
table.insert(lines, string.format("%s%s = {", prefix, tostring(k)))
|
||||
for _, line in ipairs(dump_table(v, indent + 1)) do
|
||||
table.insert(lines, line)
|
||||
end
|
||||
table.insert(lines, string.format("%s},", prefix))
|
||||
else
|
||||
table.insert(lines, string.format("%s%s = %q,", prefix, tostring(k), tostring(v)))
|
||||
end
|
||||
end
|
||||
|
||||
return lines
|
||||
end
|
||||
|
||||
--- Count table entries
|
||||
--- @param tbl table Table to count
|
||||
--- @return number Number of entries
|
||||
local function count_table(tbl)
|
||||
local count = 0
|
||||
for _ in pairs(tbl or {}) do
|
||||
count = count + 1
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- PLUGIN LIFECYCLE FUNCTIONS
|
||||
-- ============================================================================
|
||||
|
||||
--- Initialize the plugin with user configuration
|
||||
--- Called from yazi/init.lua
|
||||
--- @param opts table Configuration options
|
||||
function M:setup(opts)
|
||||
opts = opts or {}
|
||||
|
||||
-- Set global options with defaults
|
||||
set_state("save_op", opts.save_op or false)
|
||||
set_state("auto_confirm", opts.auto_confirm or false)
|
||||
set_state("cmdline", "jdupes")
|
||||
set_state("shell", "bash")
|
||||
|
||||
ya.dbg("Dupes Plugin Setup: Starting profile processing")
|
||||
|
||||
-- Process and store user-defined profiles
|
||||
local profiles = {}
|
||||
if opts.profiles then
|
||||
for profile_name, profile_conf in pairs(opts.profiles) do
|
||||
-- Validate profile configuration
|
||||
if not profile_conf then
|
||||
ya.err(string.format("Profile '%s' has nil configuration, skipping", profile_name))
|
||||
else
|
||||
local profile = {
|
||||
cmdline = profile_conf.cmdline or get_state("cmdline"),
|
||||
args = profile_conf.args or {},
|
||||
-- Profile-specific save_op overrides global setting
|
||||
save_op = profile_conf.save_op ~= nil and profile_conf.save_op or get_state("save_op"),
|
||||
}
|
||||
profiles[profile_name] = profile
|
||||
|
||||
-- Log detailed profile configuration
|
||||
local profile_lines = dump_table(profile)
|
||||
ya.dbg(string.format("Setup profile '%s':\n%s", tostring(profile_name), table.concat(profile_lines, "\n")))
|
||||
end
|
||||
end
|
||||
else
|
||||
ya.dbg("Dupes Plugin Setup: No profiles provided in opts.profiles")
|
||||
end
|
||||
|
||||
set_state("profiles", profiles)
|
||||
|
||||
-- Log summary
|
||||
local profile_count = count_table(profiles)
|
||||
ya.dbg(string.format("Dupes Plugin Setup: Complete with %d profiles", profile_count))
|
||||
|
||||
-- Register custom linemode to show deletion markers
|
||||
-- Priority 1500 ensures it runs before most other linemodes
|
||||
Linemode:children_add(function(self)
|
||||
if not self._file.cha.is_dummy then
|
||||
-- Normal file: no marker
|
||||
return ""
|
||||
elseif self._file.is_hovered then
|
||||
-- Hovered dummy file: show black background 'X'
|
||||
return ui.Line { " ", ui.Span("X"):style(ui.Style():bg("black")) }
|
||||
else
|
||||
-- Non-hovered dummy file: show red 'X'
|
||||
return ui.Line({ " ", "X" }):style(ui.Style():fg("red"))
|
||||
end
|
||||
end, 1500)
|
||||
end
|
||||
|
||||
--- Main entry point when plugin is invoked
|
||||
--- @param job string|table Profile name or job configuration
|
||||
function M:entry(job)
|
||||
-- Exit visual mode if active
|
||||
ya.mgr_emit("escape", { visual = true })
|
||||
|
||||
-- Parse profile name from job argument
|
||||
local profile_name = "interactive" -- default profile
|
||||
if type(job) == "string" then
|
||||
profile_name = job
|
||||
elseif type(job) == "table" then
|
||||
profile_name = (type(job.args) == "table" and job.args[1])
|
||||
or (type(job.args) == "string" and job.args)
|
||||
or "interactive"
|
||||
end
|
||||
|
||||
ya.dbg(string.format("== Invoked profile: %s ==", profile_name))
|
||||
|
||||
-- ========================================================================
|
||||
-- SPECIAL PROFILE: override
|
||||
-- Allows user to input custom jdupes arguments interactively
|
||||
-- ========================================================================
|
||||
if profile_name == "override" then
|
||||
ya.dbg("INFO: Waiting for custom input")
|
||||
|
||||
local ov_args, ok = ya.input {
|
||||
title = "Dupes Override - Enter custom args",
|
||||
value = "-j",
|
||||
position = { "top-center", y = 3, w = 45 },
|
||||
}
|
||||
|
||||
if ok ~= 1 then
|
||||
ya.dbg("Override cancelled by user")
|
||||
return
|
||||
end
|
||||
|
||||
-- Parse and execute custom arguments
|
||||
local p_args = parse_custom_args(ov_args)
|
||||
run_dupes("override", {
|
||||
cmdline = get_state("cmdline"),
|
||||
args = p_args,
|
||||
}, get_state("save_op"))
|
||||
return
|
||||
end
|
||||
|
||||
-- ========================================================================
|
||||
-- SPECIAL PROFILE: dry
|
||||
-- Inherits 'apply' profile but removes destructive flags for preview
|
||||
-- ========================================================================
|
||||
if profile_name == "dry" then
|
||||
local profiles = get_state("profiles")
|
||||
local apply_conf = profiles["apply"]
|
||||
|
||||
if not apply_conf then
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = "Cannot run dry: 'apply' profile missing.",
|
||||
level = "error",
|
||||
timeout = 4,
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
-- Create dry-run configuration
|
||||
local dry_conf = create_dry_config(apply_conf)
|
||||
dry_conf.save_op = apply_conf.save_op
|
||||
|
||||
run_dupes("dry", dry_conf, dry_conf.save_op)
|
||||
return
|
||||
end
|
||||
|
||||
-- ========================================================================
|
||||
-- REGULAR PROFILE EXECUTION
|
||||
-- ========================================================================
|
||||
local profiles = get_state("profiles")
|
||||
local conf = profiles[profile_name]
|
||||
|
||||
if not conf then
|
||||
ya.err(string.format("ERROR: Profile '%s' not found", profile_name))
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = string.format("Profile not found: %s", profile_name),
|
||||
level = "error",
|
||||
timeout = 3,
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
-- ========================================================================
|
||||
-- SPECIAL PROFILE: apply
|
||||
-- Destructive operation - requires confirmation and runs dry preview first
|
||||
-- ========================================================================
|
||||
if profile_name == "apply" then
|
||||
-- Check for auto-confirm or prompt user
|
||||
local apply_confirm = get_state("auto_confirm")
|
||||
or ya.confirm {
|
||||
pos = { "center", y = -8, w = 36, h = 8 },
|
||||
title = "Confirm Deduplication operation?",
|
||||
content = ui.Text {
|
||||
ui.Line(""),
|
||||
ui.Line("This will DELETE duplicate files!"):style(ui.Style():fg("red")),
|
||||
ui.Line("If unsure, try dry run first"):style(th.confirm.content),
|
||||
ui.Line(""),
|
||||
},
|
||||
}
|
||||
|
||||
if not apply_confirm then
|
||||
ya.dbg("Apply cancelled by user")
|
||||
ya.notify {
|
||||
title = "Dupes Plugin",
|
||||
content = "Operation cancelled",
|
||||
level = "info",
|
||||
timeout = 3,
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
ya.dbg("Apply confirmed by user")
|
||||
|
||||
-- First, run silent dry-run preview for logging
|
||||
local dry_conf = create_dry_config(conf)
|
||||
run_dupes("dry", dry_conf, conf.save_op, true) -- no_display = true
|
||||
|
||||
-- Then execute actual deletion
|
||||
run_dupes(profile_name, conf, conf.save_op, true, true) -- no_display, no_json
|
||||
return
|
||||
end
|
||||
|
||||
-- ========================================================================
|
||||
-- STANDARD PROFILE EXECUTION
|
||||
-- For 'interactive' and other custom profiles
|
||||
-- ========================================================================
|
||||
run_dupes(profile_name, conf, conf.save_op)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Shallow-Seek
|
||||
|
||||
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.
|
||||
@@ -1,183 +0,0 @@
|
||||
fazif allows you to search over selected items in Yazi with your configuration of search and fuzzy filter command.
|
||||
|
||||
You can config search command ([fd](https://github.com/sharkdp/fd), [rg](https://github.com/BurntSushi/ripgrep), [rga](https://github.com/phiresky/ripgrep-all), [ag](https://github.com/ggreer/the_silver_searcher), [astgrep](https://github.com/ast-grep/ast-grep) ...), fuzzy filter command ([fzf](https://github.com/junegunn/fzf), [fzy](https://github.com/jhawthorn/fzy), [zf](https://github.com/natecraddock/zf), [skim](https://github.com/lotabout/skim)), and options in a script and spawn all your scripts easily into yazi. Here are some use cases.
|
||||
|
||||
1. Search within the current working directory when none are selected.
|
||||
|
||||
For example, a simple directory jumper. Simply create a file in `~/.config/yazi/plugins/fazif.yazi` with one of the following, make it executable, and set a keybinding.
|
||||
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t d|fzf
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t d|zf
|
||||
```
|
||||
|
||||
or jump to a dir. outside CWD by applying your query to a upper dir. with a shortcut key.
|
||||
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t d|fzf \
|
||||
--bind 'ctrl-e:transform:echo "change-prompt(Home_Dir> )+reload(fd . ~ --hidden --type d)"' \
|
||||
```
|
||||
|
||||
2. Search within selected files and directories
|
||||
|
||||
Example 1: to jump to some dir. in the selected folders, simply create a file in `~/.config/yazi/plugins/fazif.yazi` with one of the following, make it executable, and set a keybinding.
|
||||
|
||||
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t d "$@"|fzf
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t d "$@"|zf
|
||||
```
|
||||
|
||||
Example 2: use `fazifrga` script to search for a pattern in selected PDFs and preview the matching pages that have the pattern with fzf.
|
||||
|
||||
3. Reveal the selected file or enter the selected directory in a new yazi tab; if multiple items are selected in fzf (using the `-multi` option in fzf), then show the selected items in the search result view.
|
||||
|
||||
For example, find relevant books using `faziffd` and reveal them in yazi's search result view, then use `fazifrga` to search for a pattern in these books.
|
||||
|
||||
4. show recent modified files.
|
||||
```
|
||||
#!/usr/bin/env zsh
|
||||
fd -H -t f --changed-within 1d|fzf
|
||||
```
|
||||
## How It Works
|
||||
|
||||
This plugin acts as a bridge between Yazi and standalone scripts. The main.lua file serves as a generic wrapper that:
|
||||
1. Passes the current working directory and selected files/directories from Yazi (`"$@"` in the script) to the script
|
||||
2. Executes the specified script (passed as an argument in the keymap)
|
||||
3. Send results in Yazi search pane if multiple selected or reveal/enter the selected item in a yazi new tab
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install via ya:
|
||||
|
||||
```bash
|
||||
ya pkg -a Shallow-Seek/fazif
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Shallow-Seek/fazif.yazi.git ~/.config/yazi/plugins/fazif.yazi
|
||||
```
|
||||
|
||||
2. The 3 default scripts `faziffd`, `fazifrg`, and `fazifrga` provided are examples with features shown in the next section. The plugin still works with your scripts without them.
|
||||
|
||||
Simple put your script in `~/.config/yazi/plugins/fazif.yazi` and set a keybinding to use them. To make your script search on selected items, just add `"$@"` to the search command. Check `faziffd` to see that.
|
||||
|
||||
Also you need change your `rg` or `rga`'s delimiter to `U+00A0` by adding the option `--field-match-separator $'\u00a0'`
|
||||
to your `rg` or `rga` commmand and `--delimiter $'\u00a0'` option to `fzf`. See the default `fazifrg` as an example.
|
||||
|
||||
but you can modify the following line in `main.lua` to use your prefered delimiter.
|
||||
|
||||
```lua
|
||||
local file = line:find("\xC2\xA0") and line:sub(1, line:find("\xC2\xA0") - 1) or line
|
||||
```
|
||||
|
||||
> UTF-8 encoding of `U+00A0` is `\xC2\xA0`
|
||||
|
||||
Make sure your scripts are executable:
|
||||
|
||||
```bash
|
||||
chmod +x ~/.config/yazi/plugins/fazif.yazi/faziffd
|
||||
chmod +x ~/.config/yazi/plugins/fazif.yazi/fazifrg
|
||||
chmod +x ~/.config/yazi/plugins/fazif.yazi/fazifrga
|
||||
chmod +x ~/.config/yazi/plugins/fazif.yazi/yourscript1
|
||||
...
|
||||
```
|
||||
You may need to update the shebang (`#!`) in the example scripts.
|
||||
|
||||
## Add Keymaps to Your Script
|
||||
|
||||
The plugin can be configured to run any of your scripts by passing the script name as an argument. Add the following to your `~/.config/yazi/keymap.toml` to bind each script to a key combination:
|
||||
|
||||
### Setting up all scripts:
|
||||
|
||||
```toml
|
||||
# File/Directory finder using fd + fzf
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "b", "d" ]
|
||||
run = "plugin fazif faziffd"
|
||||
desc = "Find files/directories with fd and fzf"
|
||||
|
||||
# Content finder using ripgrep + fzf
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "b", "r" ]
|
||||
run = "plugin fazif fazifrg"
|
||||
desc = "Find content in files with ripgrep and fzf"
|
||||
|
||||
# Document content finder using ripgrep-all + fzf
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "b", "a" ]
|
||||
run = "plugin fazif fazifrga"
|
||||
desc = "Find content in documents with ripgrep-all and fzf"
|
||||
...
|
||||
```
|
||||
|
||||
That's it. is not the default `:`, you will need to change the delimiter in main.lua.
|
||||
|
||||
---
|
||||
## Example scripts
|
||||
Read this section if you use the default scripts `faziffd`, `fazifrg`, and `fazifrga`.
|
||||
|
||||
### Features
|
||||
|
||||
1. **faziffd** - File/directory jumper using `fd`. Txt preview with `bat` and Directory preview with `eza`
|
||||
2. **fazifrg** - `ripgrep` on selected. Preview shows file content with `bat` when started with no input. With any input, `rg` kicks in, and the preview highlights the matching line.
|
||||
3. **fazifrga** - `ripgrep-all` search in selected PDFs and DjVu. Preview shows the first page of a document when started with no input. With any input, `rga` kicks in, and the preview shows the matching page in the document.
|
||||
|
||||
The 3 scripts use the following tools:
|
||||
|
||||
- [fzf](https://github.com/junegunn/fzf)
|
||||
- [fd](https://github.com/sharkdp/fd) - Used by `faziffd`
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep) - Used by `fazifrg`
|
||||
- [ripgrep-all](https://github.com/phiresky/ripgrep-all) - Used by `fazifrga`
|
||||
- [rga djvu adaptor](https://github.com/phiresky/ripgrep-all/discussions/166) - Used by `fazifrga` to search in djvu
|
||||
- Additional tools for document previews:
|
||||
- [kitty](https://sw.kovidgoyal.net/kitty/) Image preview uses kitty icat. You can also use other terminals that support image or use ueberzugpp.
|
||||
- [bat](https://github.com/sharkdp/bat) - Used by `faziffd`, `fazifrg`
|
||||
- [eza](https://github.com/eza-community/eza) - Used by `faziffd`
|
||||
- `pdftoppm` from [poppler-utils](https://github.com/freedesktop/poppler) - Used by `faziffd`, `fazifrga` for pdf prevew.
|
||||
- `ddjvu` from [djvulibre](https://github.com/DjVuLibre/djvulibre) - Used by `faziffd`, `fazifrga` for djvu preview.
|
||||
- [libreoffice](https://github.com/LibreOffice/core) for office documents - Used by `faziffd` for office file preview.
|
||||
|
||||
### Usage
|
||||
|
||||
#### faziffd - File/Directory jumper
|
||||
|
||||
- `Ctrl-w`: Search files in the home directory
|
||||
- `Ctrl-e`: Search directories in the home directory
|
||||
- `Alt-c`: Search directories in the current working directory
|
||||
- `Ctrl-t`: Search files in the current working directory
|
||||
- `Ctrl-f`: Search directories from the root
|
||||
- `Ctrl-p`: Toggle the preview window/position
|
||||
- `Ctrl-x`: Open in Yazi (new instance)(if `setsid` is not available, use `nohup`)
|
||||
|
||||
|
||||
#### fazifrg, fazifrga
|
||||
|
||||
- `Ctrl-y`: Switch between rga search mode and fzf filtering mode
|
||||
- `Ctrl-p`: Toggle the preview window/position
|
||||
- `Ctrl-o`: `fazifrg` open file in Neovim at the matched line. `fazifrga` open document in Zathura at the matched page and highlight the query.
|
||||
|
||||
## License
|
||||
|
||||
This plugin is released under the MIT License.
|
||||
|
||||
## Acknowledgement
|
||||
Plugin is based on the default [Yazi](https://github.com/sxyazi/yazi) fzf plugin and vcs-files plugin. Fzf scripts grow out of [fzf](https://github.com/junegunn/fzf)'s wiki and examples.
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
fd . -H "$@" |fzf \
|
||||
--info=inline \
|
||||
--multi \
|
||||
--layout=reverse \
|
||||
--prompt='ctl-wetcrfp_CWD> ' \
|
||||
--bind 'ctrl-w:transform:echo "change-prompt(ctl-wetcrfp_Home_File> )+reload(fd . ~ --hidden --type f)"' \
|
||||
--bind 'ctrl-e:transform:echo "change-prompt(ctl-wetcrfp_Home_Dir> )+reload(fd . ~ --hidden --type d)"' \
|
||||
--bind 'alt-c:transform:echo "change-prompt(ctl-wetcrfp_CWD_Dir> )+reload(fd --hidden --type d)"' \
|
||||
--bind 'ctrl-t:transform:echo "change-prompt(ctl-wetcrfp_CWD_File> )+reload(fd --hidden --type f)"' \
|
||||
--bind 'ctrl-f:transform:echo "change-prompt(ctl-wetcrfp_root_Dir> )+reload(fd . / --hidden --type d)"' \
|
||||
--bind 'ctrl-r:transform:echo "change-prompt(ctl-wetcrfp_Root_File> )+reload(fd . / --hidden --type f)"' \
|
||||
--bind 'focus:transform-preview-label:echo {}' \
|
||||
--bind 'ctrl-p:change-preview-window(right|down|hidden)' \
|
||||
--bind 'focus:transform-preview-label:echo {}' \
|
||||
--bind 'ctrl-o:execute-silent(xdg-open-nvim {} &)' \
|
||||
--preview-window 'hidden' \
|
||||
--preview '
|
||||
printf "\033_Ga=d,q=1\033\\"
|
||||
[ -d {} ] && eza -aTL 2 --group-directories-first --color=always --icons=always {} ||
|
||||
tmp="/tmp/fzf_preview"
|
||||
case $(basename {}) in
|
||||
*.pdf)
|
||||
pdftoppm -q -f 1 -l 1 -jpeg -jpegopt quality=60 -scale-to-x 1000 -scale-to-y -1 -singlefile {} $tmp && \
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp.jpg
|
||||
;;
|
||||
*.doc|*.docx|*.xls|*.xlsx|*.ppt|*.pptx|*.odt|*.ods|*.odp)
|
||||
libreoffice --convert-to jpg --outdir /tmp {} >/dev/null 2>&1
|
||||
mv "/tmp/${$(basename {})%.*}.jpg" $tmp
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp
|
||||
;;
|
||||
*.djvu)
|
||||
ddjvu -format=ppm -page=1 -size 1000x-1 -aspect=yes {} $tmp 2>/dev/null && \
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp
|
||||
;;
|
||||
*)
|
||||
if file --mime-type {} | grep -qP "image/(?!vnd\.djvu)"; then
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}
|
||||
else
|
||||
bat -p {} --color=always 2>/dev/null
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
'
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
FD_COMMAND5="fd --changed-within 5d"
|
||||
FD_COMMAND1="fd --changed-within 1d"
|
||||
|
||||
|
||||
$FD_COMMAND5 -t f . "$@" |fzf \
|
||||
--info=inline \
|
||||
--multi \
|
||||
--layout=reverse \
|
||||
--prompt='ctl-wetcrfp_CWD5d> ' \
|
||||
--bind "ctrl-w:transform:echo 'change-prompt(ctl-wetcrfp_HOME5d> )+reload($FD_COMMAND5 -t f . ~ )'" \
|
||||
--bind "ctrl-e:transform:echo 'change-prompt(ctl-wetcrfp_HOME1d)+reload($FD_COMMAND1 -t f . ~)'" \
|
||||
--bind "ctrl-t:transform:echo 'change-prompt(ctl-wetcrfp_CWD5d> )+reload($FD_COMMAND5 -t f)'" \
|
||||
--bind "alt-c:transform:echo 'change-prompt(ctl-wetcrfp_CWD1d> )+reload($FD_COMMAND1 -t f)'" \
|
||||
--bind "ctrl-r:transform:echo 'change-prompt(ctl-wetcrfp_HOMEA> )+reload($FD_COMMAND5 . ~)'" \
|
||||
--bind "ctrl-f:transform:echo 'change-prompt(ctl-wetcrfp_HOMEA_WithH> )+reload($FD_COMMAND1 -H . ~)'" \
|
||||
--bind 'focus:transform-preview-label:echo {}' \
|
||||
--bind 'ctrl-p:change-preview-window(right|down|hidden)' \
|
||||
--bind 'focus:transform-preview-label:echo {}' \
|
||||
--bind 'ctrl-x:execute-silent(setsid kitty nnn {} &)' \
|
||||
--bind 'ctrl-a:execute-silent(setsid kitty yazi {} &)' \
|
||||
--bind 'ctrl-s:execute-silent(setsid thunar {} &)' \
|
||||
--preview-window 'hidden' \
|
||||
--preview '
|
||||
printf "\033_Ga=d,q=1\033\\"
|
||||
[ -d {} ] && eza -aTL 2 --group-directories-first --color=always --icons=always {} ||
|
||||
tmp="/tmp/fzf_preview"
|
||||
case $(basename {}) in
|
||||
*.pdf)
|
||||
pdftoppm -q -f 1 -l 1 -jpeg -jpegopt quality=60 -scale-to-x 1000 -scale-to-y -1 -singlefile {} $tmp && \
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp.jpg
|
||||
;;
|
||||
*.doc|*.docx|*.xls|*.xlsx|*.ppt|*.pptx|*.odt|*.ods|*.odp)
|
||||
libreoffice --convert-to jpg --outdir /tmp {} >/dev/null 2>&1
|
||||
mv "/tmp/${$(basename {})%.*}.jpg" $tmp
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp
|
||||
;;
|
||||
*.djvu)
|
||||
ddjvu -format=ppm -page=1 -size 1000x-1 -aspect=yes {} $tmp 2>/dev/null && \
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp
|
||||
;;
|
||||
*)
|
||||
if file --mime-type {} | grep -qP "image/(?!vnd\.djvu)"; then
|
||||
kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}
|
||||
else
|
||||
bat -p {} --color=always 2>/dev/null
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
'
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
rm -f /tmp/rg-fzf-{r,f} 2>/dev/null
|
||||
RG_PREFIX="rg --with-filename --column --line-number --color=always --smart-case --field-match-separator $'\u00a0'"
|
||||
|
||||
FILES_TO_ADD=""
|
||||
for item in "$@"; do
|
||||
if [ -f "$item" ]; then
|
||||
FILES_TO_ADD="$FILES_TO_ADD$item"$'\n'
|
||||
fi
|
||||
done
|
||||
|
||||
(fd . -H -t f "$@" 2>/dev/null & printf "%s" "$FILES_TO_ADD") | fzf \
|
||||
--ansi \
|
||||
--delimiter $'\u00a0' \
|
||||
--disabled \
|
||||
--prompt '1. ripgrep> ' \
|
||||
--header 'CTRL-Y: Switch between ripgrep/fzf' \
|
||||
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} $([ $# -gt 0 ] && printf "%q " "$@") || true" \
|
||||
--bind 'ctrl-y:transform:[[ ! $FZF_PROMPT =~ ripgrep ]] &&
|
||||
echo "rebind(change)+change-prompt(1. ripgrep> )+disable-search+transform-query:echo \{q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r" ||
|
||||
echo "unbind(change)+change-prompt(2. fzf> )+enable-search+transform-query:echo \{q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f"' \
|
||||
--color "hl:-1:underline,hl+:-1:underline:reverse" \
|
||||
--preview '[ -n "{2}" ] && bat --color=always {1} --style=numbers --highlight-line {2} || bat --color=always {} --style=numbers' \
|
||||
--preview-window 'down,60%,+{2}+3/3,~3' \
|
||||
--bind 'ctrl-p:change-preview-window(right,60%|hidden|down,60%)' \
|
||||
--bind 'focus:transform-preview-label:echo $(basename {1})' \
|
||||
--bind 'ctrl-o:execute(kitty -1 sh -c "nvim {1} +{2}" & )' \
|
||||
--bind 'ctrl-x:execute-silent(setsid kitty -1 nnn {1} &)' \
|
||||
--bind 'ctrl-a:execute-silent(setsid kitty -1 yazi {1} &)' \
|
||||
--bind 'ctrl-s:execute-silent(setsid thunar {1} &)' \
|
||||
--color 'label:117:bold'
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
rm -f /tmp/rg-fzf-{r,f} 2>/dev/null
|
||||
RG_PREFIX="rga --glob='*.pdf' --glob='*.djvu' --glob='*.djv' --with-filename --color=always --no-heading --smart-case --field-match-separator $'\u00a0'"
|
||||
|
||||
FILES_TO_ADD=""
|
||||
for item in "$@"; do
|
||||
if [ -f "$item" ]; then
|
||||
FILES_TO_ADD="$FILES_TO_ADD$item"$'\n'
|
||||
fi
|
||||
done
|
||||
|
||||
(fd . -e pdf -e djvu -e djv "$@" 2>/dev/null & printf "%s" "$FILES_TO_ADD") | fzf \
|
||||
--ansi \
|
||||
--delimiter $'\u00a0' \
|
||||
--disabled \
|
||||
--with-nth 2,1 \
|
||||
--prompt="rga> " \
|
||||
--color "hl:-1:underline,hl+:-1:underline:reverse" \
|
||||
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} $([ $# -gt 0 ] && printf "%q " "$@") || true" \
|
||||
--bind 'focus:transform-preview-label:echo $(basename {1})' \
|
||||
--bind 'ctrl-p:change-preview-window(right,50%|hidden,50%|down)' \
|
||||
--bind 'ctrl-x:execute-silent(setsid kitty -1 nnn {1} &)' \
|
||||
--bind 'ctrl-a:execute-silent(setsid kitty -1 yazi {1} &)' \
|
||||
--bind 'ctrl-s:execute-silent(setsid thunar {1} &)' \
|
||||
--preview-window 'down' \
|
||||
--bind 'ctrl-y:transform:[[ ! $FZF_PROMPT =~ rga ]] &&
|
||||
echo "rebind(change)+change-prompt(rga> )+disable-search+transform-query:echo \{q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r" ||
|
||||
echo "unbind(change)+change-prompt(fzf> )+enable-search+transform-query:echo \{q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f"' \
|
||||
--bind 'ctrl-o:execute(
|
||||
page_info={2}
|
||||
pagenumber=${page_info#Page }
|
||||
pagenumber=${pagenumber%%: *}
|
||||
context=${page_info#*: }
|
||||
setsid zathura --page=$pagenumber --find=$context {1} &)' \
|
||||
--preview '
|
||||
printf "\033_Ga=d,q=1\033\\"
|
||||
[ -n {2} ] && pagenumber=$(echo {2} | cut -d: -f1 | sed "s/Page\ //") || pagenumber=1
|
||||
tmp="/tmp/fzf_preview"
|
||||
case {1} in
|
||||
*.pdf)
|
||||
pdftoppm -q -f $pagenumber -l $pagenumber -jpeg -jpegopt quality=60 -scale-to-x 800 -scale-to-y -1 -singlefile {1} $tmp \
|
||||
&& kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp.jpg
|
||||
;;
|
||||
*.djvu)
|
||||
ddjvu -format=ppm -page=$pagenumber -size=800x-1 -aspect=yes {1} $tmp 2>/dev/null \
|
||||
&& kitty icat --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 $tmp
|
||||
;;
|
||||
esac
|
||||
' \
|
||||
# --bind "start:reload:$RG_PREFIX {q} || true" \
|
||||
@@ -1,107 +0,0 @@
|
||||
local state = ya.sync(function()
|
||||
local selected = {}
|
||||
for _, url in pairs(cx.active.selected) do
|
||||
selected[#selected + 1] = url
|
||||
end
|
||||
return cx.active.current.cwd, selected
|
||||
end)
|
||||
|
||||
local function split_urls(cwd, output)
|
||||
if not output or output == "" then return {} end
|
||||
|
||||
local t = {}
|
||||
for line in output:gmatch("[^\r\n]+") do
|
||||
if line ~= "" then
|
||||
-- Get everything before first colon, or entire line if no colon
|
||||
local file = line:find("\xC2\xA0") and line:sub(1, line:find("\xC2\xA0") - 1) or line
|
||||
|
||||
if file and file ~= "" then
|
||||
local u = Url(file)
|
||||
if u.is_absolute then
|
||||
t[#t + 1] = u
|
||||
else
|
||||
t[#t + 1] = cwd:join(u)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local function run_with(cwd, selected, script_name)
|
||||
local script_path = os.getenv("HOME") .. "/.config/yazi/plugins/fazif.yazi/" .. script_name
|
||||
|
||||
local sepaths = {}
|
||||
if #selected > 0 then
|
||||
for _, u in ipairs(selected) do
|
||||
table.insert(sepaths, tostring(u))
|
||||
end
|
||||
end
|
||||
|
||||
local child
|
||||
if #selected == 0 then
|
||||
child = Command(script_path):cwd(tostring(cwd)):stdin(Command.INHERIT):stdout(Command.PIPED):spawn()
|
||||
else
|
||||
child = Command(script_path):arg(sepaths):stdout(Command.PIPED):spawn()
|
||||
end
|
||||
|
||||
if not child then
|
||||
return nil, "Failed to start script"
|
||||
end
|
||||
|
||||
local output, err = child:wait_with_output()
|
||||
if not output then
|
||||
return nil, "Cannot read output: " .. tostring(err)
|
||||
elseif not output.status.success and output.status.code ~= 130 then
|
||||
return nil, "Script exited with code " .. tostring(output.status.code)
|
||||
end
|
||||
return output.stdout, nil
|
||||
end
|
||||
|
||||
local function entry(_, job)
|
||||
local script_name = job.args[1]
|
||||
|
||||
local permit = ui.hide()
|
||||
local cwd, selected = state()
|
||||
|
||||
local output, err = run_with(cwd, selected, script_name)
|
||||
|
||||
if permit then
|
||||
permit:drop()
|
||||
end
|
||||
|
||||
if not output then
|
||||
return ya.notify { title = "Fazif", content = tostring(err), timeout = 5, level = "error" }
|
||||
end
|
||||
|
||||
local urls = split_urls(cwd, output)
|
||||
if #urls == 0 then
|
||||
return
|
||||
elseif #urls == 1 then
|
||||
ya.emit("tab_create", {})
|
||||
ya.emit(fs.cha(urls[1]).is_dir and "cd" or "reveal", { urls[1], raw = true })
|
||||
else
|
||||
ya.emit("tab_create", {})
|
||||
local id = ya.id("ft")
|
||||
local virtual_cwd = cwd:into_search("FZF Results")
|
||||
ya.emit("cd", { Url(virtual_cwd) })
|
||||
ya.emit("update_files", { op = fs.op("part", { id = id, url = Url(virtual_cwd), files = {} }) })
|
||||
|
||||
local files = {}
|
||||
for i = 1, #urls do
|
||||
local url = urls[i]
|
||||
local cha = fs.cha(url, true)
|
||||
if cha then
|
||||
files[#files + 1] = File { url = url, cha = cha }
|
||||
else
|
||||
files[#files + 1] = File { url = url }
|
||||
end
|
||||
end
|
||||
|
||||
ya.emit("update_files", { op = fs.op("part", { id = id, url = Url(virtual_cwd), files = files }) })
|
||||
ya.emit("update_files", { op = fs.op("done", { id = id, url = virtual_cwd, cha = Cha { kind = 16 } }) })
|
||||
end
|
||||
end
|
||||
|
||||
return { entry = entry }
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,97 +0,0 @@
|
||||
<img width="957" height="487" alt="list of files with highlighted matching characters" src="https://github.com/user-attachments/assets/b734d630-ab08-46a2-a6a0-acaf458d36c0" />
|
||||
|
||||
# Features
|
||||
|
||||
- case insensitive matching
|
||||
- supports aliases for different languages
|
||||
- ignores leading non-alphabet
|
||||
- can match characters anywhere in filename
|
||||
|
||||
# Installation
|
||||
|
||||
```sh
|
||||
ya pkg add AminurAlam/yazi-plugins:fchar
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
in `~/.config/yazi/keymap.toml`
|
||||
|
||||
```toml
|
||||
[mgr]
|
||||
prepend_keymap = [
|
||||
{ on = "f", run = "plugin fchar", desc = "Jump to char" },
|
||||
]
|
||||
```
|
||||
|
||||
in `~/.config/yazi/init.lua`
|
||||
|
||||
```lua
|
||||
-- default config
|
||||
require('fchar'):setup {
|
||||
-- if true: f -> file, File, FILE
|
||||
insensitive = true,
|
||||
-- if true: f -> file, .file, @file, #file, ...file
|
||||
skip_symbols = true,
|
||||
-- if {"yazi-"}: f -> file, yazi-file
|
||||
skip_prefix = {},
|
||||
-- start: f -> file
|
||||
-- word: f -> file, also-file
|
||||
-- all: f -> file, also-file, alsofile, elf
|
||||
search_location = 'start',
|
||||
aliases = {},
|
||||
}
|
||||
|
||||
-- aliases for German
|
||||
require('fchar'):setup {
|
||||
aliases = {
|
||||
a = 'ä',
|
||||
o = 'ö',
|
||||
u = 'ü',
|
||||
s = 'ß'
|
||||
},
|
||||
}
|
||||
|
||||
-- aliases for Japanese
|
||||
require('fchar'):setup {
|
||||
aliases = {
|
||||
a = 'あア',
|
||||
b = 'ばびぶべぼバビブベボ',
|
||||
c = 'ちチ',
|
||||
d = 'だぢづでどダヂヅデド',
|
||||
e = 'えエ',
|
||||
g = 'がぎぐげごガギグゲゴ',
|
||||
h = 'はひふへほハヒフヘホ',
|
||||
i = 'いイ',
|
||||
j = 'じジ',
|
||||
k = 'かきくけこカキクケコ',
|
||||
m = 'まみむめもマミムメモ',
|
||||
n = 'なにぬねのんナニヌネノン',
|
||||
o = 'おオ',
|
||||
p = 'ぱぴぷぺぽパピプペポ',
|
||||
r = 'らりるれろラリルレロ',
|
||||
s = 'さしすせそサシスセソ',
|
||||
t = 'たつてとタツテト',
|
||||
u = 'うウ',
|
||||
w = 'わをワヲ',
|
||||
y = 'やゆよヤユヨ',
|
||||
z = 'ざずぜぞザズゼゾ',
|
||||
},
|
||||
}
|
||||
|
||||
-- you may want to turn off the search regex from
|
||||
-- showing up in the header by doing this
|
||||
function Header:flags()
|
||||
local cwd = self._current.cwd
|
||||
local filter = self._current.files.filter
|
||||
|
||||
local t = {}
|
||||
if cwd.is_search then
|
||||
t[#t + 1] = string.format('search: %s', cwd.domain)
|
||||
end
|
||||
if filter then
|
||||
t[#t + 1] = string.format('filter: %s', filter)
|
||||
end
|
||||
return #t == 0 and '' or ' (' .. table.concat(t, ', ') .. ')'
|
||||
end
|
||||
```
|
||||
@@ -1,159 +0,0 @@
|
||||
--- @since 25.5.31
|
||||
|
||||
local M = {}
|
||||
|
||||
local changed = ya.sync(function(st, new)
|
||||
local b = st.last ~= new
|
||||
st.last = new
|
||||
return b or not cx.active.finder
|
||||
end)
|
||||
|
||||
---@type fun(opts: FCharConf): nil
|
||||
local set_config = ya.sync(function(st, opts)
|
||||
st.opts = opts
|
||||
end)
|
||||
|
||||
---@type fun(): FCharConf
|
||||
local get_config = ya.sync(function(st)
|
||||
return st.opts
|
||||
or {
|
||||
-- if true: f -> file, File, FILE
|
||||
insensitive = true,
|
||||
-- if true: f -> file, .file, @file, #file, ...file
|
||||
skip_symbols = true,
|
||||
-- if {"yazi-"}: f -> file, yazi-file
|
||||
skip_prefix = {},
|
||||
-- start: f -> file
|
||||
-- word: f -> file, also-file
|
||||
-- all: f -> file, also-file, twofile, elf
|
||||
search_location = 'start',
|
||||
aliases = {},
|
||||
}
|
||||
end)
|
||||
|
||||
local function tbl_deep_extend(default, config)
|
||||
if type(config) ~= 'table' then
|
||||
return config
|
||||
end
|
||||
|
||||
default = (type(default) == 'table') and default or {}
|
||||
for key, _ in pairs(config) do
|
||||
default[key] = tbl_deep_extend(default[key], config[key])
|
||||
end
|
||||
|
||||
return default
|
||||
end
|
||||
|
||||
---@type fun(self, config: FCharConf): nil
|
||||
function M:setup(config)
|
||||
set_config(tbl_deep_extend(get_config(), config))
|
||||
end
|
||||
|
||||
-- TODO: process `--flags`
|
||||
function M:entry()
|
||||
local cands = {
|
||||
{ on = '0' },
|
||||
{ on = '1' },
|
||||
{ on = '2' },
|
||||
{ on = '3' },
|
||||
{ on = '4' },
|
||||
{ on = '5' },
|
||||
{ on = '6' },
|
||||
{ on = '7' },
|
||||
{ on = '8' },
|
||||
{ on = '9' },
|
||||
{ on = '_' },
|
||||
{ on = 'a' },
|
||||
{ on = 'b' },
|
||||
{ on = 'c' },
|
||||
{ on = 'd' },
|
||||
{ on = 'e' },
|
||||
{ on = 'f' },
|
||||
{ on = 'g' },
|
||||
{ on = 'h' },
|
||||
{ on = 'i' },
|
||||
{ on = 'j' },
|
||||
{ on = 'k' },
|
||||
{ on = 'l' },
|
||||
{ on = 'm' },
|
||||
{ on = 'n' },
|
||||
{ on = 'o' },
|
||||
{ on = 'p' },
|
||||
{ on = 'q' },
|
||||
{ on = 'r' },
|
||||
{ on = 's' },
|
||||
{ on = 't' },
|
||||
{ on = 'u' },
|
||||
{ on = 'v' },
|
||||
{ on = 'w' },
|
||||
{ on = 'x' },
|
||||
{ on = 'y' },
|
||||
{ on = 'z' },
|
||||
{ on = 'A' },
|
||||
{ on = 'B' },
|
||||
{ on = 'C' },
|
||||
{ on = 'D' },
|
||||
{ on = 'E' },
|
||||
{ on = 'F' },
|
||||
{ on = 'G' },
|
||||
{ on = 'H' },
|
||||
{ on = 'I' },
|
||||
{ on = 'J' },
|
||||
{ on = 'K' },
|
||||
{ on = 'L' },
|
||||
{ on = 'M' },
|
||||
{ on = 'N' },
|
||||
{ on = 'O' },
|
||||
{ on = 'P' },
|
||||
{ on = 'Q' },
|
||||
{ on = 'R' },
|
||||
{ on = 'S' },
|
||||
{ on = 'T' },
|
||||
{ on = 'U' },
|
||||
{ on = 'V' },
|
||||
{ on = 'W' },
|
||||
{ on = 'X' },
|
||||
{ on = 'Y' },
|
||||
{ on = 'Z' },
|
||||
}
|
||||
local opts = get_config()
|
||||
|
||||
if opts.skip_symbols then
|
||||
local additional_keys = '~.!@#-'
|
||||
for i = 1, #additional_keys do
|
||||
cands[#cands + 1] = { on = additional_keys:sub(i, i) }
|
||||
end
|
||||
end
|
||||
|
||||
local idx = ya.which { cands = cands, silent = true }
|
||||
if not idx then
|
||||
return
|
||||
end
|
||||
|
||||
local loc = {
|
||||
start = '^',
|
||||
word = '(^|\\W)',
|
||||
all = '',
|
||||
}
|
||||
|
||||
-- TODO: autodetect common prefix
|
||||
local prefixes = ''
|
||||
for _, prefix in ipairs(opts.skip_prefix) do
|
||||
prefixes = prefixes .. '(' .. prefix .. ')?'
|
||||
end
|
||||
|
||||
local re = loc[opts.search_location]
|
||||
.. ((opts.search_location == 'start' and opts.skip_symbols) and [[\W?]] or '')
|
||||
.. prefixes
|
||||
.. '['
|
||||
.. cands[idx].on
|
||||
.. (opts.aliases[cands[idx].on] or '')
|
||||
.. ']'
|
||||
if changed(re) then
|
||||
ya.emit('find_do', { re, insensitive = opts.insensitive })
|
||||
else
|
||||
ya.emit('find_arrow', {})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,19 +0,0 @@
|
||||
Copyright (c) 2024 boydaihungst
|
||||
|
||||
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.
|
||||
@@ -1,110 +0,0 @@
|
||||
# file-extra-metadata
|
||||
|
||||
<!--toc:start-->
|
||||
|
||||
- [file-extra-metadata](#file-extra-metadata)
|
||||
- [Preview](#preview)
|
||||
- [Before:](#before)
|
||||
- [After:](#after)
|
||||
- [Requirements](#requirements)
|
||||
- [Installation](#installation)
|
||||
- [For developer](#for-developer)
|
||||
<!--toc:end-->
|
||||
|
||||
This is a Yazi plugin that replaces the default file previewer and spotter with extra information.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Minimum version: yazi v25.5.28
|
||||
|
||||
## Preview
|
||||
|
||||
### Before:
|
||||
|
||||
- Previewer
|
||||
|
||||

|
||||
|
||||
- Spotter
|
||||
|
||||

|
||||
|
||||
### After:
|
||||
|
||||
- Previewer
|
||||
|
||||

|
||||
|
||||
- Spotter
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
- [yazi >= 25.5.28](https://github.com/sxyazi/yazi)
|
||||
- Tested on Linux. For MacOS, Windows: some fields will shows empty values.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the plugin:
|
||||
|
||||
```sh
|
||||
ya pkg add boydaihungst/file-extra-metadata
|
||||
```
|
||||
|
||||
Create `~/.config/yazi/yazi.toml` and add:
|
||||
For yazi < v25.12.29 (29/12/2025) replace `url` with `name`
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
append_previewers = [
|
||||
{ url = "*", run = "file-extra-metadata" },
|
||||
]
|
||||
|
||||
# Setup keybind for spotter: https://github.com/sxyazi/yazi/pull/1802
|
||||
append_spotters = [
|
||||
{ url = "*", run = "file-extra-metadata" },
|
||||
]
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
previewers = [
|
||||
# ... the rest
|
||||
# disable default file plugin { name = "*", run = "file" },
|
||||
{ url = "*", run = "file-extra-metadata" },
|
||||
]
|
||||
|
||||
# Setup keybind for spotter: https://github.com/sxyazi/yazi/pull/1802
|
||||
spotters = [
|
||||
# ... the rest
|
||||
# Fallback
|
||||
# { name = "*", run = "file" },
|
||||
{ url = "*", run = "file-extra-metadata" },
|
||||
]
|
||||
```
|
||||
|
||||
### Custom theme
|
||||
|
||||
Read more: https://github.com/sxyazi/yazi/pull/2391
|
||||
|
||||
Edit or add `yazi/theme.toml`:
|
||||
|
||||
```toml
|
||||
[spot]
|
||||
border = { fg = "#4fa6ed" }
|
||||
title = { fg = "#4fa6ed" }
|
||||
|
||||
# Table.
|
||||
tbl_cell = { fg = "#4fa6ed", reversed = true }
|
||||
tbl_col = { fg = "#4fa6ed" }
|
||||
```
|
||||
|
||||
## For developer
|
||||
|
||||
If you want to combine this with other spotter/previewer:
|
||||
|
||||
```lua
|
||||
require("file-extra-metadata"):render_table(job, { show_plugins_section = true })
|
||||
```
|
||||
@@ -1,367 +0,0 @@
|
||||
--- @since 25.5.28
|
||||
|
||||
local M = {}
|
||||
|
||||
local STATE_KEY = {
|
||||
ALTER_DF_COMMAND = "ALTER_DF_COMMAND",
|
||||
}
|
||||
|
||||
local set_state = ya.sync(function(state, key, value)
|
||||
state[key] = value
|
||||
end)
|
||||
|
||||
local get_state = ya.sync(function(state, key)
|
||||
return state[key]
|
||||
end)
|
||||
|
||||
local function permission(file)
|
||||
local h = file
|
||||
if not h then
|
||||
return ""
|
||||
end
|
||||
|
||||
local perm = h.cha:perm()
|
||||
if not perm then
|
||||
return ""
|
||||
end
|
||||
|
||||
local spans = ""
|
||||
for i = 1, #perm do
|
||||
local c = perm:sub(i, i)
|
||||
spans = spans .. c
|
||||
end
|
||||
return spans
|
||||
end
|
||||
|
||||
local function link_count(file)
|
||||
local h = file
|
||||
if h == nil or ya.target_family() ~= "unix" then
|
||||
return ""
|
||||
end
|
||||
|
||||
return h.cha.nlink
|
||||
end
|
||||
|
||||
local function owner_group(file)
|
||||
local h = file
|
||||
if h == nil or ya.target_family() ~= "unix" then
|
||||
return ""
|
||||
end
|
||||
return (ya.user_name(h.cha.uid) or tostring(h.cha.uid)) .. "/" .. (ya.group_name(h.cha.gid) or tostring(h.cha.gid))
|
||||
end
|
||||
|
||||
local file_size_and_folder_childs = function(file)
|
||||
local h = file
|
||||
if not h then
|
||||
return ""
|
||||
end
|
||||
|
||||
return h.cha.len and ya.readable_size(h.cha.len) or ""
|
||||
end
|
||||
|
||||
--- get file timestamp
|
||||
---@param file any
|
||||
---@param type "mtime" | "atime" | "btime"
|
||||
---@return any
|
||||
local function fileTimestamp(file, type)
|
||||
local h = file
|
||||
if not h then
|
||||
return ""
|
||||
end
|
||||
local time = math.floor(h.cha[type] or 0)
|
||||
if time == 0 then
|
||||
return ""
|
||||
else
|
||||
return os.date("%Y-%m-%d %H:%M", time)
|
||||
end
|
||||
end
|
||||
|
||||
-- Function to split a string by spaces (considering multiple spaces as one delimiter)
|
||||
local function split_by_whitespace(input)
|
||||
local result = {}
|
||||
for word in string.gmatch(input, "%S+") do
|
||||
table.insert(result, word)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local function get_filesystem_extra(file)
|
||||
local result = {
|
||||
filesystem = "",
|
||||
device = "",
|
||||
type = "",
|
||||
used_space = "",
|
||||
avail_space = "",
|
||||
total_space = "",
|
||||
used_space_percent = "",
|
||||
avail_space_percent = "",
|
||||
error = nil,
|
||||
is_virtual = false,
|
||||
}
|
||||
local h = file
|
||||
local file_url = h.url
|
||||
local is_virtual = file_url.spec and file_url.scheme.is_virtual
|
||||
file_url = is_virtual and (file.path or Url(file_url.scheme.cache .. tostring(file_url.path)))
|
||||
or (file_url.path or file_url.url)
|
||||
if not h or ya.target_family() ~= "unix" then
|
||||
return result
|
||||
end
|
||||
local output, child
|
||||
|
||||
local alter_df_command = get_state(STATE_KEY.ALTER_DF_COMMAND)
|
||||
if not alter_df_command then
|
||||
child, _ = Command("df"):arg({ "-P", "-T", "-h", tostring(file_url) }):stdout(Command.PIPED):spawn()
|
||||
|
||||
if child then
|
||||
-- Ignore header
|
||||
local _, event = child:read_line()
|
||||
if event == 0 then
|
||||
output, _ = child:read_line()
|
||||
end
|
||||
child:start_kill()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fallback for macOS/BSD if -T failed (empty output or error)
|
||||
if not output or output == "" then
|
||||
if not alter_df_command then
|
||||
set_state(STATE_KEY.ALTER_DF_COMMAND, true)
|
||||
end
|
||||
child, _ = Command("df"):arg({ "-P", "-h", tostring(file_url) }):stdout(Command.PIPED):spawn()
|
||||
if child then
|
||||
local _, event = child:read_line() -- skip header
|
||||
if event == 0 then
|
||||
output, _ = child:read_line()
|
||||
end
|
||||
child:start_kill()
|
||||
end
|
||||
end
|
||||
|
||||
if output and output ~= "" then
|
||||
-- Splitting the data
|
||||
local parts = split_by_whitespace(output)
|
||||
|
||||
-- Display the result
|
||||
if #parts >= 7 then
|
||||
result.filesystem = is_virtual and (parts[7] .. " (vfs)") or parts[7]
|
||||
result.device = is_virtual and (parts[1] .. " (vfs)") or parts[1]
|
||||
result.total_space = parts[3]
|
||||
result.used_space = parts[4]
|
||||
result.avail_space = parts[5]
|
||||
result.used_space_percent = parts[6]
|
||||
result.avail_space_percent = 100 - tonumber((string.match(parts[6], "%d+") or "0"))
|
||||
result.type = is_virtual and (parts[2] .. " (vfs)") or parts[2]
|
||||
else
|
||||
result.filesystem = is_virtual and (parts[6] .. " (vfs)") or parts[6]
|
||||
-- result.device (Type) is missing in df output, fetch from mount
|
||||
result.total_space = parts[2]
|
||||
result.used_space = parts[3]
|
||||
result.avail_space = parts[4]
|
||||
result.used_space_percent = parts[5]
|
||||
result.avail_space_percent = 100 - tonumber((string.match(parts[5], "%d+") or "0"))
|
||||
result.device = is_virtual and (parts[1] .. " (vfs)") or parts[1]
|
||||
|
||||
local mount_child = Command("mount"):stdout(Command.PIPED):spawn()
|
||||
if mount_child then
|
||||
while true do
|
||||
local line, event = mount_child:read_line()
|
||||
if not line or event ~= 0 then
|
||||
break
|
||||
end
|
||||
-- Check if line starts with filesystem (e.g. /dev/disk1s1 on ...)
|
||||
local s, e = line:find(parts[1] .. " on ", 1, true)
|
||||
if s == 1 then
|
||||
local fstype = line:match("%(([^,]+)")
|
||||
if fstype then
|
||||
result.type = is_virtual and (fstype .. " (vfs)") or fstype
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
result.is_virtual = is_virtual
|
||||
else
|
||||
result.error = "df error: check install"
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local function attributes(file)
|
||||
local h = file
|
||||
local file_url = h.url
|
||||
if h.cha.is_link then
|
||||
file_url = Url(h.link_to)
|
||||
end
|
||||
local is_virtual = file_url.scheme and file_url.scheme.is_virtual
|
||||
file_url = is_virtual and (file.path or Url(file_url.scheme.cache .. tostring(file_url.path))) or file_url
|
||||
|
||||
if not h or ya.target_family() ~= "unix" then
|
||||
return ""
|
||||
end
|
||||
|
||||
local output, _ = Command("lsattr"):arg({ "-d", tostring(file_url) }):stdout(Command.PIPED):output()
|
||||
|
||||
if output then
|
||||
-- Splitting the data
|
||||
local parts = split_by_whitespace(output.stdout)
|
||||
|
||||
-- Display the result
|
||||
for i, part in ipairs(parts) do
|
||||
if i == 1 then
|
||||
return part
|
||||
end
|
||||
end
|
||||
return ""
|
||||
else
|
||||
return "lsattr error: check install"
|
||||
end
|
||||
end
|
||||
|
||||
---shorten string
|
||||
---@param _s string string
|
||||
---@param _t string tail
|
||||
---@param _w number max characters
|
||||
---@return string
|
||||
local shorten = function(_s, _t, _w)
|
||||
local s = _s or utf8.len(_s)
|
||||
local t = _t or ""
|
||||
local ellipsis = "…" .. t
|
||||
local w = _w < utf8.len(ellipsis) and utf8.len(ellipsis) or _w
|
||||
local n_ellipsis = utf8.len(ellipsis) or 0
|
||||
if utf8.len(s) > w then
|
||||
return s:sub(1, (utf8.offset(s, w - n_ellipsis + 1) or 2) - 1) .. ellipsis
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
function M:render_table(job, opts)
|
||||
local styles = {
|
||||
header = th.spot.title or ui.Style():fg("green"),
|
||||
row_label = ui.Style():fg("reset"),
|
||||
row_value = th.spot.tbl_col or ui.Style():fg("blue"),
|
||||
}
|
||||
local filesystem_extra = get_filesystem_extra(job.file)
|
||||
local prefix = " "
|
||||
local rows = {}
|
||||
local label_max_length = 15
|
||||
local file_name_extension = job.file.cha.is_dir and "…" or ("." .. (job.file.url.ext or ""))
|
||||
|
||||
local row = function(key, value)
|
||||
local h = type(value) == "table" and #value or 1
|
||||
rows[#rows + 1] = ui.Row({ ui.Line(key):style(styles.row_label), ui.Text(value):style(styles.row_value) }):height(h)
|
||||
end
|
||||
|
||||
local file_name = shorten(
|
||||
job.file.name,
|
||||
file_name_extension,
|
||||
math.floor(job.area.w - label_max_length - utf8.len(file_name_extension))
|
||||
)
|
||||
local location = shorten(
|
||||
tostring((job.file.url.path or job.file.url).parent),
|
||||
"",
|
||||
math.floor(job.area.w - label_max_length - utf8.len(prefix))
|
||||
)
|
||||
local filesystem_error = filesystem_extra.error
|
||||
and shorten(filesystem_extra.error, "", math.floor(job.area.w - label_max_length - utf8.len(prefix)))
|
||||
or nil
|
||||
local filesystem =
|
||||
shorten(filesystem_extra.filesystem, "", math.floor(job.area.w - label_max_length - utf8.len(prefix)))
|
||||
|
||||
rows[#rows + 1] = ui.Row({ "Metadata", "" }):style(styles.header)
|
||||
row(prefix .. "File:", file_name)
|
||||
row(prefix .. "Mimetype:", job.mime)
|
||||
row(prefix .. "Location:", location)
|
||||
if job.file.cache then
|
||||
row(prefix .. "Cached:", tostring(job.file.path or job.file.cache))
|
||||
end
|
||||
row(prefix .. "Mode:", permission(job.file))
|
||||
row(prefix .. "Attributes:", attributes(job.file))
|
||||
row(prefix .. "Links:", tostring(link_count(job.file)))
|
||||
if job.file.cha.is_link then
|
||||
row(prefix .. "Linked:", tostring(job.file.cha.is_link and job.file.link_to))
|
||||
end
|
||||
row(prefix .. "Owner:", owner_group(job.file))
|
||||
row(prefix .. "Size:", file_size_and_folder_childs(job.file))
|
||||
row(prefix .. "Created:", fileTimestamp(job.file, "btime"))
|
||||
row(prefix .. "Modified:", fileTimestamp(job.file, "mtime"))
|
||||
row(prefix .. "Accessed:", fileTimestamp(job.file, "atime"))
|
||||
row(prefix .. "Filesystem:", filesystem_error or filesystem)
|
||||
row(prefix .. "Device:", filesystem_error or filesystem_extra.device)
|
||||
row(prefix .. "Type:", filesystem_error or filesystem_extra.type)
|
||||
row(
|
||||
prefix .. "Free space:",
|
||||
filesystem_error
|
||||
or (
|
||||
(filesystem_extra.avail_space and filesystem_extra.total_space and filesystem_extra.avail_space_percent)
|
||||
and (filesystem_extra.avail_space .. " / " .. filesystem_extra.total_space .. " (" .. filesystem_extra.avail_space_percent .. "%)")
|
||||
or ""
|
||||
)
|
||||
)
|
||||
if opts and opts.show_plugins_section then
|
||||
-- TODO: Remove this after the next release
|
||||
local is_yazi_nightly, _ = pcall(require, "mime.dir")
|
||||
local spotter = rt.plugin.spotter(is_yazi_nightly and job.file or job.file.url, job.mime)
|
||||
local previewer = rt.plugin.previewer(is_yazi_nightly and job.file or job.file.url, job.mime)
|
||||
local fetchers = rt.plugin.fetchers(job.file, job.mime)
|
||||
local preloaders = rt.plugin.preloaders(is_yazi_nightly and job.file or job.file.url, job.mime)
|
||||
|
||||
for i, v in ipairs(fetchers) do
|
||||
fetchers[i] = v.cmd
|
||||
end
|
||||
for i, v in ipairs(preloaders) do
|
||||
preloaders[i] = v.cmd
|
||||
end
|
||||
|
||||
rows[#rows + 1] = ui.Row({ { "", "Plugins" }, "" }):height(2):style(styles.header)
|
||||
row(prefix .. "Spotter:", spotter and spotter.cmd or "(none)")
|
||||
row(prefix .. "Previewer:", previewer and previewer.cmd or "(none)")
|
||||
row(prefix .. "Fetchers:", #fetchers ~= 0 and fetchers or "(none)")
|
||||
row(prefix .. "Preloaders:", #preloaders ~= 0 and preloaders or "(none)")
|
||||
end
|
||||
|
||||
return ui.Table(rows):area(job.area):row(1):col(1):col_style(styles.row_value):widths({
|
||||
ui.Constraint.Length(label_max_length),
|
||||
ui.Constraint.Fill(1),
|
||||
})
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local start, cache = os.clock(), ya.file_cache(job)
|
||||
if not cache or not self:preload(job) then
|
||||
return 1
|
||||
end
|
||||
ya.sleep(math.max(0, rt.preview.image_delay / 1000 + start - os.clock()))
|
||||
ya.preview_widget(job, { self:render_table(job) })
|
||||
end
|
||||
|
||||
function M:seek(job)
|
||||
local h = cx.active.current.hovered
|
||||
if h and h.url == job.file.url then
|
||||
local step = math.floor(job.units * job.area.h / 10)
|
||||
ya.emit("peek", {
|
||||
tostring(math.max(0, cx.active.preview.skip + step)),
|
||||
only_if = tostring(job.file.url),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function M:preload(job)
|
||||
local cache = ya.file_cache(job)
|
||||
if not cache or fs.cha(cache) then
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function M:spot(job)
|
||||
job.area = ui.Pos({ "center", w = 80, h = 25 })
|
||||
ya.spot_table(
|
||||
job,
|
||||
self
|
||||
:render_table(job, { show_plugins_section = true })
|
||||
:cell_style(th.spot.tbl_cell or ui.Style():fg("blue"):reverse())
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,21 +0,0 @@
|
||||
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.
|
||||
@@ -1,32 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,43 +0,0 @@
|
||||
--- @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 }
|
||||
@@ -1,21 +0,0 @@
|
||||
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.
|
||||
@@ -1,78 +0,0 @@
|
||||
# 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"
|
||||
url = "*"
|
||||
run = "git"
|
||||
|
||||
[[plugin.prepend_fetchers]]
|
||||
id = "git"
|
||||
url = "*/"
|
||||
run = "git"
|
||||
```
|
||||
|
||||
## Advanced
|
||||
|
||||
> [!NOTE]
|
||||
> The following configuration must be put before `require("git"):setup()`
|
||||
|
||||
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.
|
||||
@@ -1,255 +0,0 @@
|
||||
--- @since 25.12.29
|
||||
|
||||
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`
|
||||
---@enum CODES
|
||||
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 },
|
||||
}
|
||||
|
||||
---@param line string
|
||||
---@return CODES, string
|
||||
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
|
||||
---@diagnostic disable-next-line: missing-return
|
||||
end
|
||||
end
|
||||
|
||||
---@param cwd Url
|
||||
---@return string?
|
||||
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
|
||||
|
||||
---@param changed Changes
|
||||
---@return Changes
|
||||
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
|
||||
|
||||
---@param excluded string[]
|
||||
---@param cwd Url
|
||||
---@param repo Url
|
||||
---@return Changes
|
||||
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
|
||||
|
||||
---@param cwd string
|
||||
---@param repo string
|
||||
---@param changed Changes
|
||||
local add = ya.sync(function(st, cwd, repo, changed)
|
||||
---@cast st State
|
||||
|
||||
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
|
||||
ui.render()
|
||||
end)
|
||||
|
||||
---@param cwd string
|
||||
local remove = ya.sync(function(st, cwd)
|
||||
---@cast st State
|
||||
|
||||
local repo = st.dirs[cwd]
|
||||
if not repo then
|
||||
return
|
||||
end
|
||||
|
||||
ui.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)
|
||||
|
||||
---@param st State
|
||||
---@param opts Options
|
||||
local function setup(st, opts)
|
||||
st.dirs = {}
|
||||
st.repos = {}
|
||||
|
||||
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)
|
||||
if not self._file.in_current then
|
||||
return ""
|
||||
end
|
||||
|
||||
local url = self._file.url
|
||||
local repo = st.dirs[tostring(url.base or url.parent)]
|
||||
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
|
||||
|
||||
---@type UnstableFetcher
|
||||
local function fetch(_, job)
|
||||
local cwd = job.files[1].url.base or job.files[1].url.parent
|
||||
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 }
|
||||
@@ -1,12 +0,0 @@
|
||||
---@class State
|
||||
---@field dirs table<string, string|CODES> Mapping between a directory and its corresponding repository
|
||||
---@field repos table<string, Changes> Mapping between a repository and the status of each of its files
|
||||
|
||||
---@class Options
|
||||
---@field order number The order in which the status is displayed
|
||||
---@field renamed boolean Whether to include renamed files in the status (or treat them as modified)
|
||||
|
||||
-- TODO: move this to `types.yazi` once it's get stable
|
||||
---@alias UnstableFetcher fun(self: unknown, job: { files: File[] }): boolean, Error?
|
||||
|
||||
---@alias Changes table<string, CODES>
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Darius
|
||||
|
||||
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.
|
||||
@@ -1,31 +0,0 @@
|
||||
# lazygit.yazi
|
||||
Plugin for [Yazi](https://github.com/sxyazi/yazi) to manage git repos with [lazygit](https://github.com/jesseduffield/lazygit)
|
||||
## Dependencies
|
||||
Make sure [lazygit](https://github.com/jesseduffield/lazygit) is installed and in your `PATH`.
|
||||
## Installation
|
||||
|
||||
### Using `ya pkg`
|
||||
```
|
||||
ya pkg add Lil-Dank/lazygit
|
||||
```
|
||||
|
||||
### Manual
|
||||
**Linux/macOS**
|
||||
```
|
||||
git clone https://github.com/Lil-Dank/lazygit.yazi.git ~/.config/yazi/plugins/lazygit.yazi
|
||||
```
|
||||
**Windows**
|
||||
```
|
||||
git clone https://github.com/Lil-Dank/lazygit.yazi.git %AppData%\yazi\config\plugins\lazygit.yazi
|
||||
```
|
||||
## Configuration
|
||||
add this to your **keymap.toml** file
|
||||
```toml
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "i" ]
|
||||
run = "plugin lazygit"
|
||||
desc = "run lazygit"
|
||||
```
|
||||
you can customize the keybinding however you like. Please refer to the [keymap.toml](https://yazi-rs.github.io/docs/configuration/keymap) documentation
|
||||
## Disclaimer
|
||||
**THIS PLUGIN IS FOR THE STABLE RELEASE OF YAZI, DON'T PROPOSE ANY CHANGES BASED ON PRE-RELEASES OF YAZI**
|
||||
@@ -1,34 +0,0 @@
|
||||
return {
|
||||
entry = function()
|
||||
local output = Command("git"):arg("status"):stderr(Command.PIPED):output()
|
||||
if output.stderr ~= "" then
|
||||
ya.notify({
|
||||
title = "lazygit",
|
||||
content = "Not in a git directory\nError: " .. output.stderr,
|
||||
level = "warn",
|
||||
timeout = 5,
|
||||
})
|
||||
else
|
||||
permit = ui.hide and ui.hide() or ya.hide()
|
||||
local output, err_code = Command("lazygit"):stdin(Command.INHERIT):stdout(Command.INHERIT):stderr(Command.PIPED):spawn()
|
||||
if output and not err_code then
|
||||
output, err_code = output:wait_with_output()
|
||||
end
|
||||
if err_code ~= nil then
|
||||
ya.notify({
|
||||
title = "Failed to run lazygit command",
|
||||
content = "Status: " .. err_code,
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
})
|
||||
elseif not output.status.success then
|
||||
ya.notify({
|
||||
title = "lazygit in" .. cwd .. "failed, exit code " .. output.status.code,
|
||||
content = output.stderr,
|
||||
level = "error",
|
||||
timeout = 5,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
Copyright (c) 2024 Lauri Niskanen
|
||||
|
||||
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.
|
||||
@@ -1,135 +0,0 @@
|
||||
# mediainfo.yazi (fork)
|
||||
|
||||
<!--toc:start-->
|
||||
|
||||
- [mediainfo.yazi (fork)](#mediainfoyazi-fork)
|
||||
- [Preview](#preview)
|
||||
- [Installation](#installation)
|
||||
- [Configuration:](#configuration)
|
||||
- [Custom theme](#custom-theme)
|
||||
<!--toc:end-->
|
||||
|
||||
This is a Yazi plugin for previewing media files. The preview shows thumbnail
|
||||
using `ffmpeg` if available and media metadata using `mediainfo`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Minimum version: yazi v25.5.31.
|
||||
|
||||
## Preview
|
||||
|
||||
- Video
|
||||
|
||||

|
||||
|
||||
- Audio file with cover
|
||||
|
||||

|
||||
|
||||
- Images
|
||||
|
||||

|
||||
|
||||
- Subtitle
|
||||
|
||||

|
||||
|
||||
- SVG+XML file doesn't have useful information, so it only show the image preview.
|
||||
- There are more file extensions which are supported by mediainfo. Just add file's MIME type to `prepend_previewers`, `prepend_preloaders`.
|
||||
Use `spotter` to determine File's MIME type. [Default is `<Tab>` key](https://github.com/sxyazi/yazi/blob/1a6abae974370702c8865459344bf256de58359e/yazi-config/preset/keymap-default.toml#L59)
|
||||
|
||||
## Installation
|
||||
|
||||
- Install mediainfo CLI:
|
||||
- [https://mediaarea.net/en/MediaInfo/Download](https://mediaarea.net/en/MediaInfo/Download)
|
||||
- Run this command in terminal to check if it's installed correctly:
|
||||
|
||||
```bash
|
||||
mediainfo --version
|
||||
```
|
||||
|
||||
If it output `Not found` then add it to your PATH environment variable. It's better to ask ChatGPT to help you (Prompt: `Add MediaInfo CLI to PATH environment variable in Windows`).
|
||||
|
||||
- Install ImageMagick (for linux, you can use your distro package manager to install):
|
||||
https://imagemagick.org/script/download.php
|
||||
- Install this plugin:
|
||||
|
||||
```bash
|
||||
ya pkg add boydaihungst/mediainfo
|
||||
```
|
||||
|
||||
## Configuration:
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> `mediainfo` use built-in video, image, svg, magick plugins behind the scene to render preview image, song cover.
|
||||
> So you can remove those 4 plugins from `prepend_preloaders` and `prepend_previewers` sections in `yazi.toml`.
|
||||
|
||||
If you have cache problem, run this cmd, and follow the tips: `yazi --clear-cache`
|
||||
|
||||
Config folder for each OS: https://yazi-rs.github.io/docs/configuration/overview.
|
||||
|
||||
Create `.../yazi/yazi.toml` and add:
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> For yazi (>=v25.12.29) replace `name` with `url`
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
prepend_preloaders = [
|
||||
# Replace magick, image, video with mediainfo
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
{ mime = "application/subrip", run = "mediainfo" },
|
||||
# Adobe Illustrator, Adobe Photoshop is image/adobe.photoshop, already handled above
|
||||
{ mime = "application/postscript", run = "mediainfo" },
|
||||
]
|
||||
prepend_previewers = [
|
||||
# Replace magick, image, video with mediainfo
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo"},
|
||||
{ mime = "application/subrip", run = "mediainfo" },
|
||||
# Adobe Illustrator, Adobe Photoshop is image/adobe.photoshop, already handled above
|
||||
{ mime = "application/postscript", run = "mediainfo" },
|
||||
]
|
||||
# There are more extensions which are supported by mediainfo.
|
||||
# Just add file's MIME type to `previewers`, `preloaders` above.
|
||||
# https://mediaarea.net/en/MediaInfo/Support/Formats
|
||||
|
||||
# For a large file like Adobe Illustrator, Adobe Photoshop, etc
|
||||
# you may need to increase the memory limit if no image is rendered.
|
||||
# https://yazi-rs.github.io/docs/configuration/yazi#tasks
|
||||
[tasks]
|
||||
image_alloc = 1073741824 # = 1024*1024*1024 = 1024MB
|
||||
|
||||
```
|
||||
|
||||
## Custom theme
|
||||
|
||||
Using the same style with spotter. [Read more](https://github.com/sxyazi/yazi/pull/2391)
|
||||
|
||||
Edit or add `yazi/theme.toml`:
|
||||
|
||||
```toml
|
||||
[spot]
|
||||
# Section header style.
|
||||
# Example: Video, Text, Image,... with green color in preview images above
|
||||
title = { fg = "green" }
|
||||
|
||||
# Value style.
|
||||
# Example: `Format: FLAC` with blue color in preview images above
|
||||
tbl_col = { fg = "blue" }
|
||||
```
|
||||
|
||||
## (Optional) Keymaps to hide metadata and to preview images in full screen
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Use any key you want, but make sure there is no conflicts with [default Keybindings](https://github.com/sxyazi/yazi/blob/main/yazi-config/preset/keymap-default.toml).
|
||||
|
||||
Since Yazi prioritizes the first matching key, `prepend_keymap` takes precedence over defaults.
|
||||
Or you can use `keymap` to replace all other keys
|
||||
|
||||
```toml
|
||||
[mgr]
|
||||
prepend_keymap = [
|
||||
{ on = "<F9>", run = "plugin mediainfo -- toggle-metadata", desc = "Toggle media preview metadata" },
|
||||
]
|
||||
```
|
||||
@@ -1,302 +0,0 @@
|
||||
--- @since 26.1.22
|
||||
|
||||
local M = {}
|
||||
local const = require(".const")
|
||||
local utils = require(".utils")
|
||||
|
||||
local function image_layer_count(job)
|
||||
local cache = ya.file_cache({ file = job.file, skip = 0 })
|
||||
if not cache then
|
||||
return 0
|
||||
end
|
||||
local layer_count = utils.get_state("f" .. tostring(cache))
|
||||
if layer_count then
|
||||
return layer_count
|
||||
end
|
||||
local output, err = Command("identify")
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
if err or not output then
|
||||
return 0
|
||||
end
|
||||
layer_count = 0
|
||||
for line in output.stdout:gmatch("[^\r\n]+") do
|
||||
if line:match("%S") then
|
||||
layer_count = layer_count + 1
|
||||
end
|
||||
end
|
||||
utils.set_state("f" .. tostring(cache), layer_count)
|
||||
return layer_count
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local preload_status, preload_err = self:preload(job)
|
||||
-- Stop if preload failed
|
||||
if not preload_status then
|
||||
return
|
||||
end
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
|
||||
local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 })
|
||||
|
||||
local no_metadata = job.args.no_metadata
|
||||
local mediainfo_job_skip = job.skip
|
||||
::recalc_mediainfo_job_skip::
|
||||
local mediainfo_height = 0
|
||||
local lines = {}
|
||||
local limit = job.area.h
|
||||
local last_line = 0
|
||||
local EOF_mediainfo = true
|
||||
local is_wrap = rt.preview.wrap == "yes" or rt.preview.wrap == ui.Wrap.YES
|
||||
|
||||
if not no_metadata then
|
||||
local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. const.suffix
|
||||
local output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
if output then
|
||||
local max_width = math.max(1, job.area.w)
|
||||
if output:match("^Error:") then
|
||||
job.args.force_reload_mediainfo = true
|
||||
preload_status, preload_err = self:preload(job)
|
||||
if not preload_status or preload_err then
|
||||
return
|
||||
end
|
||||
output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
end
|
||||
|
||||
output = output:gsub("\n+$", "")
|
||||
|
||||
local iter = output:gmatch("[^\n]*")
|
||||
local str = iter()
|
||||
|
||||
while str ~= nil do
|
||||
local next_str = iter()
|
||||
local label, value = str:match("(.*[^ ]) +: (.*)")
|
||||
local line
|
||||
if label then
|
||||
if not (utils.get_state(const.STATE_KEY.skip_labels) or const.skip_labels)[label] then
|
||||
line = ui.Line({
|
||||
ui.Span(label .. ": "):style(ui.Style():fg("reset"):bold()),
|
||||
ui.Span(value):style(th.spot.tbl_col or ui.Style():fg("blue")),
|
||||
})
|
||||
end
|
||||
else
|
||||
if not (utils.get_state(const.STATE_KEY.skip_section_labels) or {})[str] then
|
||||
line = ui.Line({ ui.Span(str):style(th.spot.title or ui.Style():fg("green")) })
|
||||
end
|
||||
end
|
||||
|
||||
if line then
|
||||
local line_height = ui.height
|
||||
and ui.height(str, { width = max_width, ansi = true, wrap = rt.preview.wrap })
|
||||
or (math.max(1, is_wrap and math.ceil(ui.width(line) / max_width) or 1))
|
||||
if next_str == nil and line_height == 1 then
|
||||
EOF_mediainfo = true
|
||||
end
|
||||
if (last_line + line_height) > mediainfo_job_skip then
|
||||
table.insert(lines, line)
|
||||
end
|
||||
if (last_line + line_height) >= mediainfo_job_skip + limit then
|
||||
last_line = mediainfo_job_skip + limit
|
||||
EOF_mediainfo = false
|
||||
break
|
||||
end
|
||||
last_line = last_line + line_height
|
||||
end
|
||||
str = next_str
|
||||
end
|
||||
end
|
||||
mediainfo_height = math.min(limit, last_line)
|
||||
end
|
||||
|
||||
if not no_metadata then
|
||||
if EOF_mediainfo and #lines == 0 and mediainfo_job_skip > 0 then
|
||||
if
|
||||
image_layer_count(job)
|
||||
< (
|
||||
1
|
||||
+ math.floor(
|
||||
math.max(
|
||||
0,
|
||||
utils.get_state(const.STATE_KEY.units)
|
||||
and (math.abs(job.skip / utils.get_state(const.STATE_KEY.units)))
|
||||
or 0
|
||||
)
|
||||
)
|
||||
)
|
||||
then
|
||||
ya.emit("peek", {
|
||||
math.max(0, (job.skip - (utils.get_state(const.STATE_KEY.units) or 0))),
|
||||
only_if = job.file.url,
|
||||
upper_bound = true,
|
||||
})
|
||||
return
|
||||
else
|
||||
local last_valid_mediainfo_skip = utils.get_state(const.STATE_KEY.last_valid_mediainfo_skip)
|
||||
mediainfo_job_skip = last_valid_mediainfo_skip
|
||||
and last_valid_mediainfo_skip[tostring(cache_img_url_no_skip)]
|
||||
or math.max(0, mediainfo_job_skip - (utils.get_state(const.STATE_KEY.units) or 0))
|
||||
|
||||
goto recalc_mediainfo_job_skip
|
||||
end
|
||||
else
|
||||
utils.set_state(
|
||||
const.STATE_KEY.last_valid_mediainfo_skip,
|
||||
{ [tostring(cache_img_url_no_skip)] = mediainfo_job_skip }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
if utils.get_state(const.STATE_KEY.prev_metadata_area) then
|
||||
local old_metadata_area = utils.get_state(const.STATE_KEY.prev_metadata_area)
|
||||
if
|
||||
old_metadata_area.win_x == job.area.x
|
||||
and old_metadata_area.win_y == job.area.y
|
||||
and old_metadata_area.win_w == job.area.w
|
||||
and old_metadata_area.win_h == job.area.h
|
||||
then
|
||||
ya.preview_widget(job, {
|
||||
ui.Clear(ui.Rect({
|
||||
x = old_metadata_area.x,
|
||||
y = old_metadata_area.y,
|
||||
w = old_metadata_area.w,
|
||||
h = old_metadata_area.h,
|
||||
})),
|
||||
})
|
||||
end
|
||||
end
|
||||
utils.force_render()
|
||||
|
||||
local rendered_img_rect = cache_img_url
|
||||
and fs.cha(cache_img_url)
|
||||
and ya.image_show(
|
||||
cache_img_url,
|
||||
ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y,
|
||||
w = job.area.w,
|
||||
h = mediainfo_height > 0 and math.max(job.area.h - mediainfo_height, job.area.h / 2) or job.area.h,
|
||||
})
|
||||
)
|
||||
or nil
|
||||
local image_height = rendered_img_rect and rendered_img_rect.h or 0
|
||||
|
||||
-- Handle image preload error
|
||||
if preload_err then
|
||||
table.insert(lines, ui.Line(tostring(preload_err)):style(th.spot.title or ui.Style():fg("red")))
|
||||
end
|
||||
|
||||
ya.preview_widget(job, {
|
||||
ui.Text(lines)
|
||||
:area(ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
}))
|
||||
:wrap(is_wrap and ui.Wrap.YES or ui.Wrap.NO),
|
||||
})
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
utils.set_state(const.STATE_KEY.prev_metadata_area, not no_metadata and {
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
win_x = job.area.x,
|
||||
win_y = job.area.y,
|
||||
win_w = job.area.w,
|
||||
win_h = job.area.h,
|
||||
} or nil)
|
||||
end
|
||||
|
||||
function M:preload(job)
|
||||
local cmd = "mediainfo"
|
||||
local err_msg = ""
|
||||
local is_valid_utf8_path = utils.is_valid_utf8(tostring(job.file.path or job.file.cache or job.file.url))
|
||||
|
||||
-- NOTE: Preload image
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
local cache_img_url_cha = cache_img_url and fs.cha(cache_img_url)
|
||||
|
||||
-- NOTE: Only generate preview image when cache image is not exist
|
||||
if not cache_img_url_cha or cache_img_url_cha.len <= 0 then
|
||||
local cache_img_status, image_preload_err
|
||||
local layer_index = 0
|
||||
local units = utils.get_state(const.STATE_KEY.units)
|
||||
if units ~= nil then
|
||||
local max_layer = image_layer_count(job)
|
||||
layer_index = math.floor(math.max(0, math.abs(job.skip / units)))
|
||||
if layer_index + 1 > max_layer then
|
||||
layer_index = math.max(0, max_layer - 1)
|
||||
end
|
||||
end
|
||||
local cache_img_url_tmp = Url(cache_img_url .. ".tmp")
|
||||
if fs.cha(cache_img_url_tmp) then
|
||||
fs.remove("file", cache_img_url_tmp)
|
||||
end
|
||||
local tmp_file_path, _ = type(fs.unique) == "function" and fs.unique("file", cache_img_url_tmp)
|
||||
or fs.unique_name(cache_img_url_tmp)
|
||||
cache_img_status, image_preload_err = require("magick")
|
||||
.with_limit()
|
||||
:arg({
|
||||
"-background",
|
||||
"none",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) .. "[" .. tostring(
|
||||
layer_index
|
||||
) .. "]",
|
||||
"-auto-orient",
|
||||
"-strip",
|
||||
"-resize",
|
||||
string.format("%dx%d>", rt.preview.max_width, rt.preview.max_height),
|
||||
"-quality",
|
||||
rt.preview.image_quality,
|
||||
string.format("PNG32:%s", tostring(tmp_file_path)),
|
||||
})
|
||||
:status()
|
||||
if cache_img_status then
|
||||
os.rename(tostring(tmp_file_path), tostring(cache_img_url))
|
||||
end
|
||||
|
||||
if not cache_img_status and image_preload_err then
|
||||
ya.dbg("mediainfo", image_preload_err)
|
||||
err_msg = err_msg .. (image_preload_err and (tostring(image_preload_err)) or "")
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Get mediainfo and save to cache folder
|
||||
local cache_mediainfo_url = Url(tostring(ya.file_cache({ file = job.file, skip = 0 })) .. const.suffix)
|
||||
local cache_mediainfo_cha = fs.cha(cache_mediainfo_url)
|
||||
-- Case peek function called preload to refetch mediainfo
|
||||
if cache_mediainfo_cha and not job.args.force_reload_mediainfo then
|
||||
return true, err_msg ~= "" and ("Error: " .. err_msg) or nil
|
||||
end
|
||||
|
||||
local output, err
|
||||
if is_valid_utf8_path then
|
||||
output, err = Command(cmd)
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
else
|
||||
cmd = "cd "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url.path or job.file.url).parent))
|
||||
.. " && "
|
||||
.. cmd
|
||||
.. " "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url).name))
|
||||
output, err = Command(const.SHELL):arg({ "-c", cmd }):output()
|
||||
end
|
||||
if err then
|
||||
ya.dbg("mediainfo", tostring(err))
|
||||
err_msg = err_msg .. string.format("Failed to start `%s`. \n Do you have `%s` installed?\n", cmd, cmd)
|
||||
end
|
||||
|
||||
return fs.write(
|
||||
cache_mediainfo_url,
|
||||
(err_msg ~= "" and ("Error: " .. err_msg) or "") .. (output and output.stdout or "")
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,338 +0,0 @@
|
||||
--- @since 26.5.6
|
||||
|
||||
local M = {}
|
||||
local const = require(".const")
|
||||
local utils = require(".utils")
|
||||
|
||||
local function image_layer_count(job)
|
||||
local cache = ya.file_cache({ file = job.file, skip = 0 })
|
||||
if not cache then
|
||||
return 0
|
||||
end
|
||||
local layer_count = utils.get_state("f" .. tostring(cache))
|
||||
if layer_count then
|
||||
return layer_count
|
||||
end
|
||||
local output, err = Command("identify")
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
if err or not output then
|
||||
return 0
|
||||
end
|
||||
layer_count = 0
|
||||
for line in output.stdout:gmatch("[^\r\n]+") do
|
||||
if line:match("%S") then
|
||||
layer_count = layer_count + 1
|
||||
end
|
||||
end
|
||||
utils.set_state("f" .. tostring(cache), layer_count)
|
||||
return layer_count
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local preload_status, preload_err = self:preload(job)
|
||||
-- Stop if preload failed
|
||||
if not preload_status then
|
||||
return
|
||||
end
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
|
||||
local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 })
|
||||
|
||||
local no_metadata = job.args.no_metadata
|
||||
local mediainfo_job_skip = job.skip
|
||||
::recalc_mediainfo_job_skip::
|
||||
local mediainfo_height = 0
|
||||
local lines = {}
|
||||
local limit = job.area.h
|
||||
local last_line = 0
|
||||
local EOF_mediainfo = true
|
||||
local is_wrap = rt.preview.wrap == "yes" or rt.preview.wrap == ui.Wrap.YES
|
||||
|
||||
if not no_metadata then
|
||||
local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. const.suffix
|
||||
local output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
if output then
|
||||
local max_width = math.max(1, job.area.w)
|
||||
if output:match("^Error:") then
|
||||
job.args.force_reload_mediainfo = true
|
||||
preload_status, preload_err = self:preload(job)
|
||||
if not preload_status or preload_err then
|
||||
return
|
||||
end
|
||||
output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
end
|
||||
|
||||
output = output:gsub("\n+$", "")
|
||||
|
||||
local iter = output:gmatch("[^\n]*")
|
||||
local str = iter()
|
||||
local opt = { ansi = true, tab_size = rt.preview.tab_size, wrap = rt.preview.wrap, width = max_width }
|
||||
while str ~= nil do
|
||||
local next_str = iter()
|
||||
local label, value = str:match("(.*[^ ]) +: (.*)")
|
||||
|
||||
local line
|
||||
if label then
|
||||
if not (utils.get_state(const.STATE_KEY.skip_labels) or const.skip_labels)[label] then
|
||||
line = label .. ": " .. value
|
||||
end
|
||||
else
|
||||
if not (utils.get_state(const.STATE_KEY.skip_section_labels) or {})[str] then
|
||||
line = str
|
||||
end
|
||||
end
|
||||
|
||||
if line then
|
||||
local wrapped = ui.lines(line, opt)
|
||||
local line_height = #wrapped
|
||||
local from = 1
|
||||
local to = math.min(line_height, mediainfo_job_skip + limit - last_line)
|
||||
|
||||
local total_rendered_text_len = 1
|
||||
local total_label_rendered_len = 1
|
||||
local label_total_len = label and utf8.len(label .. ": ") or 0
|
||||
for j = from, to do
|
||||
local current_line_components = {}
|
||||
local wrapped_line_len = wrapped[j]:width() or 0
|
||||
local wrapped_raw =
|
||||
utils.utf8_sub(line, total_rendered_text_len, total_rendered_text_len + wrapped_line_len)
|
||||
wrapped_line_len = utf8.len(wrapped_raw)
|
||||
total_rendered_text_len = total_rendered_text_len + wrapped_line_len
|
||||
|
||||
if last_line + 1 > mediainfo_job_skip then
|
||||
local label_raw = label_total_len - total_label_rendered_len <= 0 and ""
|
||||
or utils.utf8_sub(wrapped_raw, 1, label_total_len - total_label_rendered_len)
|
||||
local label_raw_len = utf8.len(label_raw)
|
||||
if label_raw_len > 0 then
|
||||
table.insert(
|
||||
current_line_components,
|
||||
ui.Span(label_raw):style(ui.Style():fg("reset"):bold())
|
||||
)
|
||||
total_label_rendered_len = total_label_rendered_len + label_raw_len
|
||||
wrapped_raw = wrapped_raw:gsub("^" .. utils.is_literal_string(label_raw), "", 1)
|
||||
end
|
||||
if total_label_rendered_len >= label_total_len then
|
||||
local value_raw = wrapped_raw
|
||||
table.insert(
|
||||
current_line_components,
|
||||
ui.Span(value_raw or ""):style(
|
||||
label and (th.spot.tbl_col or ui.Style():fg("blue"))
|
||||
or (th.spot.title or ui.Style():fg("green"))
|
||||
)
|
||||
)
|
||||
end
|
||||
table.insert(lines, ui.Line(current_line_components))
|
||||
-- last_line = last_line + 1
|
||||
else
|
||||
total_label_rendered_len = total_label_rendered_len + total_rendered_text_len
|
||||
end
|
||||
last_line = last_line + 1
|
||||
if next_str == nil and not wrapped[j + 1] then
|
||||
EOF_mediainfo = true
|
||||
end
|
||||
if last_line >= mediainfo_job_skip + limit then
|
||||
last_line = mediainfo_job_skip + limit
|
||||
EOF_mediainfo = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
str = next_str
|
||||
end
|
||||
end
|
||||
mediainfo_height = math.min(limit, last_line)
|
||||
end
|
||||
|
||||
if not no_metadata then
|
||||
if EOF_mediainfo and #lines == 0 and mediainfo_job_skip > 0 then
|
||||
if
|
||||
image_layer_count(job)
|
||||
< (
|
||||
1
|
||||
+ math.floor(
|
||||
math.max(
|
||||
0,
|
||||
utils.get_state(const.STATE_KEY.units)
|
||||
and (math.abs(job.skip / utils.get_state(const.STATE_KEY.units)))
|
||||
or 0
|
||||
)
|
||||
)
|
||||
)
|
||||
then
|
||||
ya.emit("peek", {
|
||||
math.max(0, (job.skip - (utils.get_state(const.STATE_KEY.units) or 0))),
|
||||
only_if = job.file.url,
|
||||
upper_bound = true,
|
||||
})
|
||||
return
|
||||
else
|
||||
local last_valid_mediainfo_skip = utils.get_state(const.STATE_KEY.last_valid_mediainfo_skip)
|
||||
mediainfo_job_skip = last_valid_mediainfo_skip
|
||||
and last_valid_mediainfo_skip[tostring(cache_img_url_no_skip)]
|
||||
or math.max(0, mediainfo_job_skip - (utils.get_state(const.STATE_KEY.units) or 0))
|
||||
|
||||
goto recalc_mediainfo_job_skip
|
||||
end
|
||||
else
|
||||
utils.set_state(
|
||||
const.STATE_KEY.last_valid_mediainfo_skip,
|
||||
{ [tostring(cache_img_url_no_skip)] = mediainfo_job_skip }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
if utils.get_state(const.STATE_KEY.prev_metadata_area) then
|
||||
local old_metadata_area = utils.get_state(const.STATE_KEY.prev_metadata_area)
|
||||
if
|
||||
old_metadata_area.win_x == job.area.x
|
||||
and old_metadata_area.win_y == job.area.y
|
||||
and old_metadata_area.win_w == job.area.w
|
||||
and old_metadata_area.win_h == job.area.h
|
||||
then
|
||||
ya.preview_widget(job, {
|
||||
ui.Clear(ui.Rect({
|
||||
x = old_metadata_area.x,
|
||||
y = old_metadata_area.y,
|
||||
w = old_metadata_area.w,
|
||||
h = old_metadata_area.h,
|
||||
})),
|
||||
})
|
||||
end
|
||||
end
|
||||
utils.force_render()
|
||||
|
||||
local rendered_img_rect = cache_img_url
|
||||
and fs.cha(cache_img_url)
|
||||
and ya.image_show(
|
||||
cache_img_url,
|
||||
ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y,
|
||||
w = job.area.w,
|
||||
h = mediainfo_height > 0 and math.max(job.area.h - mediainfo_height, job.area.h / 2) or job.area.h,
|
||||
})
|
||||
)
|
||||
or nil
|
||||
local image_height = rendered_img_rect and rendered_img_rect.h or 0
|
||||
|
||||
-- Handle image preload error
|
||||
if preload_err then
|
||||
table.insert(lines, ui.Line(tostring(preload_err)):style(th.spot.title or ui.Style():fg("red")))
|
||||
end
|
||||
|
||||
ya.preview_widget(job, {
|
||||
ui.Text(lines)
|
||||
:area(ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
}))
|
||||
:wrap(is_wrap and ui.Wrap.YES or ui.Wrap.NO),
|
||||
})
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
utils.set_state(const.STATE_KEY.prev_metadata_area, not no_metadata and {
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
win_x = job.area.x,
|
||||
win_y = job.area.y,
|
||||
win_w = job.area.w,
|
||||
win_h = job.area.h,
|
||||
} or nil)
|
||||
end
|
||||
|
||||
function M:preload(job)
|
||||
local cmd = "mediainfo"
|
||||
local err_msg = ""
|
||||
local is_valid_utf8_path = utils.is_valid_utf8(tostring(job.file.path or job.file.cache or job.file.url))
|
||||
|
||||
-- NOTE: Preload image
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
local cache_img_url_cha = cache_img_url and fs.cha(cache_img_url)
|
||||
|
||||
-- NOTE: Only generate preview image when cache image is not exist
|
||||
if not cache_img_url_cha or cache_img_url_cha.len <= 0 then
|
||||
local cache_img_status, image_preload_err
|
||||
local layer_index = 0
|
||||
local units = utils.get_state(const.STATE_KEY.units)
|
||||
if units ~= nil then
|
||||
local max_layer = image_layer_count(job)
|
||||
layer_index = math.floor(math.max(0, math.abs(job.skip / units)))
|
||||
if layer_index + 1 > max_layer then
|
||||
layer_index = math.max(0, max_layer - 1)
|
||||
end
|
||||
end
|
||||
local cache_img_url_tmp = Url(cache_img_url .. ".tmp")
|
||||
if fs.cha(cache_img_url_tmp) then
|
||||
fs.remove("file", cache_img_url_tmp)
|
||||
end
|
||||
local tmp_file_path, _ = type(fs.unique) == "function" and fs.unique("file", cache_img_url_tmp)
|
||||
or fs.unique_name(cache_img_url_tmp)
|
||||
cache_img_status, image_preload_err = require("magick")
|
||||
.with_limit()
|
||||
:arg({
|
||||
"-background",
|
||||
"none",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) .. "[" .. tostring(
|
||||
layer_index
|
||||
) .. "]",
|
||||
"-auto-orient",
|
||||
"-strip",
|
||||
"-resize",
|
||||
string.format("%dx%d>", rt.preview.max_width, rt.preview.max_height),
|
||||
"-quality",
|
||||
rt.preview.image_quality,
|
||||
string.format("PNG32:%s", tostring(tmp_file_path)),
|
||||
})
|
||||
:status()
|
||||
if cache_img_status then
|
||||
os.rename(tostring(tmp_file_path), tostring(cache_img_url))
|
||||
end
|
||||
|
||||
if not cache_img_status and image_preload_err then
|
||||
ya.dbg("mediainfo", image_preload_err)
|
||||
err_msg = err_msg .. (image_preload_err and (tostring(image_preload_err)) or "")
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Get mediainfo and save to cache folder
|
||||
local cache_mediainfo_url = Url(tostring(ya.file_cache({ file = job.file, skip = 0 })) .. const.suffix)
|
||||
local cache_mediainfo_cha = fs.cha(cache_mediainfo_url)
|
||||
-- Case peek function called preload to refetch mediainfo
|
||||
if cache_mediainfo_cha and not job.args.force_reload_mediainfo then
|
||||
return true, err_msg ~= "" and ("Error: " .. err_msg) or nil
|
||||
end
|
||||
|
||||
local output, err
|
||||
if is_valid_utf8_path then
|
||||
output, err = Command(cmd)
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
else
|
||||
cmd = "cd "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url.path or job.file.url).parent))
|
||||
.. " && "
|
||||
.. cmd
|
||||
.. " "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url).name))
|
||||
output, err = Command(const.SHELL):arg({ "-c", cmd }):output()
|
||||
end
|
||||
if err then
|
||||
ya.dbg("mediainfo", tostring(err))
|
||||
err_msg = err_msg .. string.format("Failed to start `%s`. \n Do you have `%s` installed?\n", cmd, cmd)
|
||||
end
|
||||
|
||||
return fs.write(
|
||||
cache_mediainfo_url,
|
||||
(err_msg ~= "" and ("Error: " .. err_msg) or "") .. (output and output.stdout or "")
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
|
Before Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 286 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 261 KiB |
@@ -1,345 +0,0 @@
|
||||
--- @since 26.1.22
|
||||
|
||||
local M = {}
|
||||
local const = require(".const")
|
||||
local utils = require(".utils")
|
||||
|
||||
local function get_cover_layers(job)
|
||||
local cache = ya.file_cache({ file = job.file, skip = 0 })
|
||||
if not cache then
|
||||
return {}
|
||||
end
|
||||
local covers = utils.get_state("f" .. tostring(cache))
|
||||
if covers and type(covers) == "table" then
|
||||
return covers
|
||||
end
|
||||
local output, err = Command("ffprobe"):arg({
|
||||
"-v",
|
||||
"error",
|
||||
"-select_streams",
|
||||
"v",
|
||||
"-show_entries",
|
||||
"stream=index:stream_disposition=attached_pic",
|
||||
"-of",
|
||||
"json",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url),
|
||||
}):output()
|
||||
if err or not output then
|
||||
return {}
|
||||
end
|
||||
covers = {}
|
||||
local data = ya.json_decode(output.stdout)
|
||||
if type(data.streams) == "table" then
|
||||
for _, stream in ipairs(data.streams) do
|
||||
if stream.disposition and stream.disposition.attached_pic then
|
||||
covers[#covers + 1] = stream.index
|
||||
end
|
||||
end
|
||||
end
|
||||
utils.set_state("f" .. tostring(cache), covers)
|
||||
return covers
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local preload_status, preload_err = self:preload(job)
|
||||
-- Stop if preload failed
|
||||
if not preload_status then
|
||||
return
|
||||
end
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
|
||||
local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 })
|
||||
|
||||
local no_metadata = job.args.no_metadata
|
||||
local mediainfo_job_skip = job.skip
|
||||
::recalc_mediainfo_job_skip::
|
||||
local mediainfo_height = 0
|
||||
local lines = {}
|
||||
local limit = job.area.h
|
||||
local last_line = 0
|
||||
local EOF_mediainfo = true
|
||||
local is_wrap = rt.preview.wrap == "yes" or rt.preview.wrap == ui.Wrap.YES
|
||||
|
||||
if not no_metadata then
|
||||
local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. const.suffix
|
||||
local output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
if output then
|
||||
local max_width = math.max(1, job.area.w)
|
||||
if output:match("^Error:") then
|
||||
job.args.force_reload_mediainfo = true
|
||||
preload_status, preload_err = self:preload(job)
|
||||
if not preload_status or preload_err then
|
||||
return
|
||||
end
|
||||
output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
end
|
||||
|
||||
output = output:gsub("\n+$", "")
|
||||
|
||||
local iter = output:gmatch("[^\n]*")
|
||||
local str = iter()
|
||||
|
||||
while str ~= nil do
|
||||
local next_str = iter()
|
||||
local label, value = str:match("(.*[^ ]) +: (.*)")
|
||||
local line
|
||||
if label then
|
||||
if not (utils.get_state(const.STATE_KEY.skip_labels) or const.skip_labels)[label] then
|
||||
line = ui.Line({
|
||||
ui.Span(label .. ": "):style(ui.Style():fg("reset"):bold()),
|
||||
ui.Span(value):style(th.spot.tbl_col or ui.Style():fg("blue")),
|
||||
})
|
||||
end
|
||||
else
|
||||
if not (utils.get_state(const.STATE_KEY.skip_section_labels) or {})[str] then
|
||||
line = ui.Line({ ui.Span(str):style(th.spot.title or ui.Style():fg("green")) })
|
||||
end
|
||||
end
|
||||
|
||||
if line then
|
||||
local line_height = ui.height
|
||||
and ui.height(str, { width = max_width, ansi = true, wrap = rt.preview.wrap })
|
||||
or (math.max(1, is_wrap and math.ceil(ui.width(line) / max_width) or 1))
|
||||
if next_str == nil and line_height == 1 then
|
||||
EOF_mediainfo = true
|
||||
end
|
||||
if (last_line + line_height) > mediainfo_job_skip then
|
||||
table.insert(lines, line)
|
||||
end
|
||||
if (last_line + line_height) >= mediainfo_job_skip + limit then
|
||||
last_line = mediainfo_job_skip + limit
|
||||
EOF_mediainfo = false
|
||||
break
|
||||
end
|
||||
last_line = last_line + line_height
|
||||
end
|
||||
str = next_str
|
||||
end
|
||||
end
|
||||
mediainfo_height = math.min(limit, last_line)
|
||||
end
|
||||
|
||||
if not no_metadata then
|
||||
if EOF_mediainfo and #lines == 0 and mediainfo_job_skip > 0 then
|
||||
local covers = get_cover_layers(job)
|
||||
local cover_index = math.floor(
|
||||
math.max(
|
||||
1,
|
||||
utils.get_state(const.STATE_KEY.units)
|
||||
and (math.abs(job.skip / utils.get_state(const.STATE_KEY.units)))
|
||||
or 0
|
||||
)
|
||||
)
|
||||
|
||||
if not covers[cover_index] then
|
||||
ya.emit("peek", {
|
||||
math.max(0, (job.skip - (utils.get_state(const.STATE_KEY.units) or 0))),
|
||||
only_if = job.file.url,
|
||||
upper_bound = true,
|
||||
})
|
||||
return
|
||||
else
|
||||
-- NOTE: Recalculate mediainfo using cached latest valid skip value when reach the end of mediainfo output
|
||||
local last_valid_mediainfo_skip = utils.get_state(const.STATE_KEY.last_valid_mediainfo_skip)
|
||||
mediainfo_job_skip = last_valid_mediainfo_skip
|
||||
and last_valid_mediainfo_skip[tostring(cache_img_url_no_skip)]
|
||||
or math.max(0, mediainfo_job_skip - (utils.get_state(const.STATE_KEY.units) or 0))
|
||||
|
||||
goto recalc_mediainfo_job_skip
|
||||
end
|
||||
else
|
||||
utils.set_state(
|
||||
const.STATE_KEY.last_valid_mediainfo_skip,
|
||||
{ [tostring(cache_img_url_no_skip)] = mediainfo_job_skip }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
if utils.get_state(const.STATE_KEY.prev_metadata_area) then
|
||||
local old_metadata_area = utils.get_state(const.STATE_KEY.prev_metadata_area)
|
||||
if
|
||||
old_metadata_area.win_x == job.area.x
|
||||
and old_metadata_area.win_y == job.area.y
|
||||
and old_metadata_area.win_w == job.area.w
|
||||
and old_metadata_area.win_h == job.area.h
|
||||
then
|
||||
ya.preview_widget(job, {
|
||||
ui.Clear(ui.Rect({
|
||||
x = old_metadata_area.x,
|
||||
y = old_metadata_area.y,
|
||||
w = old_metadata_area.w,
|
||||
h = old_metadata_area.h,
|
||||
})),
|
||||
})
|
||||
end
|
||||
end
|
||||
utils.force_render()
|
||||
|
||||
local rendered_img_rect = cache_img_url
|
||||
and fs.cha(cache_img_url)
|
||||
and ya.image_show(
|
||||
cache_img_url,
|
||||
ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y,
|
||||
w = job.area.w,
|
||||
h = mediainfo_height > 0 and math.max(job.area.h - mediainfo_height, job.area.h / 2) or job.area.h,
|
||||
})
|
||||
)
|
||||
or nil
|
||||
local image_height = rendered_img_rect and rendered_img_rect.h or 0
|
||||
|
||||
-- Handle image preload error
|
||||
if preload_err then
|
||||
table.insert(lines, ui.Line(tostring(preload_err)):style(th.spot.title or ui.Style():fg("red")))
|
||||
end
|
||||
|
||||
ya.preview_widget(job, {
|
||||
ui.Text(lines)
|
||||
:area(ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
}))
|
||||
:wrap(is_wrap and ui.Wrap.YES or ui.Wrap.NO),
|
||||
})
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
utils.set_state(const.STATE_KEY.prev_metadata_area, not no_metadata and {
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
win_x = job.area.x,
|
||||
win_y = job.area.y,
|
||||
win_w = job.area.w,
|
||||
win_h = job.area.h,
|
||||
} or nil)
|
||||
end
|
||||
|
||||
function M:preload(job)
|
||||
local cmd = "mediainfo"
|
||||
local err_msg = ""
|
||||
local is_valid_utf8_path = utils.is_valid_utf8(tostring(job.file.path or job.file.cache or job.file.url))
|
||||
|
||||
-- NOTE: Preload image
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
local cache_img_url_cha = cache_img_url and fs.cha(cache_img_url)
|
||||
|
||||
-- NOTE: Only generate preview image when cache image is not exist
|
||||
if cache_img_url and (not cache_img_url_cha or cache_img_url_cha.len <= 0) then
|
||||
local units = utils.get_state(const.STATE_KEY.units)
|
||||
local covers = get_cover_layers(job)
|
||||
local cover_index = covers[1] or 0
|
||||
if units ~= nil then
|
||||
cover_index = math.floor(math.max(1, math.abs(job.skip / units)))
|
||||
if not covers[cover_index] then
|
||||
cover_index = math.max(0, #covers - 1)
|
||||
end
|
||||
end
|
||||
local qv = 31 - math.floor(rt.preview.image_quality * 0.3)
|
||||
local audio_preload_output, audio_preload_err = Command("ffmpeg"):arg({
|
||||
"-v",
|
||||
"error",
|
||||
"-threads",
|
||||
1,
|
||||
"-i",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url),
|
||||
"-map",
|
||||
string.format("0:v:%d?", cover_index),
|
||||
"-an",
|
||||
"-sn",
|
||||
"-dn",
|
||||
"-vframes",
|
||||
1,
|
||||
"-q:v",
|
||||
qv,
|
||||
"-vf",
|
||||
string.format("scale=-1:'min(%d,ih)':flags=fast_bilinear", rt.preview.max_height / 2),
|
||||
"-f",
|
||||
"image2",
|
||||
"-y",
|
||||
tostring(cache_img_url),
|
||||
}):output()
|
||||
-- NOTE: Some audio types doesn't have cover image -> error ""
|
||||
if audio_preload_err then
|
||||
ya.dbg("mediainfo", audio_preload_err)
|
||||
err_msg = err_msg
|
||||
.. string.format(
|
||||
"Failed to start `%s`.\n Error: %s\n",
|
||||
"ffmpeg",
|
||||
tostring(audio_preload_err or (audio_preload_output and audio_preload_output.stderr or ""))
|
||||
)
|
||||
elseif
|
||||
audio_preload_output
|
||||
and type(audio_preload_output.stderr) == "string"
|
||||
and audio_preload_output.stderr:find("does not contain any stream")
|
||||
then
|
||||
ya.dbg("mediainfo", audio_preload_output and audio_preload_output.stderr)
|
||||
cache_img_url_cha, _ = fs.cha(cache_img_url)
|
||||
if cache_img_url_cha then
|
||||
fs.remove("file", Url(cache_img_url))
|
||||
end
|
||||
-- NOTE: Workaround case audio has no cover image. Prevent regenerate preview image
|
||||
audio_preload_output, audio_preload_err = require("magick")
|
||||
.with_limit()
|
||||
:arg({
|
||||
"-size",
|
||||
"1x1",
|
||||
"canvas:none",
|
||||
string.format("PNG32:%s", cache_img_url),
|
||||
})
|
||||
:output()
|
||||
if
|
||||
(audio_preload_output and audio_preload_output.stderr ~= nil and audio_preload_output.stderr ~= "")
|
||||
or audio_preload_err
|
||||
then
|
||||
ya.dbg("mediainfo", audio_preload_err or (audio_preload_output and audio_preload_output.stderr))
|
||||
err_msg = err_msg
|
||||
.. string.format(
|
||||
"Failed to start `%s`.\n Error: %s\n",
|
||||
"magick",
|
||||
tostring(audio_preload_err or (audio_preload_output and audio_preload_output.stderr or ""))
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Get mediainfo and save to cache folder
|
||||
local cache_mediainfo_url = Url(tostring(ya.file_cache({ file = job.file, skip = 0 })) .. const.suffix)
|
||||
local cache_mediainfo_cha = fs.cha(cache_mediainfo_url)
|
||||
-- Case peek function called preload to refetch mediainfo
|
||||
if cache_mediainfo_cha and not job.args.force_reload_mediainfo then
|
||||
return true, err_msg ~= "" and ("Error: " .. err_msg) or nil
|
||||
end
|
||||
|
||||
local output, err
|
||||
if is_valid_utf8_path then
|
||||
output, err = Command(cmd)
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
else
|
||||
cmd = "cd "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url.path or job.file.url).parent))
|
||||
.. " && "
|
||||
.. cmd
|
||||
.. " "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url).name))
|
||||
output, err = Command(const.SHELL):arg({ "-c", cmd }):output()
|
||||
end
|
||||
if err then
|
||||
ya.dbg("mediainfo", tostring(err))
|
||||
err_msg = err_msg .. string.format("Failed to start `%s`. \n Do you have `%s` installed?\n", cmd, cmd)
|
||||
end
|
||||
|
||||
return fs.write(
|
||||
cache_mediainfo_url,
|
||||
(err_msg ~= "" and ("Error: " .. err_msg) or "") .. (output and output.stdout or "")
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,381 +0,0 @@
|
||||
--- @since 26.5.6
|
||||
|
||||
local M = {}
|
||||
local const = require(".const")
|
||||
local utils = require(".utils")
|
||||
|
||||
local function get_cover_layers(job)
|
||||
local cache = ya.file_cache({ file = job.file, skip = 0 })
|
||||
if not cache then
|
||||
return {}
|
||||
end
|
||||
local covers = utils.get_state("f" .. tostring(cache))
|
||||
if covers and type(covers) == "table" then
|
||||
return covers
|
||||
end
|
||||
local output, err = Command("ffprobe"):arg({
|
||||
"-v",
|
||||
"error",
|
||||
"-select_streams",
|
||||
"v",
|
||||
"-show_entries",
|
||||
"stream=index:stream_disposition=attached_pic",
|
||||
"-of",
|
||||
"json",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url),
|
||||
}):output()
|
||||
if err or not output then
|
||||
return {}
|
||||
end
|
||||
covers = {}
|
||||
local data = ya.json_decode(output.stdout)
|
||||
if type(data.streams) == "table" then
|
||||
for _, stream in ipairs(data.streams) do
|
||||
if stream.disposition and stream.disposition.attached_pic then
|
||||
covers[#covers + 1] = stream.index
|
||||
end
|
||||
end
|
||||
end
|
||||
utils.set_state("f" .. tostring(cache), covers)
|
||||
return covers
|
||||
end
|
||||
|
||||
function M:peek(job)
|
||||
local preload_status, preload_err = self:preload(job)
|
||||
-- Stop if preload failed
|
||||
if not preload_status then
|
||||
return
|
||||
end
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
|
||||
local cache_img_url_no_skip = ya.file_cache({ file = job.file, skip = 0 })
|
||||
|
||||
local no_metadata = job.args.no_metadata
|
||||
local mediainfo_job_skip = job.skip
|
||||
::recalc_mediainfo_job_skip::
|
||||
local mediainfo_height = 0
|
||||
local lines = {}
|
||||
local limit = job.area.h
|
||||
local last_line = 0
|
||||
local EOF_mediainfo = true
|
||||
local is_wrap = rt.preview.wrap == "yes" or rt.preview.wrap == ui.Wrap.YES
|
||||
|
||||
if not no_metadata then
|
||||
local cache_mediainfo_path = tostring(cache_img_url_no_skip) .. const.suffix
|
||||
local output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
if output then
|
||||
local max_width = math.max(1, job.area.w)
|
||||
if output:match("^Error:") then
|
||||
job.args.force_reload_mediainfo = true
|
||||
preload_status, preload_err = self:preload(job)
|
||||
if not preload_status or preload_err then
|
||||
return
|
||||
end
|
||||
output = utils.read_mediainfo_cached_file(cache_mediainfo_path)
|
||||
end
|
||||
|
||||
output = output:gsub("\n+$", "")
|
||||
|
||||
local iter = output:gmatch("[^\n]*")
|
||||
local str = iter()
|
||||
local opt = { ansi = true, tab_size = rt.preview.tab_size, wrap = rt.preview.wrap, width = max_width }
|
||||
while str ~= nil do
|
||||
local next_str = iter()
|
||||
local label, value = str:match("(.*[^ ]) +: (.*)")
|
||||
|
||||
local line
|
||||
if label then
|
||||
if not (utils.get_state(const.STATE_KEY.skip_labels) or const.skip_labels)[label] then
|
||||
line = label .. ": " .. value
|
||||
end
|
||||
else
|
||||
if not (utils.get_state(const.STATE_KEY.skip_section_labels) or {})[str] then
|
||||
line = str
|
||||
end
|
||||
end
|
||||
|
||||
if line then
|
||||
local wrapped = ui.lines(line, opt)
|
||||
local line_height = #wrapped
|
||||
local from = 1
|
||||
local to = math.min(line_height, mediainfo_job_skip + limit - last_line)
|
||||
|
||||
local total_rendered_text_len = 1
|
||||
local total_label_rendered_len = 1
|
||||
local label_total_len = label and utf8.len(label .. ": ") or 0
|
||||
for j = from, to do
|
||||
local current_line_components = {}
|
||||
local wrapped_line_len = wrapped[j]:width() or 0
|
||||
local wrapped_raw =
|
||||
utils.utf8_sub(line, total_rendered_text_len, total_rendered_text_len + wrapped_line_len)
|
||||
wrapped_line_len = utf8.len(wrapped_raw)
|
||||
total_rendered_text_len = total_rendered_text_len + wrapped_line_len
|
||||
|
||||
if last_line + 1 > mediainfo_job_skip then
|
||||
local label_raw = label_total_len - total_label_rendered_len <= 0 and ""
|
||||
or utils.utf8_sub(wrapped_raw, 1, label_total_len - total_label_rendered_len)
|
||||
local label_raw_len = utf8.len(label_raw)
|
||||
if label_raw_len > 0 then
|
||||
table.insert(
|
||||
current_line_components,
|
||||
ui.Span(label_raw):style(ui.Style():fg("reset"):bold())
|
||||
)
|
||||
total_label_rendered_len = total_label_rendered_len + label_raw_len
|
||||
wrapped_raw = wrapped_raw:gsub("^" .. utils.is_literal_string(label_raw), "", 1)
|
||||
end
|
||||
if total_label_rendered_len >= label_total_len then
|
||||
local value_raw = wrapped_raw
|
||||
table.insert(
|
||||
current_line_components,
|
||||
ui.Span(value_raw or ""):style(
|
||||
label and (th.spot.tbl_col or ui.Style():fg("blue"))
|
||||
or (th.spot.title or ui.Style():fg("green"))
|
||||
)
|
||||
)
|
||||
end
|
||||
table.insert(lines, ui.Line(current_line_components))
|
||||
-- last_line = last_line + 1
|
||||
else
|
||||
total_label_rendered_len = total_label_rendered_len + total_rendered_text_len
|
||||
end
|
||||
last_line = last_line + 1
|
||||
if next_str == nil and not wrapped[j + 1] then
|
||||
EOF_mediainfo = true
|
||||
end
|
||||
if last_line >= mediainfo_job_skip + limit then
|
||||
last_line = mediainfo_job_skip + limit
|
||||
EOF_mediainfo = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
str = next_str
|
||||
end
|
||||
end
|
||||
mediainfo_height = math.min(limit, last_line)
|
||||
end
|
||||
|
||||
if not no_metadata then
|
||||
if EOF_mediainfo and #lines == 0 and mediainfo_job_skip > 0 then
|
||||
local covers = get_cover_layers(job)
|
||||
local cover_index = math.floor(
|
||||
math.max(
|
||||
1,
|
||||
utils.get_state(const.STATE_KEY.units)
|
||||
and (math.abs(job.skip / utils.get_state(const.STATE_KEY.units)))
|
||||
or 0
|
||||
)
|
||||
)
|
||||
|
||||
if not covers[cover_index] then
|
||||
ya.emit("peek", {
|
||||
math.max(0, (job.skip - (utils.get_state(const.STATE_KEY.units) or 0))),
|
||||
only_if = job.file.url,
|
||||
upper_bound = true,
|
||||
})
|
||||
return
|
||||
else
|
||||
-- NOTE: Recalculate mediainfo using cached latest valid skip value when reach the end of mediainfo output
|
||||
local last_valid_mediainfo_skip = utils.get_state(const.STATE_KEY.last_valid_mediainfo_skip)
|
||||
mediainfo_job_skip = last_valid_mediainfo_skip
|
||||
and last_valid_mediainfo_skip[tostring(cache_img_url_no_skip)]
|
||||
or math.max(0, mediainfo_job_skip - (utils.get_state(const.STATE_KEY.units) or 0))
|
||||
|
||||
goto recalc_mediainfo_job_skip
|
||||
end
|
||||
else
|
||||
utils.set_state(
|
||||
const.STATE_KEY.last_valid_mediainfo_skip,
|
||||
{ [tostring(cache_img_url_no_skip)] = mediainfo_job_skip }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
if utils.get_state(const.STATE_KEY.prev_metadata_area) then
|
||||
local old_metadata_area = utils.get_state(const.STATE_KEY.prev_metadata_area)
|
||||
if
|
||||
old_metadata_area.win_x == job.area.x
|
||||
and old_metadata_area.win_y == job.area.y
|
||||
and old_metadata_area.win_w == job.area.w
|
||||
and old_metadata_area.win_h == job.area.h
|
||||
then
|
||||
ya.preview_widget(job, {
|
||||
ui.Clear(ui.Rect({
|
||||
x = old_metadata_area.x,
|
||||
y = old_metadata_area.y,
|
||||
w = old_metadata_area.w,
|
||||
h = old_metadata_area.h,
|
||||
})),
|
||||
})
|
||||
end
|
||||
end
|
||||
utils.force_render()
|
||||
|
||||
local rendered_img_rect = cache_img_url
|
||||
and fs.cha(cache_img_url)
|
||||
and ya.image_show(
|
||||
cache_img_url,
|
||||
ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y,
|
||||
w = job.area.w,
|
||||
h = mediainfo_height > 0 and math.max(job.area.h - mediainfo_height, job.area.h / 2) or job.area.h,
|
||||
})
|
||||
)
|
||||
or nil
|
||||
local image_height = rendered_img_rect and rendered_img_rect.h or 0
|
||||
|
||||
-- Handle image preload error
|
||||
if preload_err then
|
||||
table.insert(lines, ui.Line(tostring(preload_err)):style(th.spot.title or ui.Style():fg("red")))
|
||||
end
|
||||
|
||||
ya.preview_widget(job, {
|
||||
ui.Text(lines)
|
||||
:area(ui.Rect({
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
}))
|
||||
:wrap(is_wrap and ui.Wrap.YES or ui.Wrap.NO),
|
||||
})
|
||||
|
||||
-- NOTE: Hacky way to prevent image overlap with old metadata area
|
||||
utils.set_state(const.STATE_KEY.prev_metadata_area, not no_metadata and {
|
||||
x = job.area.x,
|
||||
y = job.area.y + image_height,
|
||||
w = job.area.w,
|
||||
h = job.area.h - image_height,
|
||||
win_x = job.area.x,
|
||||
win_y = job.area.y,
|
||||
win_w = job.area.w,
|
||||
win_h = job.area.h,
|
||||
} or nil)
|
||||
end
|
||||
|
||||
function M:preload(job)
|
||||
local cmd = "mediainfo"
|
||||
local err_msg = ""
|
||||
local is_valid_utf8_path = utils.is_valid_utf8(tostring(job.file.path or job.file.cache or job.file.url))
|
||||
|
||||
-- NOTE: Preload image
|
||||
|
||||
local cache_img_url = ya.file_cache(job)
|
||||
local cache_img_url_cha = cache_img_url and fs.cha(cache_img_url)
|
||||
|
||||
-- NOTE: Only generate preview image when cache image is not exist
|
||||
if cache_img_url and (not cache_img_url_cha or cache_img_url_cha.len <= 0) then
|
||||
local units = utils.get_state(const.STATE_KEY.units)
|
||||
local covers = get_cover_layers(job)
|
||||
local cover_index = covers[1] or 0
|
||||
if units ~= nil then
|
||||
cover_index = math.floor(math.max(1, math.abs(job.skip / units)))
|
||||
if not covers[cover_index] then
|
||||
cover_index = math.max(0, #covers - 1)
|
||||
end
|
||||
end
|
||||
local qv = 31 - math.floor(rt.preview.image_quality * 0.3)
|
||||
local audio_preload_output, audio_preload_err = Command("ffmpeg"):arg({
|
||||
"-v",
|
||||
"error",
|
||||
"-threads",
|
||||
1,
|
||||
"-i",
|
||||
tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url),
|
||||
"-map",
|
||||
string.format("0:v:%d?", cover_index),
|
||||
"-an",
|
||||
"-sn",
|
||||
"-dn",
|
||||
"-vframes",
|
||||
1,
|
||||
"-q:v",
|
||||
qv,
|
||||
"-vf",
|
||||
string.format("scale=-1:'min(%d,ih)':flags=fast_bilinear", rt.preview.max_height / 2),
|
||||
"-f",
|
||||
"image2",
|
||||
"-y",
|
||||
tostring(cache_img_url),
|
||||
}):output()
|
||||
-- NOTE: Some audio types doesn't have cover image -> error ""
|
||||
if audio_preload_err then
|
||||
ya.dbg("mediainfo", audio_preload_err)
|
||||
err_msg = err_msg
|
||||
.. string.format(
|
||||
"Failed to start `%s`.\n Error: %s\n",
|
||||
"ffmpeg",
|
||||
tostring(audio_preload_err or (audio_preload_output and audio_preload_output.stderr or ""))
|
||||
)
|
||||
elseif
|
||||
audio_preload_output
|
||||
and type(audio_preload_output.stderr) == "string"
|
||||
and audio_preload_output.stderr:find("does not contain any stream")
|
||||
then
|
||||
ya.dbg("mediainfo", audio_preload_output and audio_preload_output.stderr)
|
||||
cache_img_url_cha, _ = fs.cha(cache_img_url)
|
||||
if cache_img_url_cha then
|
||||
fs.remove("file", Url(cache_img_url))
|
||||
end
|
||||
-- NOTE: Workaround case audio has no cover image. Prevent regenerate preview image
|
||||
audio_preload_output, audio_preload_err = require("magick")
|
||||
.with_limit()
|
||||
:arg({
|
||||
"-size",
|
||||
"1x1",
|
||||
"canvas:none",
|
||||
string.format("PNG32:%s", cache_img_url),
|
||||
})
|
||||
:output()
|
||||
if
|
||||
(audio_preload_output and audio_preload_output.stderr ~= nil and audio_preload_output.stderr ~= "")
|
||||
or audio_preload_err
|
||||
then
|
||||
ya.dbg("mediainfo", audio_preload_err or (audio_preload_output and audio_preload_output.stderr))
|
||||
err_msg = err_msg
|
||||
.. string.format(
|
||||
"Failed to start `%s`.\n Error: %s\n",
|
||||
"magick",
|
||||
tostring(audio_preload_err or (audio_preload_output and audio_preload_output.stderr or ""))
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- NOTE: Get mediainfo and save to cache folder
|
||||
local cache_mediainfo_url = Url(tostring(ya.file_cache({ file = job.file, skip = 0 })) .. const.suffix)
|
||||
local cache_mediainfo_cha = fs.cha(cache_mediainfo_url)
|
||||
-- Case peek function called preload to refetch mediainfo
|
||||
if cache_mediainfo_cha and not job.args.force_reload_mediainfo then
|
||||
return true, err_msg ~= "" and ("Error: " .. err_msg) or nil
|
||||
end
|
||||
|
||||
local output, err
|
||||
if is_valid_utf8_path then
|
||||
output, err = Command(cmd)
|
||||
:arg({ tostring(job.file.path or job.file.cache or job.file.url.path or job.file.url) })
|
||||
:output()
|
||||
else
|
||||
cmd = "cd "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url.path or job.file.url).parent))
|
||||
.. " && "
|
||||
.. cmd
|
||||
.. " "
|
||||
.. utils.path_quote(tostring((job.file.path or job.file.cache or job.file.url).name))
|
||||
output, err = Command(const.SHELL):arg({ "-c", cmd }):output()
|
||||
end
|
||||
if err then
|
||||
ya.dbg("mediainfo", tostring(err))
|
||||
err_msg = err_msg .. string.format("Failed to start `%s`. \n Do you have `%s` installed?\n", cmd, cmd)
|
||||
end
|
||||
|
||||
return fs.write(
|
||||
cache_mediainfo_url,
|
||||
(err_msg ~= "" and ("Error: " .. err_msg) or "") .. (output and output.stdout or "")
|
||||
)
|
||||
end
|
||||
|
||||
return M
|
||||