From b88fe7330aaa84adf347016cb42987961e41b027 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 12 Apr 2025 15:10:23 +0800 Subject: [PATCH] docs: new plugin `piper.yazi` to preview any shell command --- README.md | 1 + piper.yazi/README.md | 2 ++ piper.yazi/main.lua | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 74ecd0a..62cad4f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ For specific installation commands and configuration instructions, check the ind - [git.yazi](git.yazi) - Show the status of Git file changes as linemode in the file list. - [mount.yazi](mount.yazi) - A mount manager for Yazi, providing disk mount, unmount, and eject functionality. - [vcs-files.yazi](vcs-files.yazi) - Show Git file changes in Yazi. +- [piper.yazi](piper.yazi) - Pipe any shell command as a previewer. - [smart-filter.yazi](smart-filter.yazi) - Makes filters smarter: continuous filtering, automatically enter unique directory, open file on submitting. - [chmod.yazi](chmod.yazi) - Execute `chmod` on the selected files to change their mode. - [mime-ext.yazi](mime-ext.yazi) - A mime-type provider based on a file extension database, replacing the builtin `file(1)` to speed up mime-type retrieval at the expense of accuracy. diff --git a/piper.yazi/README.md b/piper.yazi/README.md index a3e8c12..c687605 100644 --- a/piper.yazi/README.md +++ b/piper.yazi/README.md @@ -51,6 +51,8 @@ name = "*.md" run = 'piper -- CLICOLOR_FORCE=1 glow -w=$w -s=dark "$1"' ``` +Note that there's [a bug in Glow v2.0](https://github.com/charmbracelet/glow/issues/440#issuecomment-2307992634) that causes slight color differences between tty and non-tty environments. + ### Preview directory tree with [`eza`](https://github.com/eza-community/eza) ```toml diff --git a/piper.yazi/main.lua b/piper.yazi/main.lua index bc5b532..879bb4d 100644 --- a/piper.yazi/main.lua +++ b/piper.yazi/main.lua @@ -45,7 +45,7 @@ function M:peek(job) else lines = lines:gsub("\t", string.rep(" ", rt.preview.tab_size)) ya.preview_widgets(job, { - ui.Text.parse(lines):area(job.area):wrap(rt.preview.wrap == "yes" and ui.Text.WRAP or ui.Text.WRAP_NO), + ui.Text.parse(lines):area(job.area), }) end end