Update: 2024-10-17

This commit is contained in:
2024-10-17 12:43:48 +03:00
parent eae6ecaebb
commit e2c877478c
68 changed files with 3579 additions and 1056 deletions

View File

@@ -1,9 +1,9 @@
# hexyl.yazi
Preview any file on [Yazi](https://github.com/sxyazi/yazi) using [hexyl](https://github.com/sharkdp/hexyl). To install, clone the repo inside your `~/.config/yazi/plugins/`:
Preview any file on [Yazi](https://github.com/sxyazi/yazi) using [hexyl](https://github.com/sharkdp/hexyl). To install, use the `ya pack` cli utility:
```bash
git clone https://github.com/Reledia/hexyl.yazi.git
ya pack -a Reledia/hexyl
```
then include it in your `yazi.toml` to use:
@@ -15,7 +15,7 @@ append_previewers = [
]
```
Make sure you have [hexyl](https://github.com/sharkdp/hexyl) installed, and can be found in `PATH`.
Make sure you have [hexyl](https://github.com/sharkdp/hexyl) installed, and that can be found in `PATH`.
## Preview

View File

@@ -2,7 +2,7 @@ local M = {}
function M:peek()
local child
local l = self.file.cha.length
local l = self.file.cha.len
if l == 0 then
child = Command("hexyl")
:args({
@@ -43,13 +43,10 @@ function M:peek()
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ tostring(math.max(0, i - limit)), only_if = tostring(self.file.url), upper_bound = "" }
)
ya.manager_emit("peek", { math.max(0, i - limit), only_if = self.file.url, upper_bound = true })
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
ya.preview_widgets(self, { ui.Text.parse(lines):area(self.area) })
end
end