Skip to content

Commit

Permalink
feat: enhance statusline separator configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
PFiS1737 committed Feb 10, 2025
1 parent 793c90f commit 5c11433
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
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 = [ "", "" ]
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

0 comments on commit 5c11433

Please sign in to comment.