mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-23 07:41:03 +00:00
feat: add filter_keyword style to header indicator
defaults to red, bold; can be changed by setting filter_keyword = { fg = "red", bold = true } in the [mgr] section
This commit is contained in:
parent
bf1274315d
commit
3aaf64ebb7
5 changed files with 16 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ overall = {}
|
|||
|
||||
[mgr]
|
||||
cwd = { fg = "cyan" }
|
||||
filter_keyword = { fg = "red", bold = true }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "yellow", bold = true, italic = true, underline = true }
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ overall = {}
|
|||
|
||||
[mgr]
|
||||
cwd = { fg = "cyan" }
|
||||
filter_keyword = { fg = "red", bold = true }
|
||||
|
||||
# Find
|
||||
find_keyword = { fg = "yellow", bold = true, italic = true, underline = true }
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ pub struct Mgr {
|
|||
pub find_keyword: SyncCell<StyleFlat>,
|
||||
pub find_position: SyncCell<StyleFlat>,
|
||||
|
||||
// Filter
|
||||
pub filter_keyword: SyncCell<StyleFlat>,
|
||||
|
||||
// Symlink
|
||||
pub symlink_target: SyncCell<StyleFlat>,
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,14 @@ function Header:cwd()
|
|||
return ""
|
||||
end
|
||||
|
||||
local s = ya.readable_path(tostring(self._current.cwd)) .. self:flags()
|
||||
return ui.Span(ui.truncate(s, { max = max, rtl = true })):style(th.mgr.cwd)
|
||||
local path = ya.readable_path(tostring(self._current.cwd))
|
||||
local flags = self:flags()
|
||||
local flag_str = #flags == 0 and "" or " (" .. table.concat(flags, ", ") .. ")"
|
||||
|
||||
return ui.Line {
|
||||
ui.Span(ui.truncate(path, { max = max - #flag_str, rtl = true })):style(th.mgr.cwd),
|
||||
ui.Span(flag_str):style(th.mgr.filter_keyword),
|
||||
}
|
||||
end
|
||||
|
||||
function Header:flags()
|
||||
|
|
@ -46,7 +52,7 @@ function Header:flags()
|
|||
if finder then
|
||||
t[#t + 1] = string.format("find: %s", finder)
|
||||
end
|
||||
return #t == 0 and "" or " (" .. table.concat(t, ", ") .. ")"
|
||||
return t
|
||||
end
|
||||
|
||||
function Header:count()
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ fn mgr() -> Composer<ComposerGet, ComposerSet> {
|
|||
b"find_keyword" => Style::from(&m.find_keyword).into_lua(lua),
|
||||
b"find_position" => Style::from(&m.find_position).into_lua(lua),
|
||||
|
||||
b"filter_keyword" => Style::from(&m.filter_keyword).into_lua(lua),
|
||||
|
||||
b"symlink_target" => Style::from(&m.symlink_target).into_lua(lua),
|
||||
|
||||
b"marker_copied" => Style::from(&m.marker_copied).into_lua(lua),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue