From 0f82b66de5668deacc7a29aeb12399d98213ce29 Mon Sep 17 00:00:00 2001 From: awy Date: Sun, 14 Sep 2025 19:06:01 +0300 Subject: yazi --- .config/yazi/flavors/gruvbox-dark.yazi/flavor.toml | 176 +++ .config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml | 1509 ++++++++++++++++++++ .config/yazi/init.lua | 1 + .config/yazi/plugins/git.yazi/main.lua | 261 ++++ .config/yazi/theme.toml | 2 + .config/yazi/yazi.toml | 10 + 6 files changed, 1959 insertions(+) create mode 100644 .config/yazi/flavors/gruvbox-dark.yazi/flavor.toml create mode 100644 .config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml create mode 100644 .config/yazi/plugins/git.yazi/main.lua create mode 100644 .config/yazi/theme.toml 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 @@ + + + + + comment + Based on gruvbox for Vim (https://github.com/morhetz/gruvbox) + originalAuthor + Pavel Pertsev (https://github.com/morhetz) + author + Brian Reilly (https://github.com/Briles/gruvbox) + name + gruvbox (Dark) (Medium) + colorSpaceName + sRGB + settings + + + settings + + background + #222222 + caret + #a89984 + foreground + #ebdbb280 + invisibles + #ebdbb226 + lineHighlight + #3c3836 + selection + #3c3836 + inactiveSelection + #3c3836 + guide + #ebdbb226 + activeGuide + #ebdbb280 + stackGuide + #ebdbb240 + bracketContentsOptions + underline + bracketContentsForeground + #bdae93 + bracketsOptions + underline + bracketsForeground + #bdae93 + gutterForeground + #928374 + highlight + #fbf1c7 + highlightForeground + #fbf1c7 + findHighlight + #d79921 + findHighlightForeground + #222222 + tagsOptions + underline + selectionBorder + #3c3836 + popupCss + + 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; + } + + + + + name + Text and Source Base Colors + scope + 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 + settings + + foreground + #fbf1c7 + + + + name + Punctuation + scope + 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 + settings + + foreground + #fbf1c7 + + + + name + Comments + scope + comment, comment text, markup.strikethrough, punctuation.definition.comment, punctuation.whitespace.comment, string.comment, text.cancelled + settings + + fontStyle + italic + foreground + #928374 + + + + name + Keywords Inside Comments + scope + comment.keyword, comment.keyword.punctuation + settings + + foreground + #d5c4a1 + + + + name + DocBlockr & Other Keywords Inside Comments + scope + 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 + settings + + foreground + #bdae93 + + + + name + Entity + scope + constant.language.name, entity.name.type, entity.other.inherited-class + settings + + foreground + #fabd2f + + + + name + Template String Punctuation + scope + 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 + settings + + foreground + #8ec07c + + + + name + Keywords + scope + 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 + settings + + foreground + #fb4934 + + + + name + CSS At-Rule Punctuation (@) & At-Rule Vendor Prefixes + scope + keyword.control.at-rule support.type.property-vendor, punctuation.definition.keyword + settings + + foreground + #cc241d + + + + name + Operators + scope + keyword.control.new, keyword.control.operator, keyword.operator, keyword.other.arrow, keyword.other.double-colon, punctuation.operator + settings + + foreground + #8ec07c + + + + name + Constants Punctuation + scope + 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 + settings + + foreground + #b16286 + + + + name + Storage + scope + storage, storage.type.annotation, storage.type.primitive + settings + + foreground + #fb4934 + + + + scope + storage.modifier.import, storage.modifier.package, storage.type.import, variable.import, variable.package + settings + + foreground + #fbf1c7 + + + + name + Function Keyword + scope + entity.quasi.tag.name, meta.function storage.type.matlab, storage.type.function + settings + + foreground + #8ec07c + + + + name + Variables + scope + 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 + settings + + foreground + #83a598 + + + + name + Variable - Punctuation + scope + 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 + settings + + foreground + #458588 + + + + name + Function Declaration - Punctuation + scope + entity.name.function punctuation.dollar + settings + + foreground + #98971a + + + + name + Object Properties + scope + meta.property.object + settings + + foreground + #fbf1c7 + + + + name + Object Literal Properties + scope + constant.other.object.key string, meta.object-literal.key + settings + + foreground + #fbf1c7 + + + + name + Parameters + scope + meta.parameters, variable.parameter + settings + + foreground + #fbf1c7 + + + + name + SASS Import URL + scope + variable.parameter.url + settings + + foreground + #b8bb26 + + + + name + Language Constants + scope + 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 + settings + + foreground + #d3869b + + + + name + Language Constants Punctuation + scope + variable.language punctuation.definition.variable + settings + + foreground + #b16286 + + + + name + User-Defined Constants + scope + entity.name.constant, variable.other.constant + settings + + foreground + #fabd2f + + + + name + Escaped Characters + scope + constant.character.escape, constant.character.escaped, constant.character.quoted, constant.other.character-class.escape + settings + + foreground + #fb4934 + + + + name + Invalids and Illegals + scope + invalid + settings + + foreground + #fbf1c7 + background + #fb4934 + + + + name + Inner Scopes of Invalids and Illegals + scope + invalid keyword.other.custom-property.prefix, invalid support.type.custom-property.name + settings + + foreground + #fbf1c7 + + + + name + Errors + scope + message.error + settings + + foreground + #fb4934 + + + + name + Strings + scope + meta.object-literal.key string, string + settings + + foreground + #b8bb26 + + + + name + JSON Keys + scope + meta.structure.dictionary.key.json string + settings + + foreground + #83a598 + + + + name + Regular Expressions Text + scope + source.regexp, string.regexp + settings + + foreground + #b8bb26 + + + + name + Regular Expressions Start & End Punctuation + scope + string.regexp punctuation.definition.string + settings + + foreground + #bdae93 + + + + name + Regular Expressions Character Class Punctuation ([]) + scope + keyword.control.set.regexp, punctuation.definition.character-class, string.regexp.character-class.ruby + settings + + foreground + #d3869b + + + + name + Regular Expressions Capturing Group + scope + string.regexp.group + settings + + foreground + #fbf1c7 + + + + name + Regular Expressions Assertions + scope + constant.other.assertion.regexp, punctuation.definition.group.assertion.regexp, punctuation.definition.group.capture.regexp + settings + + foreground + #83a598 + + + + name + Regular Expressions Character Class + scope + constant.other.character-class.escape.backslash.regexp, keyword.control.character-class.regexp, string.regexp.character-class constant.character.escape + settings + + foreground + #fabd2f + + + + name + Regular Expressions Quantifiers & Operators + scope + string.regexp.arbitrary-repetition, string.regexp.arbitrary-repetition punctuation + settings + + foreground + #8ec07c + + + + name + Hyperlinks + scope + constant.other.reference.link, string.other.link + settings + + foreground + #8ec07c + + + + name + Hyperlink Punctuation + scope + 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 + settings + + foreground + #689d6a + + + + name + Markup Tag Punctuation + scope + punctuation.definition.tag + settings + + foreground + #83a598 + + + + name + Markdown Heading + scope + markup.heading + settings + + foreground + #b8bb26 + + + + name + Markdown Heading Punctuation + scope + punctuation.definition.heading, punctuation.definition.identity + settings + + foreground + #98971a + + + + name + Markdown Bold Text + scope + markup.bold + settings + + foreground + #fe8019 + fontStyle + bold + + + + name + Markdown Bold Text Punctuation + scope + punctuation.definition.bold + settings + + foreground + #d65d0e + fontStyle + bold + + + + name + Markdown Italic Text + scope + markup.italic + settings + + foreground + #fb4934 + fontStyle + italic + + + + name + Markdown Italic Text Punctuation + scope + punctuation.definition.italic + settings + + foreground + #cc241d + fontStyle + italic + + + + name + Markdown Inline Code + scope + markup.raw.inline + settings + + foreground + #fabd2f + + + + name + Markdown Inline Code Punctuation + scope + markup.raw.inline punctuation.definition.raw + settings + + foreground + #d79921 + + + + name + Markdown Quoted + scope + markup.quote + settings + + foreground + #d3869b + + + + name + Markdown Quoted Punctuation + scope + markup.quote punctuation.definition.blockquote + settings + + foreground + #b16286 + + + + name + Markdown List + scope + markup.list + settings + + foreground + #83a598 + + + + name + Markdown List Punctuation + scope + markup.list punctuation.definition.list_item + settings + + foreground + #458588 + + + + name + Markdown Separators + scope + meta.separator.markdown + settings + + foreground + #928374 + + + + name + Support + scope + meta.function-call.constructor variable.type, support.class, support.type, variable.other.class + settings + + foreground + #fabd2f + + + + name + Supporting Type - Dollar Punctuation + scope + support.class punctuation.dollar + settings + + foreground + #d79921 + + + + name + Function Calls + scope + 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 + settings + + foreground + #8ec07c + + + + name + Method Calls + scope + 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 + settings + + foreground + #689d6a + + + + name + Special Variables + scope + support.module + settings + + foreground + #d3869b + + + + name + Entities + scope + entity.name.accessor, entity.name.function, entity.name.label, entity.name.section + settings + + foreground + #b8bb26 + + + + name + Modules + scope + entity.name.module + settings + + foreground + #fe8019 + + + + name + HTML & CSS ID + scope + constant.id.tag, entity.name.tag.id, entity.other.attribute-name.id + settings + + foreground + #fe8019 + + + + name + HTML & CSS ID Punctuation (#) + scope + entity.other.attribute-name.id punctuation.definition.entity + settings + + foreground + #d65d0e + + + + name + HTML & CSS Class + scope + entity.name.tag.class, entity.other.attribute-name.class + settings + + foreground + #fabd2f + + + + name + HTML & CSS Class Punctuation (.) + scope + entity.other.attribute-name.class punctuation.definition.entity + settings + + foreground + #d79921 + + + + name + CSS Attribute Selector Attribute Name + scope + meta.attribute-selector entity.other.attribute-name + settings + + foreground + #d79921 + + + + name + HTML & XML Entity Punctuation + scope + constant.character.entity punctuation.definition.constant, constant.character.entity punctuation.definition.entity + settings + + foreground + #b16286 + + + + scope + entity.name.class, entity.name.type.class + settings + + foreground + #fabd2f + + + + name + Markup Tag + scope + 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 + settings + + foreground + #83a598 + + + + name + HTML Attribute Names + scope + entity.name.attribute-name, entity.other.attribute-name, meta.section.attributes.haml constant.other.symbol.ruby + settings + + foreground + #fabd2f + + + + name + CSS Pseudo Elements/Classes & Vendor Prefixes + scope + 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 + settings + + foreground + #d79921 + + + + name + CSS Animations / Keyframes + scope + 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 + settings + + foreground + #8ec07c + + + + name + Author-Defined Names + scope + entity.other.namespace-prefix + settings + + foreground + #8ec07c + + + + scope + meta.class.body, meta.tag + settings + + foreground + #fbf1c7 + + + + name + Markdown Image & Hyperlink + scope + meta.image, meta.link + settings + + foreground + #d3869b + + + + name + Markdown Image & Hyperlink Punctuation + scope + meta.image punctuation.definition.metadata, meta.link punctuation.definition.metadata + settings + + foreground + #b16286 + + + + scope + meta.require + settings + + foreground + #b8bb26 + + + + name + Function Call Braces + scope + 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 + settings + + foreground + #bdae93 + + + + name + CSS Property Names + scope + meta.property-name, support.type.property-name, support.type.shape.definition support.constant.property-value + settings + + foreground + #b8bb26 + + + + name + CSS Property Name Vendor Prefixes + scope + meta.property-name support.type.vendor-prefix, support.type.property-name.media support.type.vendor-prefix + settings + + foreground + #98971a + + + + name + CSS Property Values + scope + constant.string.sass, meta.property-value, support.constant.property-value + settings + + foreground + #fbf1c7 + + + + name + CSS Property Value Vendor Prefixes + scope + meta.property-value support.type.vendor-prefix + settings + + foreground + #bdae93 + + + + name + Diff Foreground Text + scope + source.diff + settings + + foreground + #a89984 + + + + name + Diff Header Text From + scope + meta.diff.header.from-file + settings + + foreground + #83a598 + + + + name + Diff Header Text From Punctuation + scope + punctuation.definition.from-file + settings + + foreground + #458588 + + + + name + Diff Header Text To + scope + meta.diff.header.to-file + settings + + foreground + #d3869b + + + + name + Diff Header Text To Punctuation + scope + punctuation.definition.to-file + settings + + foreground + #b16286 + + + + name + Diff Additions & Deletions Stats + scope + meta.diff.range, meta.toc-list.line-number + settings + + foreground + #fabd2f + + + + name + Diff Additions & Deletions Stats Punctuation + scope + punctuation.definition.range.diff + settings + + foreground + #d79921 + + + + name + FiF Line Number + scope + constant.numeric.line-number + settings + + foreground + #928374 + + + + name + FiF Line Number Matched + scope + constant.numeric.line-number.match + settings + + foreground + #8ec07c + + + + name + FiF Filename + scope + entity.name.filename + settings + + foreground + #b8bb26 + + + + name + GitGutter & Diff Deleted + scope + markup.deleted, punctuation.definition.deleted + settings + + foreground + #fb4934 + + + + name + GitGutter & Diff Inserted + scope + markup.inserted, punctuation.definition.inserted + settings + + foreground + #b8bb26 + + + + name + GitGutter & Diff Changed + scope + markup.changed, punctuation.definition.changed + settings + + foreground + #fabd2f + + + + name + GitGutter ignored + scope + markup.ignored + settings + + foreground + #928374 + + + + name + GitGutter untracked + scope + markup.untracked + settings + + foreground + #928374 + + + + name + Bracket Tag + scope + brackethighlighter.tag + settings + + foreground + #bdae93 + + + + name + Bracket Curly + scope + brackethighlighter.curly + settings + + foreground + #bdae93 + + + + name + Bracket Round + scope + brackethighlighter.round + settings + + foreground + #bdae93 + + + + name + Bracket Square + scope + brackethighlighter.square + settings + + foreground + #bdae93 + + + + name + Bracket Angle + scope + brackethighlighter.angle + settings + + foreground + #bdae93 + + + + name + Bracket Quote + scope + brackethighlighter.quote + settings + + foreground + #bdae93 + + + + name + Bracket Unmatched + scope + brackethighlighter.unmatched + settings + + foreground + #fb4934 + + + + name + SublimeLinter Error + scope + sublimelinter.mark.error + settings + + foreground + #fb4934 + + + + name + SublimeLinter Gutter Mark + scope + sublimelinter.gutter-mark + settings + + foreground + #928374 + + + + name + SublimeLinter Warning + scope + sublimelinter.mark.warning + settings + + foreground + #fabd2f + + + + name + HexViewer Upper Byte Nibble + scope + raw.nibble.upper + settings + + foreground + #fbf1c7 + + + + name + HexViewer Lower Byte Nibble + scope + raw.nibble.lower + settings + + foreground + #fbf1c7 + + + + name + HexViewer Highlight + scope + hexviewer.highlight + settings + + foreground + #222222 + background + #fabd2f + + + + name + HexViewer Edited Highlight + scope + hexviewer.highlight.edited + settings + + foreground + #222222 + background + #fe8019 + + + + name + Raw New Line: Carriage Return + scope + glyph.carriage-return + settings + + foreground + #ebdbb226 + + + + name + Raw New Line: New Line Glyph + scope + glyph.new-line + settings + + foreground + #ebdbb226 + + + + name + PlainTasks: Header + scope + keyword.control.header.todo + settings + + foreground + #b8bb26 + background + #3a3a3a + + + + name + PlainTasks: Notes + scope + notes.todo + settings + + foreground + #bdae93 + + + + name + PlainTasks: Punctuation + scope + text.todo punctuation.definition.bold, text.todo punctuation.definition.italic + settings + + foreground + #7c6f64 + + + + name + PlainTasks: Task Pending + scope + meta.item.todo.pending + settings + + foreground + #fbf1c7 + + + + name + PlainTasks: Task Pending Punctuation + scope + punctuation.definition.bullet.pending.todo + settings + + foreground + #928374 + + + + name + PlainTasks: Task Completed Punctuation + scope + punctuation.definition.bullet.completed.todo + settings + + foreground + #8ec07c + + + + name + PlainTasks: Task Cancelled Punctuation + scope + punctuation.definition.bullet.cancelled.todo + settings + + foreground + #fb4934 + + + + name + PlainTasks: Tag Critical + scope + string.other.tag.todo.critical + settings + + foreground + #fb4934 + fontStyle + bold + + + + name + PlainTasks: Tag High + scope + string.other.tag.todo.high + settings + + foreground + #fe8019 + fontStyle + bold + + + + name + PlainTasks: Tag Low + scope + string.other.tag.todo.low + settings + + foreground + #83a598 + fontStyle + bold + + + + name + PlainTasks: Tag Today + scope + string.other.tag.todo.today + settings + + foreground + #fabd2f + fontStyle + bold + + + + name + PlainTasks: Tag + scope + meta.tag.todo + settings + + foreground + #d3869b + + + + name + PlainTasks: URL + scope + punctuation.definition.url, todo.url + settings + + foreground + #83a598 + + + + name + PlainTasks: Separator + scope + meta.punctuation.archive.todo, meta.punctuation.separator.todo + settings + + fontStyle + italic + foreground + #928374 + + + + + 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" -- cgit v1.2.3