From 0da8243d12fce17740ce0c966eb932cb684ca247 Mon Sep 17 00:00:00 2001 From: doryan Date: Wed, 28 Aug 2024 22:43:22 +0400 Subject: [PATCH] add config for yazi --- yazi/init.lua | 43 +++++++++++++++++++++++++++++++++++++++++++ yazi/theme.toml | 6 ++++++ yazi/yazi.toml | 6 ++++++ 3 files changed, 55 insertions(+) create mode 100644 yazi/init.lua create mode 100644 yazi/theme.toml create mode 100644 yazi/yazi.toml diff --git a/yazi/init.lua b/yazi/init.lua new file mode 100644 index 0000000..f2983c4 --- /dev/null +++ b/yazi/init.lua @@ -0,0 +1,43 @@ +local function setup(_, opts) + local type = opts and opts.type or ui.Border.ROUNDED + local old_build = Tab.build + + Tab.build = function(self, ...) + local bar = function(c, x, y) + if x <= 0 or x == self._area.w - 1 then + return ui.Bar(ui.Rect.default, ui.Bar.TOP) + end + + return ui.Bar( + ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) }, + ui.Bar.TOP + ):symbol(c) + end + + local c = self._chunks + self._chunks = { + c[1]:padding(ui.Padding.y(1)), + c[2]:padding(ui.Padding(c[1].w > 0 and 0 or 1, c[3].w > 0 and 0 or 1, 1, 1)), + c[3]:padding(ui.Padding.y(1)), + } + + local style = THEME.manager.border_style + self._base = ya.list_merge(self._base or {}, { + ui.Border(self._area, ui.Border.ALL):type(type):style(style), + ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style), + ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style), + + bar("┬", c[1].right - 1, c[1].y), + bar("┴", c[1].right - 1, c[1].bottom - 1), + bar("┬", c[2].right, c[2].y), + bar("┴", c[2].right, c[2].bottom - 1), + }) + + old_build(self, ...) + end +end + +setup { + -- Available values: ui.Border.PLAIN, ui.Border.ROUNDED + type = ui.Border.ROUNDED, +} diff --git a/yazi/theme.toml b/yazi/theme.toml new file mode 100644 index 0000000..315c862 --- /dev/null +++ b/yazi/theme.toml @@ -0,0 +1,6 @@ +[status] +separator_open = "" +separator_close = "" + +[manager] +border_style = { bold = true } diff --git a/yazi/yazi.toml b/yazi/yazi.toml new file mode 100644 index 0000000..b75af7e --- /dev/null +++ b/yazi/yazi.toml @@ -0,0 +1,6 @@ +[manager] +show_hidden = true + +[preview] +image_uality = 90 +