chore: add readme

This commit is contained in:
Kristofers Solo 2025-04-28 18:20:07 +03:00
parent c29a4410be
commit 3d1b0e17c9
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
2 changed files with 38 additions and 4 deletions

View File

@ -0,0 +1,29 @@
# vidir.yazi
This plugin is a bulk-rename plugin using [vidir](https://linux.die.net/man/1/vidir).
## Requirements
- [yazi >= v25.2.7](https://github.com/sxyazi/yazi)
- [vidir](https://linux.die.net/man/1/vidir) (sometimes included in [moreutils](https://man.archlinux.org/listing/extra/moreutils/) package)
## Installation
```bash
ya pack -a kristoferssolo/vidir
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "B"
run = [ "escape --visual", "plugin --sync vidir" ]
desc = "Bulk rename with vidir"
```
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

View File

@ -1,14 +1,19 @@
--- @sync entry
return { return {
entry = function() entry = function()
local selected_items = cx.active.selected local selected_items = cx.active.selected
if #selected_items >= 1 then if #selected_items >= 1 then
local selected_urls = "" -- For selected files, pass them directly to vidir
local files = ""
for _, v in pairs(selected_items) do for _, v in pairs(selected_items) do
selected_urls = selected_urls .. ya.quote(tostring(v)) files = files .. ya.quote(tostring(v)) .. " "
end end
ya.manager_emit("shell", { 'vidir "$@"', block = true, confirm = true })
ya.manager_emit("shell", { "vidir " .. files, block = true, confirm = true })
else else
ya.manager_emit("rename", { hovered = false, cursor = "before_ext" }) -- If no selection, use current directory (.)
ya.manager_emit("shell", { "vidir .", block = true, confirm = true })
end end
end, end,
} }