feat: new mime-ext plugin

This commit is contained in:
sxyazi
2024-08-21 20:24:10 +08:00
parent 49ec78e68a
commit b659791954
5 changed files with 1090 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ For specific installation commands and configuration instructions, check the ind
- [hide-preview.yazi](hide-preview.yazi) - Switch the preview pane between hidden and shown.
- [smart-filter.yazi](smart-filter.yazi) - Makes filters smarter: continuous filtering, automatically enter unique directory, open file on submitting.
- [jump-to-char.yazi](jump-to-char.yazi) - Vim-like `f<char>`, jump to the next file whose name starts with `<char>`.
- [mime-ext.yazi](mime-ext.yazi) - A _common_ file type MIME-type library specifically designed for Yazi.
- [diff.yazi](diff.yazi) - Diff the selected file with the hovered file, create a living patch, and copy it to the clipboard.
- [no-status.yazi](no-status.yazi) - Remove the status bar.
- [mactag.yazi](mactag.yazi) - Bring macOS's awesome tagging feature to Yazi! The plugin is only available for macOS just like the name says.

View File

@@ -33,5 +33,5 @@ if os.getenv("NVIM") then
end
```
In the example above, when it detects that you're [using Yazi in nvim](https://github.com/mikavilpas/yazi.nvim), the
In the example above, when it detects that you're [using Yazi in nvim](https://yazi-rs.github.io/docs/resources#vim), the
preview is hidden by default - you can always press `T` (or any key you've bound) to display it again.

21
mime-ext.yazi/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

31
mime-ext.yazi/README.md Normal file
View File

@@ -0,0 +1,31 @@
# mime-ext.yazi
A _common_ file type MIME-type library specifically designed for Yazi. Ensuring strict compliance with IANA-registered media types is not its primary goal.
It is still in a very early stage and currently requires the [latest nightly build of Yazi](https://github.com/sxyazi/yazi/releases/tag/nightly).
## Installation
```sh
ya pack -a yazi-rs/plugins:mime-ext
```
## Usage
Add this to your `~/.config/yazi/yazi.toml`:
```toml
[[plugin.prepend_fetchers]]
id = "mime"
if = "!mime"
name = "*"
run = "mime-ext"
prio = "high"
```
## TODO
- Add more file types (PRs welcome!).
- Allow configuring the plugin and overriding some of its rules.
- Eliminating `x-` as part of Yazi v0.4 as it's discouraged as per [rfc6838#section-3.4](https://datatracker.ietf.org/doc/html/rfc6838#section-3.4)
- Compress mime-type tables.

1036
mime-ext.yazi/init.lua Normal file

File diff suppressed because it is too large Load Diff