mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-02-04 06:32:03 +00:00
Use dotter
This commit is contained in:
21
config/yazi/plugins/full-border.yazi/LICENSE
Normal file
21
config/yazi/plugins/full-border.yazi/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 yazi-rs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
22
config/yazi/plugins/full-border.yazi/README.md
Normal file
22
config/yazi/plugins/full-border.yazi/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# full-border.yazi
|
||||
|
||||
Add a full border to Yazi to make it look fancier.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins#full-border
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add this to your `init.lua` to enable the plugin:
|
||||
|
||||
```lua
|
||||
require("full-border"):setup()
|
||||
```
|
||||
|
||||
This plugin overrides the [`Manager.render`](https://github.com/sxyazi/yazi/blob/latest/yazi-plugin/preset/components/manager.lua) method,
|
||||
you might need to check if any other plugins that also need to override it are enabled.
|
||||
38
config/yazi/plugins/full-border.yazi/init.lua
Normal file
38
config/yazi/plugins/full-border.yazi/init.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
local function setup()
|
||||
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(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
|
||||
self._base = ya.list_merge(self._base or {}, {
|
||||
ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):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
|
||||
|
||||
return { setup = setup }
|
||||
Reference in New Issue
Block a user