feat: new null plugin as a general-purpose error handler
#3387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Yazi relies on file(1) to detect a file's MIME type, and without a MIME type, no file can be previewed or opened.
Most *nix systems have
filebundled by default, but Windows users need to install it manually. In the past I've received many invalid bug reports caused byfilenot being installed:I'm a bit tired of repeating "RTFM!!!" over and over, so let's fix this now :P
This PR changes the
mime.localplugin to set a placeholder MIME type ofnull/file1-not-foundfor files when thefilecommand cannot be found, and adds a new previewer rule:{ mime = "null/*", run = "null" },The
nullpreviewer just prints a message in the preview pane to prompt the user to install file(1). And since the file has a MIME type now, so it can also be opened (with the fallback open rule):yazi/yazi-config/preset/yazi-default.toml
Line 86 in f427d70
Hopefully, this will save time for both users and maintainers when this issue is encountered again, reduce the number of invalid bug reports, and bring world peace!