Skip to content

ndtoan96/ouch.yazi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

ouch.yazi

ouch plugin for Yazi.

ouch.yazi

Features

  • Archive preview
  • Compression

Installation

If you use latest Yazi from main branch

# Linux/macOS
git clone https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.yazi

# Windows
git clone https://github.com/ndtoan96/ouch.yazi.git %AppData%\yazi\config\plugins\ouch.yazi

If you use Yazi <= 0.3.3

# 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 installed and in your PATH.

Usage

Preview

For archive preview, add this to your yazi.toml:

[plugin]
prepend_previewers = [
	# Archive previewer
	{ mime = "application/*zip",            run = "ouch" },
	{ mime = "application/x-tar",           run = "ouch" },
	{ mime = "application/x-bzip2",         run = "ouch" },
	{ mime = "application/x-7z-compressed", run = "ouch" },
	{ mime = "application/x-rar",           run = "ouch" },
	{ mime = "application/x-xz",            run = "ouch" },
]

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).

Compression

For compession, add this to your keymap.toml:

[[manager.prepend_keymap]]
on = ["C"]
run = "plugin ouch --args=zip"
desc = "Compress with ouch"

The --args=zip part tells the plugin that default format is zip. You can change that to whatever format you want.

Decompression

This plugin does not provide a decompression feature because it already is supported by Yazi. To decompress with ouch, configure the opener in yazi.toml.

[opener]
extract = [
	{ run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
	{ run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
]