Update: 2024-11-21

This commit is contained in:
2024-11-21 14:02:29 +02:00
parent 7da57cd023
commit 74e444a83f
1010 changed files with 271 additions and 574412 deletions

View File

@@ -10,6 +10,7 @@
## Installation
If you use latest Yazi from main branch
```bash
# Linux/macOS
git clone https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.yazi
@@ -18,6 +19,15 @@ git clone https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.
git clone https://github.com/ndtoan96/ouch.yazi.git %AppData%\yazi\config\plugins\ouch.yazi
```
If you use Yazi <= 0.3.3
```bash
# Linux/macOS
git clone --branch v0.2.1 --single-branch https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.yazi
# Windows
git clone --branch v0.2.1 --single-branch https://github.com/ndtoan96/ouch.yazi.git %AppData%\yazi\config\plugins\ouch.yazi
```
Make sure you have [ouch](https://github.com/ouch-org/ouch) installed and in your `PATH`.
## Usage
@@ -38,7 +48,7 @@ prepend_previewers = [
]
```
Now go to an archive on Yazi, you should see the archive's content in the preview pane. You can use `Alt-j` and `Alt-k` to roll up and down the preview.
Now go to an archive on Yazi, you should see the archive's content in the preview pane. You can use `J` and `K` to roll up and down the preview.
If you want to change the icon or the style of text, you can modify the `peek` function in `init.lua` file (all of them are stored in the `lines` variable).

View File

@@ -8,7 +8,7 @@ function M:peek()
:spawn()
local limit = self.area.h
local file_name = string.match(tostring(self.file.url), ".*[/\\](.*)")
local lines = string.format("\x1b[2m📁 %s\x1b[0m\n", file_name)
local lines = string.format("📁 \x1b[2m%s\x1b[0m\n", file_name)
local num_lines = 1
local num_skip = 0
repeat
@@ -36,7 +36,7 @@ function M:peek()
{ tostring(math.max(0, self.skip - (limit - num_lines))), only_if = tostring(self.file.url), upper_bound = "" }
)
else
ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
ya.preview_widgets(self, { ui.Text(lines):area(self.area) })
end
end
@@ -113,6 +113,8 @@ end
function M:entry(args)
local default_fmt = args[1]
ya.manager_emit("escape", { visual = true })
-- Get the files that need to be compressed and infer a default archive name
local paths, default_name = get_compression_target()