From ab5450610552fd45c2b40bdb35967fad64acfd75 Mon Sep 17 00:00:00 2001 From: Solitude Date: Sun, 1 Sep 2024 06:00:30 +0300 Subject: [PATCH] feat: allow setting `order` from setup (#17) Co-authored-by: sxyazi --- git.yazi/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git.yazi/init.lua b/git.yazi/init.lua index 87a8df9..93d8d1e 100644 --- a/git.yazi/init.lua +++ b/git.yazi/init.lua @@ -47,6 +47,9 @@ local save = ya.sync(function(st, states) end) local function setup(st, opts) + opts = opts or {} + opts.order = opts.order or 1500 + st.states = {} local styles = { ["M"] = THEME.git_modified and ui.Style(THEME.git_modified) or ui.Style():fg("blue"), @@ -59,11 +62,11 @@ local function setup(st, opts) Linemode:children_add(function(self) local state = st.states[tostring(self._file.url)] if state then - return ui.Line { ui.Span(" "), ui.Span(state):style(styles[state]), ui.Span(" ") } + return ui.Line { ui.Span(" "), ui.Span(state):style(styles[state]) } else return ui.Line {} end - end, 5000) + end, opts.order) end local function fetch(self)