diff options
author | awy <awy@awy.one> | 2025-09-14 19:06:01 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-09-14 19:06:01 +0300 |
commit | 0f82b66de5668deacc7a29aeb12399d98213ce29 (patch) | |
tree | 8917ddb7ead7ab638e97efe3e1d619318cd095f4 /.config/yazi | |
parent | ec7330d8212b4881e86d5e06f17d5dfd0633b922 (diff) | |
download | hyprdots-0f82b66de5668deacc7a29aeb12399d98213ce29.tar.gz |
yazieverforest
Diffstat (limited to '.config/yazi')
-rw-r--r-- | .config/yazi/flavors/gruvbox-dark.yazi/flavor.toml | 176 | ||||
-rw-r--r-- | .config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml | 1509 | ||||
-rw-r--r-- | .config/yazi/init.lua | 1 | ||||
-rw-r--r-- | .config/yazi/plugins/git.yazi/main.lua | 261 | ||||
-rw-r--r-- | .config/yazi/theme.toml | 2 | ||||
-rw-r--r-- | .config/yazi/yazi.toml | 10 |
6 files changed, 1959 insertions, 0 deletions
diff --git a/.config/yazi/flavors/gruvbox-dark.yazi/flavor.toml b/.config/yazi/flavors/gruvbox-dark.yazi/flavor.toml new file mode 100644 index 0000000..b2eb7cf --- /dev/null +++ b/.config/yazi/flavors/gruvbox-dark.yazi/flavor.toml @@ -0,0 +1,176 @@ +# vim:fileencoding=utf-8:foldmethod=marker + +# : Manager {{{ + +[manager] +cwd = { fg = "#83a598" } + +# Hovered +hovered = { reversed = true, bold = true } +# hovered = { bg = "#3c3836", bold = true } +preview_hovered = { underline = true } + +# Find +find_keyword = { fg = "#b8bb26", italic = true } +find_position = { fg = "#fe8019", bg = "reset", 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" } + +# Tab +tab_active = { fg = "#282828", bg = "#a89984" } +tab_inactive = { fg = "#a89984", bg = "#504945" } +tab_width = 1 + +# 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" } + +# : }}} + +# : Mode {{{ + +[mode] +normal_main = { fg = "#282828", bg = "#a89984", bold = true } +normal_alt = { fg = "#a89984", bg = "#504945" } +select_main = { fg = "#282828", bg = "#fe8019", bold = true } +select_alt = { fg = "#a89984", bg = "#504945" } +unset_main = { fg = "#282828", bg = "#b8bb26", bold = true } +unset_alt = { fg = "#a89984", bg = "#504945" } + +# : }}} + +# : Status {{{ + +[status] +sep_left = { open = "\ue0be", close = "\ue0b8" } +sep_right = { open = "\ue0be", close = "\ue0b8" } +overall = { } + +# Progress +progress_label = { fg = "#ebdbb2", bold = true } +progress_normal = { fg = "#504945", bg = "#3c3836" } +progress_error = { fg = "#fb4934", bg = "#3c3836" } + +# Permissions +perm_type = { fg = "#504945" } +perm_read = { fg = "#b8bb26" } +perm_write = { fg = "#fb4934" } +perm_exec = { fg = "#b8bb26" } +perm_sep = { fg = "#665c54" } + +# : }}} + +# : Select {{{ + +[pick] +border = { fg = "#458588" } +active = { fg = "#d3869b", bold = true } +inactive = {} + +# : }}} + +# : Input {{{ + +[input] +border = { fg = "#ebdbb2" } +title = {} +value = {} +selected = { reversed = true } + +# : }}} + +# : Tasks {{{ + +[tasks] +border = { fg = "#504945" } +title = {} +hovered = { underline = true } + +# : }}} + +# : Which {{{ + +[which] +mask = { bg = "#3c3836" } +cand = { fg = "#83a598" } +rest = { fg = "#928374" } +desc = { fg = "#fe8019" } +separator = " " +separator_style = { fg = "#504945" } + +# : }}} + +# : Help {{{ + +[help] +on = { fg = "#83a598" } +run = { fg = "#d3869b" } +hovered = { reversed = true, bold = true } +footer = { fg = "#3c3836", bg = "#a89984" } + +# : }}} + +# : Notify {{{ + +[notify] +title_info = { fg = "#8ec07c" } +title_warn = { fg = "#fbf1c7" } +title_error = { fg = "#d3869b" } + +# : }}} + +# : 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 + { name = "*", fg = "#ebdbb2" }, + { name = "*/", fg = "#83a598" }, +] + +# : }}} + +# : Confirmation {{{ + +[confirm] +border = { fg = "#a89984" } +title = { fg = "#83a598" } +content = { fg = "#fbf1c7" } +body = { fg = "red" } +list = { fg = "#ebdbb2" } +btn_yes = { reversed = true, fg = "#ebdbb2" } +btn_no = {} +btn_labels = [ " [Y]es ", " (N)o " ] + +# : }}} + +# : Completion {{{ + +[cmp] +border = { fg = "#a89984" } +active = { reversed = true, fg = "#83a598" } +inactive = { fg = "#ebdbb2" } + +# : }}} diff --git a/.config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml b/.config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml new file mode 100644 index 0000000..59c1ecd --- /dev/null +++ b/.config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml @@ -0,0 +1,1509 @@ +<?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>comment</key> + <string>Based on gruvbox for Vim (https://github.com/morhetz/gruvbox)</string> + <key>originalAuthor</key> + <string>Pavel Pertsev (https://github.com/morhetz)</string> + <key>author</key> + <string>Brian Reilly (https://github.com/Briles/gruvbox)</string> + <key>name</key> + <string>gruvbox (Dark) (Medium)</string> + <key>colorSpaceName</key> + <string>sRGB</string> + <key>settings</key> + <array> + <dict> + <key>settings</key> + <dict> + <key>background</key> + <string>#222222</string> + <key>caret</key> + <string>#a89984</string> + <key>foreground</key> + <string>#ebdbb280</string> + <key>invisibles</key> + <string>#ebdbb226</string> + <key>lineHighlight</key> + <string>#3c3836</string> + <key>selection</key> + <string>#3c3836</string> + <key>inactiveSelection</key> + <string>#3c3836</string> + <key>guide</key> + <string>#ebdbb226</string> + <key>activeGuide</key> + <string>#ebdbb280</string> + <key>stackGuide</key> + <string>#ebdbb240</string> + <key>bracketContentsOptions</key> + <string>underline</string> + <key>bracketContentsForeground</key> + <string>#bdae93</string> + <key>bracketsOptions</key> + <string>underline</string> + <key>bracketsForeground</key> + <string>#bdae93</string> + <key>gutterForeground</key> + <string>#928374</string> + <key>highlight</key> + <string>#fbf1c7</string> + <key>highlightForeground</key> + <string>#fbf1c7</string> + <key>findHighlight</key> + <string>#d79921</string> + <key>findHighlightForeground</key> + <string>#222222</string> + <key>tagsOptions</key> + <string>underline</string> + <key>selectionBorder</key> + <string>#3c3836</string> + <key>popupCss</key> + <string> + html { + background-color: #1b1b1b; + color: #fbf1c7; + padding: 12px; + } + + a { + color: #8ec07c; + } + + .error, .deleted { + color: #fb4934; + } + + .success, .inserted, .name { + color: #b8bb26; + } + + .warning, .modified { + color: #fabd2f; + } + + .type { + color: #fabd2f; + font-style: italic; + } + + .param { + color: #fbf1c7; + } + + .current { + text-decoration: underline; + } + </string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Text and Source Base Colors</string> + <key>scope</key> + <string>meta.group, meta.method-call.source.cs, meta.method.attribute.source.cs, meta.method.body.java, meta.method.body.source.cs, meta.method.source.cs, none, source, text</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Punctuation</string> + <key>scope</key> + <string>entity.quasi.element meta.group.braces, keyword.operator keyword.operator.neon, keyword.operator operator.neon, keyword.operator.accessor, keyword.other.accessor, meta.attribute-selector keyword.operator.stylus, meta.brace, meta.delimiter, meta.group.braces, meta.punctuation.separator, meta.separator, punctuation</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Comments</string> + <key>scope</key> + <string>comment, comment text, markup.strikethrough, punctuation.definition.comment, punctuation.whitespace.comment, string.comment, text.cancelled</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Keywords Inside Comments</string> + <key>scope</key> + <string>comment.keyword, comment.keyword.punctuation</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d5c4a1</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>DocBlockr & Other Keywords Inside Comments</string> + <key>scope</key> + <string>comment.parameter, comment.punctuation, comment.string, comment.type, keyword.other.phpdoc.php, punctuation.definition.keyword.javadoc, source.groovy keyword.other.documentation, source.java keyword.other.documentation, storage.type.annotation.coffeescript, storage.type.class.jsdoc</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Entity</string> + <key>scope</key> + <string>constant.language.name, entity.name.type, entity.other.inherited-class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Template String Punctuation</string> + <key>scope</key> + <string>constant.other.placeholder, entity.name.tag.mustache, entity.tag.tagbraces, punctuation.definition.string.template, punctuation.definition.template-expression, punctuation.quasi, punctuation.section.embedded, string.interpolated, variable.other.interpolation.scss</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Keywords</string> + <key>scope</key> + <string>js.embedded.control.flow keyword.operator.js, keyword, keyword.control, keyword.operator.logical.python, meta.at-rule.media support.function.misc, meta.prolog.haml, meta.tag.sgml.doctype.html, storage.type.function.jade, storage.type.function.pug, storage.type.import.haxe, storage.type.import.include.jade, storage.type.import.include.pug, support.keyword.timing-direction, variable.documentroot</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS At-Rule Punctuation (@) & At-Rule Vendor Prefixes</string> + <key>scope</key> + <string>keyword.control.at-rule support.type.property-vendor, punctuation.definition.keyword</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#cc241d</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Operators</string> + <key>scope</key> + <string>keyword.control.new, keyword.control.operator, keyword.operator, keyword.other.arrow, keyword.other.double-colon, punctuation.operator</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Constants Punctuation</string> + <key>scope</key> + <string>constant.other.color punctuation.definition.constant, constant.other.symbol punctuation.definition.constant, constant.other.unit, keyword.other.unit, punctuation.section.flowtype, support.constant.unicode-range.prefix</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Storage</string> + <key>scope</key> + <string>storage, storage.type.annotation, storage.type.primitive</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>storage.modifier.import, storage.modifier.package, storage.type.import, variable.import, variable.package</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function Keyword</string> + <key>scope</key> + <string>entity.quasi.tag.name, meta.function storage.type.matlab, storage.type.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Variables</string> + <key>scope</key> + <string>entity.name.val.declaration, entity.name.variable, meta.definition.variable, storage.type.variable, support.type.custom-property, support.type.variable-name, variable, variable.interpolation variable, variable.other.interpolation variable, variable.parameter.dosbatch, variable.parameter.output.function.matlab, variable.parameter.sass</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Variable - Punctuation</string> + <key>scope</key> + <string>keyword.other.custom-property.prefix, punctuation.definition.custom-property, punctuation.definition.variable, support.constant.custom-property-name.prefix, variable.interpolation, variable.other.dollar punctuation.dollar, variable.other.object.dollar punctuation.dollar</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#458588</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function Declaration - Punctuation</string> + <key>scope</key> + <string>entity.name.function punctuation.dollar</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#98971a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Object Properties</string> + <key>scope</key> + <string>meta.property.object</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Object Literal Properties</string> + <key>scope</key> + <string>constant.other.object.key string, meta.object-literal.key</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Parameters</string> + <key>scope</key> + <string>meta.parameters, variable.parameter</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>SASS Import URL</string> + <key>scope</key> + <string>variable.parameter.url</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Language Constants</string> + <key>scope</key> + <string>constant, constant.numeric, constant.other, constant.other.color, constant.other.symbol, support.constant, support.constant.color, support.constant.font-name, support.constant.media, support.constant.prototype, variable.language</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Language Constants Punctuation</string> + <key>scope</key> + <string>variable.language punctuation.definition.variable</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>User-Defined Constants</string> + <key>scope</key> + <string>entity.name.constant, variable.other.constant</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Escaped Characters</string> + <key>scope</key> + <string>constant.character.escape, constant.character.escaped, constant.character.quoted, constant.other.character-class.escape</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Invalids and Illegals</string> + <key>scope</key> + <string>invalid</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + <key>background</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Inner Scopes of Invalids and Illegals</string> + <key>scope</key> + <string>invalid keyword.other.custom-property.prefix, invalid support.type.custom-property.name</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Errors</string> + <key>scope</key> + <string>message.error</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Strings</string> + <key>scope</key> + <string>meta.object-literal.key string, string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON Keys</string> + <key>scope</key> + <string>meta.structure.dictionary.key.json string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Text</string> + <key>scope</key> + <string>source.regexp, string.regexp</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Start & End Punctuation</string> + <key>scope</key> + <string>string.regexp punctuation.definition.string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Character Class Punctuation ([])</string> + <key>scope</key> + <string>keyword.control.set.regexp, punctuation.definition.character-class, string.regexp.character-class.ruby</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Capturing Group</string> + <key>scope</key> + <string>string.regexp.group</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Assertions</string> + <key>scope</key> + <string>constant.other.assertion.regexp, punctuation.definition.group.assertion.regexp, punctuation.definition.group.capture.regexp</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Character Class</string> + <key>scope</key> + <string>constant.other.character-class.escape.backslash.regexp, keyword.control.character-class.regexp, string.regexp.character-class constant.character.escape</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions Quantifiers & Operators</string> + <key>scope</key> + <string>string.regexp.arbitrary-repetition, string.regexp.arbitrary-repetition punctuation</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Hyperlinks</string> + <key>scope</key> + <string>constant.other.reference.link, string.other.link</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Hyperlink Punctuation</string> + <key>scope</key> + <string>meta.image.inline punctuation.definition.string, meta.link.inline punctuation.definition.string, meta.link.reference punctuation.definition.constant, meta.link.reference.literal punctuation.definition.constant, meta.link.reference.literal punctuation.definition.string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#689d6a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markup Tag Punctuation</string> + <key>scope</key> + <string>punctuation.definition.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Heading</string> + <key>scope</key> + <string>markup.heading</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Heading Punctuation</string> + <key>scope</key> + <string>punctuation.definition.heading, punctuation.definition.identity</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#98971a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Bold Text</string> + <key>scope</key> + <string>markup.bold</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fe8019</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Bold Text Punctuation</string> + <key>scope</key> + <string>punctuation.definition.bold</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d65d0e</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Italic Text</string> + <key>scope</key> + <string>markup.italic</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + <key>fontStyle</key> + <string>italic</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Italic Text Punctuation</string> + <key>scope</key> + <string>punctuation.definition.italic</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#cc241d</string> + <key>fontStyle</key> + <string>italic</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Inline Code</string> + <key>scope</key> + <string>markup.raw.inline</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Inline Code Punctuation</string> + <key>scope</key> + <string>markup.raw.inline punctuation.definition.raw</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Quoted</string> + <key>scope</key> + <string>markup.quote</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Quoted Punctuation</string> + <key>scope</key> + <string>markup.quote punctuation.definition.blockquote</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown List</string> + <key>scope</key> + <string>markup.list</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown List Punctuation</string> + <key>scope</key> + <string>markup.list punctuation.definition.list_item</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#458588</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Separators</string> + <key>scope</key> + <string>meta.separator.markdown</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Support</string> + <key>scope</key> + <string>meta.function-call.constructor variable.type, support.class, support.type, variable.other.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Supporting Type - Dollar Punctuation</string> + <key>scope</key> + <string>support.class punctuation.dollar</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function Calls</string> + <key>scope</key> + <string>entity.name.function.jade, entity.name.function.pug, keyword.other.special-method, meta.function-call variable.function, meta.function-call variable.other.dollar.only punctuation.dollar, support.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Method Calls</string> + <key>scope</key> + <string>meta.function-call.method support.function, meta.function-call.method variable.function, meta.function-call.static variable.function, meta.method-call, meta.method-call support.function, meta.method-call variable.function, support.function.mutator</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#689d6a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Special Variables</string> + <key>scope</key> + <string>support.module</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Entities</string> + <key>scope</key> + <string>entity.name.accessor, entity.name.function, entity.name.label, entity.name.section</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Modules</string> + <key>scope</key> + <string>entity.name.module</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fe8019</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML & CSS ID</string> + <key>scope</key> + <string>constant.id.tag, entity.name.tag.id, entity.other.attribute-name.id</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fe8019</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML & CSS ID Punctuation (#)</string> + <key>scope</key> + <string>entity.other.attribute-name.id punctuation.definition.entity</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d65d0e</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML & CSS Class</string> + <key>scope</key> + <string>entity.name.tag.class, entity.other.attribute-name.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML & CSS Class Punctuation (.)</string> + <key>scope</key> + <string>entity.other.attribute-name.class punctuation.definition.entity</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Attribute Selector Attribute Name</string> + <key>scope</key> + <string>meta.attribute-selector entity.other.attribute-name</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML & XML Entity Punctuation</string> + <key>scope</key> + <string>constant.character.entity punctuation.definition.constant, constant.character.entity punctuation.definition.entity</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>entity.name.class, entity.name.type.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markup Tag</string> + <key>scope</key> + <string>entity.name.function.neon, entity.name.namespace.wildcard, entity.name.tag, entity.tag, keyword.control.untitled, keyword.doctype.xml, keyword.operator support.other.neon, punctuation.definition.prolog.haml, source.less keyword.control.html.elements</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HTML Attribute Names</string> + <key>scope</key> + <string>entity.name.attribute-name, entity.other.attribute-name, meta.section.attributes.haml constant.other.symbol.ruby</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Pseudo Elements/Classes & Vendor Prefixes</string> + <key>scope</key> + <string>entity.other.attribute-name.placeholder punctuation.definition.entity, entity.other.attribute-name.pseudo-class, entity.other.attribute-name.pseudo-element, entity.other.attribute-name.tag.pseudo-class, entity.other.attribute-name.tag.pseudo-element, entity.other.pseudo-class, entity.other.pseudo-element, support.type.vendor-prefix</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Animations / Keyframes</string> + <key>scope</key> + <string>entity.function-name.stylus, entity.other.animation-keyframe.stylus, entity.other.animation-name, keyword.language.function.misc.stylus, meta.at-rule.keyframes entity.name.function, variable.other.animation-name</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Author-Defined Names</string> + <key>scope</key> + <string>entity.other.namespace-prefix</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>meta.class.body, meta.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Image & Hyperlink</string> + <key>scope</key> + <string>meta.image, meta.link</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Markdown Image & Hyperlink Punctuation</string> + <key>scope</key> + <string>meta.image punctuation.definition.metadata, meta.link punctuation.definition.metadata</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>meta.require</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function Call Braces</string> + <key>scope</key> + <string>constant.name.attribute.tag.jade, constant.name.attribute.tag.pug, meta.brace.round, meta.function-call meta.group punctuation.definition.group, punctuation.definition.method-parameters, punctuation.definition.parameters</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Property Names</string> + <key>scope</key> + <string>meta.property-name, support.type.property-name, support.type.shape.definition support.constant.property-value</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Property Name Vendor Prefixes</string> + <key>scope</key> + <string>meta.property-name support.type.vendor-prefix, support.type.property-name.media support.type.vendor-prefix</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#98971a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Property Values</string> + <key>scope</key> + <string>constant.string.sass, meta.property-value, support.constant.property-value</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>CSS Property Value Vendor Prefixes</string> + <key>scope</key> + <string>meta.property-value support.type.vendor-prefix</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Foreground Text</string> + <key>scope</key> + <string>source.diff</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#a89984</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Header Text From</string> + <key>scope</key> + <string>meta.diff.header.from-file</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Header Text From Punctuation</string> + <key>scope</key> + <string>punctuation.definition.from-file</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#458588</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Header Text To</string> + <key>scope</key> + <string>meta.diff.header.to-file</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Header Text To Punctuation</string> + <key>scope</key> + <string>punctuation.definition.to-file</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b16286</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Additions & Deletions Stats</string> + <key>scope</key> + <string>meta.diff.range, meta.toc-list.line-number</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Diff Additions & Deletions Stats Punctuation</string> + <key>scope</key> + <string>punctuation.definition.range.diff</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d79921</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>FiF Line Number</string> + <key>scope</key> + <string>constant.numeric.line-number</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>FiF Line Number Matched</string> + <key>scope</key> + <string>constant.numeric.line-number.match</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>FiF Filename</string> + <key>scope</key> + <string>entity.name.filename</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>GitGutter & Diff Deleted</string> + <key>scope</key> + <string>markup.deleted, punctuation.definition.deleted</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>GitGutter & Diff Inserted</string> + <key>scope</key> + <string>markup.inserted, punctuation.definition.inserted</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>GitGutter & Diff Changed</string> + <key>scope</key> + <string>markup.changed, punctuation.definition.changed</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>GitGutter ignored</string> + <key>scope</key> + <string>markup.ignored</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>GitGutter untracked</string> + <key>scope</key> + <string>markup.untracked</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Tag</string> + <key>scope</key> + <string>brackethighlighter.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Curly</string> + <key>scope</key> + <string>brackethighlighter.curly</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Round</string> + <key>scope</key> + <string>brackethighlighter.round</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Square</string> + <key>scope</key> + <string>brackethighlighter.square</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Angle</string> + <key>scope</key> + <string>brackethighlighter.angle</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Quote</string> + <key>scope</key> + <string>brackethighlighter.quote</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Bracket Unmatched</string> + <key>scope</key> + <string>brackethighlighter.unmatched</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>SublimeLinter Error</string> + <key>scope</key> + <string>sublimelinter.mark.error</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>SublimeLinter Gutter Mark</string> + <key>scope</key> + <string>sublimelinter.gutter-mark</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>SublimeLinter Warning</string> + <key>scope</key> + <string>sublimelinter.mark.warning</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HexViewer Upper Byte Nibble</string> + <key>scope</key> + <string>raw.nibble.upper</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HexViewer Lower Byte Nibble</string> + <key>scope</key> + <string>raw.nibble.lower</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HexViewer Highlight</string> + <key>scope</key> + <string>hexviewer.highlight</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#222222</string> + <key>background</key> + <string>#fabd2f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>HexViewer Edited Highlight</string> + <key>scope</key> + <string>hexviewer.highlight.edited</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#222222</string> + <key>background</key> + <string>#fe8019</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Raw New Line: Carriage Return</string> + <key>scope</key> + <string>glyph.carriage-return</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ebdbb226</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Raw New Line: New Line Glyph</string> + <key>scope</key> + <string>glyph.new-line</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ebdbb226</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Header</string> + <key>scope</key> + <string>keyword.control.header.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b8bb26</string> + <key>background</key> + <string>#3a3a3a</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Notes</string> + <key>scope</key> + <string>notes.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#bdae93</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Punctuation</string> + <key>scope</key> + <string>text.todo punctuation.definition.bold, text.todo punctuation.definition.italic</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#7c6f64</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Task Pending</string> + <key>scope</key> + <string>meta.item.todo.pending</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fbf1c7</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Task Pending Punctuation</string> + <key>scope</key> + <string>punctuation.definition.bullet.pending.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Task Completed Punctuation</string> + <key>scope</key> + <string>punctuation.definition.bullet.completed.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#8ec07c</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Task Cancelled Punctuation</string> + <key>scope</key> + <string>punctuation.definition.bullet.cancelled.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Tag Critical</string> + <key>scope</key> + <string>string.other.tag.todo.critical</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fb4934</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Tag High</string> + <key>scope</key> + <string>string.other.tag.todo.high</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fe8019</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Tag Low</string> + <key>scope</key> + <string>string.other.tag.todo.low</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Tag Today</string> + <key>scope</key> + <string>string.other.tag.todo.today</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#fabd2f</string> + <key>fontStyle</key> + <string>bold</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Tag</string> + <key>scope</key> + <string>meta.tag.todo</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d3869b</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: URL</string> + <key>scope</key> + <string>punctuation.definition.url, todo.url</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#83a598</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>PlainTasks: Separator</string> + <key>scope</key> + <string>meta.punctuation.archive.todo, meta.punctuation.separator.todo</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#928374</string> + </dict> + </dict> + </array> + </dict> +</plist> diff --git a/.config/yazi/init.lua b/.config/yazi/init.lua index dd1e113..9775faf 100644 --- a/.config/yazi/init.lua +++ b/.config/yazi/init.lua @@ -1,3 +1,4 @@ require("session"):setup { sync_yanked = true, } +require("git"):setup() diff --git a/.config/yazi/plugins/git.yazi/main.lua b/.config/yazi/plugins/git.yazi/main.lua new file mode 100644 index 0000000..e6b3a36 --- /dev/null +++ b/.config/yazi/plugins/git.yazi/main.lua @@ -0,0 +1,261 @@ +--- @since 25.5.31 + +local WINDOWS = ya.target_family() == "windows" + +-- The code of supported git status, +-- also used to determine which status to show for directories when they contain different statuses +-- see `bubble_up` +---@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 + -- TODO: remove this + if ui.render then + ui.render() + else + ya.render() + end +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 + + -- TODO: remove this + if ui.render then + ui.render() + else + ya.render() + end + 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) + local url = self._file.url + local repo = st.dirs[tostring(url.base)] + local code + if repo then + code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)] + end + + if not code or signs[code] == "" then + return "" + elseif self._file.is_hovered then + return ui.Line { " ", signs[code] } + else + return ui.Line { " ", ui.Span(signs[code]):style(styles[code]) } + end + end, opts.order) +end + +---@type UnstableFetcher +local function fetch(_, job) + local cwd = job.files[1].url.base + local repo = root(cwd) + if not repo then + remove(tostring(cwd)) + return true + end + + local paths = {} + for _, file in ipairs(job.files) do + paths[#paths + 1] = tostring(file.url) + end + + -- stylua: ignore + local output, err = Command("git") + :cwd(tostring(cwd)) + :arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) + :arg(paths) + :stdout(Command.PIPED) + :output() + if not output then + return true, Err("Cannot spawn `git` command, error: %s", err) + end + + local changed, excluded = {}, {} + for line in output.stdout:gmatch("[^\r\n]+") do + local code, path = match(line) + if code == CODES.excluded then + excluded[#excluded + 1] = path + else + changed[path] = code + end + end + + if job.files[1].cha.is_dir then + ya.dict_merge(changed, bubble_up(changed)) + end + ya.dict_merge(changed, propagate_down(excluded, cwd, Url(repo))) + + -- Reset the status of any files that don't appear in the output of `git status` to `unknown`, + -- so that cleaning up outdated statuses from `st.repos` + for _, path in ipairs(paths) do + local s = path:sub(#repo + 2) + changed[s] = changed[s] or CODES.unknown + end + + add(tostring(cwd), repo, changed) + + return false +end + +return { setup = setup, fetch = fetch } diff --git a/.config/yazi/theme.toml b/.config/yazi/theme.toml new file mode 100644 index 0000000..617f48e --- /dev/null +++ b/.config/yazi/theme.toml @@ -0,0 +1,2 @@ +[flavor] +dark = "gruvbox-dark" diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index 7f1fde1..7137bf8 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -1,2 +1,12 @@ [mgr] show_hidden = true + +[[plugin.prepend_fetchers]] +id = "git" +name = "*" +run = "git" + +[[plugin.prepend_fetchers]] +id = "git" +name = "*/" +run = "git" |