Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: enhance status line separator configuration #2313

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions yazi-config/preset/theme-dark.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ unset_alt = { fg = "red", bg = "gray" }
# : Status bar {{{

[status]
separator_open = ""
separator_close = ""
separator_left = [ "", "" ]
PFiS1737 marked this conversation as resolved.
Show resolved Hide resolved
separator_right = [ "", "" ]

# Progress
progress_label = { bold = true }
Expand Down
4 changes: 2 additions & 2 deletions yazi-config/preset/theme-light.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ unset_alt = { fg = "red", bg = "gray" }
# : Status bar {{{

[status]
separator_open = ""
separator_close = ""
separator_left = [ "", "" ]
separator_right = [ "", "" ]

# Progress
progress_label = { bold = true }
Expand Down
4 changes: 2 additions & 2 deletions yazi-config/src/theme/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ struct Mode {

#[derive(Deserialize, Serialize)]
struct Status {
pub separator_open: String,
pub separator_close: String,
pub separator_left: (String, String),
pub separator_right: (String, String),

// Progress
pub progress_label: Style,
Expand Down
12 changes: 6 additions & 6 deletions yazi-plugin/preset/components/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function Status:mode()

local style = self:style()
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.main.bg),
ui.Span(THEME.status.separator_left[1]):fg(style.main.bg),
ui.Span(" " .. mode .. " "):style(style.main),
ui.Span(THEME.status.separator_close):fg(style.main.bg):bg(style.alt.bg),
ui.Span(THEME.status.separator_left[2]):fg(style.main.bg):bg(style.alt.bg),
}
end

Expand All @@ -55,7 +55,7 @@ function Status:size()
local style = self:style()
return ui.Line {
ui.Span(" " .. ya.readable_size(h:size() or h.cha.len) .. " "):style(style.alt),
ui.Span(THEME.status.separator_close):fg(style.alt.bg),
ui.Span(THEME.status.separator_left[2]):fg(style.alt.bg),
}
end

Expand Down Expand Up @@ -115,7 +115,7 @@ function Status:percent()

local style = self:style()
return ui.Line {
ui.Span(" " .. THEME.status.separator_open):fg(style.alt.bg),
ui.Span(" " .. THEME.status.separator_right[1]):fg(style.alt.bg),
ui.Span(percent):style(style.alt),
}
end
Expand All @@ -126,9 +126,9 @@ function Status:position()

local style = self:style()
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.main.bg):bg(style.alt.bg),
ui.Span(THEME.status.separator_right[1]):fg(style.main.bg):bg(style.alt.bg),
ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style.main),
ui.Span(THEME.status.separator_close):fg(style.main.bg),
ui.Span(THEME.status.separator_right[2]):fg(style.main.bg),
}
end

Expand Down
Loading