feat: adapt to https://github.com/sxyazi/yazi/pull/1257
This commit is contained in:
@@ -16,7 +16,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "<C-d>" ]
|
on = "<C-d>"
|
||||||
run = "plugin diff"
|
run = "plugin diff"
|
||||||
desc = "Diff the selected with the hovered file"
|
desc = "Diff the selected with the hovered file"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,36 +1,37 @@
|
|||||||
local function setup()
|
local function setup()
|
||||||
Manager.render = function(self, area)
|
local old_build = Tab.build
|
||||||
local c = self:layout(area)
|
Tab.build = function(self, ...)
|
||||||
local bar = function(c, x, y)
|
local bar = function(c, x, y)
|
||||||
if x <= 0 or x == area.w - 1 then
|
if x <= 0 or x == self._area.w - 1 then
|
||||||
return {}
|
return ui.Bar(ui.Rect.default, ui.Bar.TOP)
|
||||||
end
|
end
|
||||||
|
|
||||||
return ui.Bar(
|
return ui.Bar(
|
||||||
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, area.w - x, 1), h = math.min(1, area.h) },
|
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
|
ui.Bar.TOP
|
||||||
):symbol(c)
|
):symbol(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local c = self._chunks
|
||||||
|
self._chunks = {
|
||||||
|
c[1]:padding(ui.Padding.y(1)),
|
||||||
|
c[2]:padding(c[1].w > 0 and ui.Padding.y(1) or ui.Padding(1, 0, 1, 1)),
|
||||||
|
c[3]:padding(ui.Padding.y(1)),
|
||||||
|
}
|
||||||
|
|
||||||
local style = THEME.manager.border_style
|
local style = THEME.manager.border_style
|
||||||
return ya.flat {
|
self._base = ya.list_merge(self._base or {}, {
|
||||||
-- Borders
|
ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style),
|
||||||
ui.Border(area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style),
|
ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style),
|
||||||
ui.Bar(c[1]:padding(ui.Padding.y(1)), ui.Bar.RIGHT):style(style),
|
ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style),
|
||||||
ui.Bar(c[3]:padding(ui.Padding.y(1)), ui.Bar.LEFT):style(style),
|
|
||||||
|
|
||||||
bar("┬", c[1].right - 1, c[1].y),
|
bar("┬", c[1].right - 1, c[1].y),
|
||||||
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||||
bar("┬", c[2].right, c[2].y),
|
bar("┬", c[2].right, c[2].y),
|
||||||
bar("┴", c[2].right, c[2].bottom - 1),
|
bar("┴", c[2].right, c[2].bottom - 1),
|
||||||
|
})
|
||||||
|
|
||||||
-- Parent
|
old_build(self, ...)
|
||||||
Parent:render(c[1]:padding(ui.Padding.xy(1))),
|
|
||||||
-- Current
|
|
||||||
Current:render(c[2]:padding(c[1].w > 0 and ui.Padding.y(1) or ui.Padding(1, 0, 1, 1))),
|
|
||||||
-- Preview
|
|
||||||
Preview:render(c[3]:padding(ui.Padding.xy(1))),
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "T" ]
|
on = "T"
|
||||||
run = "plugin --sync hide-preview"
|
run = "plugin --sync hide-preview"
|
||||||
desc = "Hide or show preview"
|
desc = "Hide or show preview"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
local function entry(st)
|
local function entry(st)
|
||||||
if st.old then
|
if st.old then
|
||||||
Manager.layout, st.old = st.old, nil
|
Tab.layout, st.old = st.old, nil
|
||||||
else
|
else
|
||||||
st.old = Manager.layout
|
st.old = Tab.layout
|
||||||
Manager.layout = function(self, area)
|
Tab.layout = function(self)
|
||||||
self.area = area
|
|
||||||
|
|
||||||
local all = MANAGER.ratio.parent + MANAGER.ratio.current
|
local all = MANAGER.ratio.parent + MANAGER.ratio.current
|
||||||
return ui.Layout()
|
self._chunks = ui.Layout()
|
||||||
:direction(ui.Layout.HORIZONTAL)
|
:direction(ui.Layout.HORIZONTAL)
|
||||||
:constraints({
|
:constraints({
|
||||||
ui.Constraint.Ratio(MANAGER.ratio.parent, all),
|
ui.Constraint.Ratio(MANAGER.ratio.parent, all),
|
||||||
ui.Constraint.Ratio(MANAGER.ratio.current, all),
|
ui.Constraint.Ratio(MANAGER.ratio.current, all),
|
||||||
ui.Constraint.Length(1),
|
ui.Constraint.Length(1),
|
||||||
})
|
})
|
||||||
:split(area)
|
:split(self._area)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ya.app_emit("resize", {})
|
ya.app_emit("resize", {})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "f" ]
|
on = "f"
|
||||||
run = "plugin jump-to-char"
|
run = "plugin jump-to-char"
|
||||||
desc = "Jump to char"
|
desc = "Jump to char"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "T" ]
|
on = "T"
|
||||||
run = "plugin --sync max-preview"
|
run = "plugin --sync max-preview"
|
||||||
desc = "Maximize or restore preview"
|
desc = "Maximize or restore preview"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
local function entry(st)
|
local function entry(st)
|
||||||
if st.old then
|
if st.old then
|
||||||
Manager.layout, st.old = st.old, nil
|
Tab.layout, st.old = st.old, nil
|
||||||
else
|
else
|
||||||
st.old = Manager.layout
|
st.old = Tab.layout
|
||||||
Manager.layout = function(self, area)
|
Tab.layout = function(self)
|
||||||
self.area = area
|
self._chunks = ui.Layout()
|
||||||
|
|
||||||
return ui.Layout()
|
|
||||||
:direction(ui.Layout.HORIZONTAL)
|
:direction(ui.Layout.HORIZONTAL)
|
||||||
:constraints({
|
:constraints({
|
||||||
ui.Constraint.Percentage(0),
|
ui.Constraint.Percentage(0),
|
||||||
ui.Constraint.Percentage(0),
|
ui.Constraint.Percentage(0),
|
||||||
ui.Constraint.Percentage(100),
|
ui.Constraint.Percentage(100),
|
||||||
})
|
})
|
||||||
:split(area)
|
:split(self._area)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ya.app_emit("resize", {})
|
ya.app_emit("resize", {})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "F" ]
|
on = "F"
|
||||||
run = "plugin smart-filter"
|
run = "plugin smart-filter"
|
||||||
desc = "Smart filter"
|
desc = "Smart filter"
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user