Files
plugins/mactag.yazi
三咲雅 · Misaki Masa 83c40c798a Update README.md
2024-09-28 22:23:44 +08:00
..
2024-09-28 22:22:36 +08:00
2024-08-12 22:51:05 +08:00
2024-09-28 22:23:44 +08:00

mactag.yazi

Bring macOS's awesome tagging feature to Yazi! The plugin it's only available for macOS just like the name says.

Authors: @AnirudhG07, and @sxyazi

https://github.com/user-attachments/assets/7f26dc6d-67a5-4a85-a99e-4671ece9ae56

Installation

Install the plugin itself, and jdberry/tag used to tag files:

ya pack -a yazi-rs/plugins:mactag
brew update && brew install tag

Setup

Add the following to your ~/.config/yazi/init.lua:

require("mactag"):setup {
	-- You can change the colors of the tags here
	keys = {
		r = "Red",
		o = "Orange",
		y = "Yellow",
		g = "Green",
		b = "Blue",
		p = "Purple",
	},
	colors = {
		Red    = "#ee7b70",
		Orange = "#f5bd5c",
		Yellow = "#fbe764",
		Green  = "#91fc87",
		Blue   = "#5fa3f8",
		Purple = "#cb88f8",
	},
}

And register it as fetchers in your ~/.config/yazi/yazi.toml:

[[plugin.prepend_fetchers]]
id   = "mactag"
name = "*"
run  = "mactag"

[[plugin.prepend_fetchers]]
id   = "mactag"
name = "*/"
run  = "mactag"

Usage

This plugin also provides the functionality to add and remove tags. Add following keybindings to your ~/.config/yazi/keymap.toml to enable it:

[[manager.prepend_keymap]]
on   = [ "b", "a" ]
run  = 'plugin mactag --args="add"'
desc = "Add tag to selected files"

[[manager.prepend_keymap]]
on   = [ "b", "r" ]
run  = 'plugin mactag --args="remove"'
desc = "Remove tag from selected files"