Urie96 / preview.yazi

40 stars 2 forks source link

[bug] Encountered error after installing and configuring the plugin #2

Closed GOWxx closed 7 months ago

GOWxx commented 7 months ago

Error Information

$ yazi
$ thread 'main' panicked at yazi-config/src/plugin/plugin.rs:54:64:
called `Result::unwrap()` on an `Err` value: Error { inner: Error { inner: TomlError { message: "missing field `exec`", original: Some("\"$schema\" = \"https://yazi-rs.github.io/schemas/yazi.json\"\n\n[[plugin.previewers]]\nname = \"*.md\"\nrun = \"preview\"\n\n[[plugin.preloaders]]\nname = \"*\"\ncond = \"!mime\"\nexec = \"mime\"\nmulti = true\nprio = \"high\"\n\n[[plugin.preloaders]]\nmime = \"image/vnd.djvu\"\nexec = \"noop\"\n\n[[plugin.preloaders]]\nmime = \"image/*\"\nexec = \"image\"\n\n[[plugin.preloaders]]\nmime = \"video/*\"\nexec = \"video\"\n\n[[plugin.preloaders]]\nmime = \"application/pdf\"\nexec = \"pdf\"\n\n[manager]\nratio = [1, 4, 3]\nsort_by = \"alphabetical\"\nsort_sensitive = false\nsort_reverse = false\nsort_dir_first = false\nlinemode = \"none\"\nshow_hidden = false\nshow_symlink = true\n\n[preview]\ntab_size = 2\nmax_width = 600\nmax_height = 900\ncache_dir = \"\"\nimage_filter = \"triangle\"\nimage_quality = 75\nsixel_fraction = 15\nueberzug_scale = 1\nueberzug_offset = [0, 0, 0, 0]\n\n[[opener.edit]]\nexec = \"$EDITOR \\\"$@\\\"\"\nblock = true\nfor = \"unix\"\n\n[[opener.edit]]\nexec = \"code \\\"%*\\\"\"\norphan = true\nfor = \"windows\"\n\n[[opener.open]]\nexec = \"xdg-open \\\"$@\\\"\"\ndesc = \"Open\"\nfor = \"linux\"\n\n[[opener.open]]\nexec = \"open \\\"$@\\\"\"\ndesc = \"Open\"\nfor = \"macos\"\n\n[[opener.open]]\nexec = \"start \\\"\\\" \\\"%1\\\"\"\norphan = true\ndesc = \"Open\"\nfor = \"windows\"\n\n[[opener.reveal]]\nexec = \"open -R \\\"$1\\\"\"\ndesc = \"Reveal\"\nfor = \"macos\"\n\n[[opener.reveal]]\nexec = \"explorer /select, \\\"%1\\\"\"\norphan = true\ndesc = \"Reveal\"\nfor = \"windows\"\n\n[[opener.reveal]]\nexec = \"exiftool \\\"$1\\\"; echo \\\"Press enter to exit\\\"; read\"\nblock = true\ndesc = \"Show EXIF\"\nfor = \"unix\"\n\n[[opener.extract]]\nexec = \"unar \\\"$1\\\"\"\ndesc = \"Extract here\"\nfor = \"unix\"\n\n[[opener.extract]]\nexec = \"unar \\\"%1\\\"\"\ndesc = \"Extract here\"\nfor = \"windows\"\n\n[[opener.play]]\nexec = \"mpv \\\"$@\\\"\"\norphan = true\nfor = \"unix\"\n\n[[opener.play]]\nexec = \"mpv \\\"%1\\\"\"\norphan = true\nfor = \"windows\"\n\n[[opener.play]]\nexec = \"mediainfo \\\"$1\\\"; echo \\\"Press enter to exit\\\"; read\"\nblock = true\ndesc = \"Show media info\"\nfor = \"unix\"\n\n[[open.rules]]\nname = \"*/\"\nuse = [\"edit\", \"open\", \"reveal\"]\n\n[[open.rules]]\nmime = \"text/*\"\nuse = [\"edit\", \"reveal\"]\n\n[[open.rules]]\nmime = \"image/*\"\nuse = [\"open\", \"reveal\"]\n\n[[open.rules]]\nmime = \"video/*\"\nuse = [\"play\", \"reveal\"]\n\n[[open.rules]]\nmime = \"audio/*\"\nuse = [\"play\", \"reveal\"]\n\n[[open.rules]]\nmime = \"inode/x-empty\"\nuse = [\"edit\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/json\"\nuse = [\"edit\", \"reveal\"]\n\n[[open.rules]]\nmime = \"*/javascript\"\nuse = [\"edit\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/zip\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/gzip\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/x-tar\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/x-bzip\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/x-bzip2\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/x-7z-compressed\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/x-rar\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"application/xz\"\nuse = [\"extract\", \"reveal\"]\n\n[[open.rules]]\nmime = \"*\"\nuse = [\"open\", \"reveal\"]\n\n[tasks]\nmicro_workers = 10\nmacro_workers = 25\nbizarre_retry = 5\nimage_alloc = 536870912\nimage_bound = [0, 0]\nsuppress_preload = false\n\n[input]\ncd_title = \"Change directory:\"\ncd_origin = \"top-center\"\ncd_offset = [0, 2, 50, 3]\ncreate_title = \"Create:\"\ncreate_origin = \"top-center\"\ncreate_offset = [0, 2, 50, 3]\nrename_title = \"Rename:\"\nrename_origin = \"hovered\"\nrename_offset = [0, 1, 50, 3]\ntrash_title = \"Move {n} selected file{s} to trash? (y/N)\"\ntrash_origin = \"top-center\"\ntrash_offset = [0, 2, 50, 3]\ndelete_title = \"Delete {n} selected file{s} permanently? (y/N)\"\ndelete_origin = \"top-center\"\ndelete_offset = [0, 2, 50, 3]\nfilter_title = \"Filter:\"\nfilter_origin = \"top-center\"\nfilter_offset = [0, 2, 50, 3]\nfind_title = [\"Find next:\", \"Find previous:\"]\nfind_origin = \"top-center\"\nfind_offset = [0, 2, 50, 3]\nsearch_title = \"Search via {n}:\"\nsearch_origin = \"top-center\"\nsearch_offset = [0, 2, 50, 3]\nshell_title = [\"Shell:\", \"Shell (block):\"]\nshell_origin = \"top-center\"\nshell_offset = [0, 2, 50, 3]\noverwrite_title = \"Overwrite an existing file? (y/N)\"\noverwrite_origin = \"top-center\"\noverwrite_offset = [0, 2, 50, 3]\nquit_title = \"{n} task{s} running, sure to quit? (y/N)\"\nquit_origin = \"top-center\"\nquit_offset = [0, 2, 50, 3]\n\n[select]\nopen_title = \"Open with:\"\nopen_origin = \"hovered\"\nopen_offset = [0, 1, 50, 7]\n\n[log]\nenabled = false\n"), keys: ["plugin", "previewers"], span: Some(59..110) } } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Steps to Reproduce

Install yazi and some dependences

brew install yazi ffmpegthumbnailer unar jq poppler fd ripgrep fzf zoxide
brew tap homebrew/cask-fonts && brew install --cask font-symbols-only-nerd-font
brew install bat exiftool poppler ffmpeg

Set up the configuration directory and pull the preview plugin.

cd ~/.config
mkdir yazi
cd yazi 
git clone https://github.com/Urie96/preview.yazi.git ~/.config/yazi/plugins/preview.yazi 
touch yazi.toml 

Edit the configuration items.

[plugin]
previewers = [
  { name = "*/", run = "folder", sync = true }, 
  { name = "*.md", run = "preview" },
  { name = "*.csv", run = "preview" },
  { mime = "text/*", run = "code" },
  { mime = "*/xml", run = "code" },
  { mime = "*/javascript", run = "code" },
  { mime = "*/x-wine-extension-ini", run = "code" },
  { name = "*", run = "preview" },
]

Run yazi

$ yazi 
$ [[GET_ERRORS_MESSAGES]]

Environment Information

os : macOS 14.4 (Apple Silicon) yazi version : yazi 0.2.3 (Homebrew 2024-02-07)

sxyazi commented 7 months ago

Hi, run is a new attribute introduced in Yazi 0.2.4.

Unfortunately, the Yazi version on Homebrew is not the latest - you can download the latest Yazi from the official release page, which should fix this issue.

GOWxx commented 7 months ago

you can download the latest Yazi from the official release page, which should fix this issue.

Thank you for your reply, ^ ^, but it seems there's still some new issue

$ yazi -V
$ yazi 0.2.4 (b10f2de 2024-03-09)

when viewing files supported by the plugin, such as .md files, encounter error messages:

/[[EDITED]]/.config/yazi/plugins/preview.yazi/preview.sh: line 292: glow: command not found

.pdf files, encounter error messages:

/[[EDITED]]/.config/yazi/plugins/preview.yazi/preview.sh: line 108: md5sum: command not found__preview__image__path__ /var/folders/k5/6fyb698x6vq6v4c4km3hy2km0000gn/T/yazi/.0
sxyazi commented 7 months ago

It seems that there are still some dependencies of this plugin not listed in the README.

Hey @Urie96, could you provide a complete list of the dependencies that this plugin requires? That would be greatly appreciated!

Urie96 commented 7 months ago

Try the latest script, which will try other command if some commands not found.

GOWxx commented 7 months ago

I installed the dependencies and pulled the latest script according to the latest readme.md, the problem has been resolved, thank you!

$ brew install bat ffmpegthumbnailer unar poppler exiftool tree glow imagemagick pandoc sqlite smali miller transmission-cli