fix(yazi): nvim env

This commit is contained in:
Kristofers Solo 2025-04-28 22:10:08 +03:00
parent 57314ec659
commit ed917492f1
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
8 changed files with 34 additions and 1240 deletions

View File

@ -1,7 +1,6 @@
#!/bin/zsh
typeset -U PATH path
# profile file. Runs on login. Environmental variables are set here.
# If you don't plan on reverting to bash, you can remove the link in ~/.profile
@ -20,7 +19,6 @@ export LIBSEAT_BACKEND=logind
unsetopt PROMPT_SP
# Default Apps
export BROWSER="floorp"
export EDITOR="nvim"

View File

@ -3,7 +3,6 @@
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
[manager]
keymap = [
{on = [ "<Esc>" ], run = "escape", desc = "Exit visual mode, clear selected, or cancel search"},
{on = [ "<C-[>" ], run = "escape", desc = "Exit visual mode, clear selected, or cancel search"},
@ -153,8 +152,8 @@ keymap = [
]
prepend_keymap = [
# Custom
{on = [ "y" ], run = [ ''' shell 'fd -a "$1" | xclip -selection clipboard' --confirm ''', "yank" ], desc = "Yank the selected files"},
{on = [ "y" ], run = [ ''' shell 'fd -a "$1" | wl-copy' --confirm ''', "yank" ], desc = "Yank the selected files"},
{on = [ "y" ], run = [ 'shell -- echo "$@" | xclip -selection clipboard', "yank" ], desc = "Yank the selected files"},
{on = [ "y" ], run = [ 'shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list', "yank" ], desc = "Yank the selected files"},
{on = [ "b", "g" ], run = [ ''' shell 'setbg "$1"' --confirm ''' ], desc = "Set the background image"},
# vidir
{on = "B", run = [ "escape --visual", "plugin --sync vidir" ], desc = "Bulk rename with vidir"},
@ -169,8 +168,8 @@ prepend_keymap = [
{on = [ "R" ], run = "plugin augment-command -- rename", desc = "Rename a file or directory"},
{on = [ "D" ], run = "plugin augment-command -- remove --permanently", desc = "Permanently delete the files"},
# Dragon
{on = [ "m", "a" ], run = ''' shell 'ripdrag -atk "$@"' --confirm ''', desc = "Drag and drop all"},
{on = [ "m", "i" ], run = ''' shell 'ripdrag -tk "$@"' --confirm ''', desc = "Drag and drop individual"},
{on = [ "m", "m" ], run = 'shell -- ripdrag -atk "$@"', desc = "Drag and drop all"},
{on = "<C-n>", run = 'shell -- ripdrag -atk "$@"', desc = "Drag and drop all"},
# Max Preview
{on = "T", run = "plugin --sync max-preview", desc = "Maximize or restore preview"},
# Hide Preview

View File

@ -10,8 +10,8 @@ hash = "23915860e59348bf4166778bb0e606f7"
[[plugin.deps]]
use = "hankertrix/augment-command"
rev = "91ba6c5"
hash = "6ac13898ec80c623e2d9ea90b947c86a"
rev = "04cda98"
hash = "3ec6486539188b1e1932ac27f3582917"
[[plugin.deps]]
use = "kirasok/torrent-preview"
@ -53,11 +53,6 @@ use = "yazi-rs/plugins:smart-filter"
rev = "864a021"
hash = "f0c4b41b5d19a3144958383333eff6e7"
[[plugin.deps]]
use = "yazi-rs/plugins:mime-ext"
rev = "864a021"
hash = "5e24c167e9ae9a203a48f2a438b8c705"
[[plugin.deps]]
use = "yazi-rs/plugins:diff"
rev = "864a021"

View File

@ -403,7 +403,7 @@ local bat_command_pattern = "%f[%a]bat%f[%A]"
--
-- Pass true as the first parameter to get the function
-- to merge the tables recursively.
---@param deep_or_target table<any, any>|boolean Whether to merge recursively
---@param deep_or_target table<any, any>|boolean|nil Recursively merge or not
---@param target table<any, any> The target table to merge
---@param ... table<any, any>[] The tables to merge
---@return table<any, any> merged_table The merged table
@ -419,13 +419,13 @@ local function merge_tables(deep_or_target, target, ...)
-- Initialise the recursive variable
local recursive = false
-- If the deep or target variable not a table
if type(deep_or_target) ~= "table" then
-- If the deep or target variable is a boolean
if type(deep_or_target) == "boolean" then
--
-- Set the recursive variable to the boolean value of the
-- deep or target variable
recursive = not not deep_or_target
recursive = deep_or_target
-- Set the target table to the target variable
target_table = target
@ -433,12 +433,14 @@ local function merge_tables(deep_or_target, target, ...)
-- Set the arguments to the rest of the arguments
args = { ... }
-- Otherwise, the deep or target variable is a table
-- Otherwise, the deep or target variable is not a boolean,
-- and is most likely a table.
else
--
-- Set the target table to the deep or target variable
target_table = deep_or_target
-- if it is a table, otherwise, set it to an empty table
target_table = type(deep_or_target) == "table" and deep_or_target or {}
-- Set the arguments to the target variable
-- and the rest of the arguments
@ -1570,6 +1572,9 @@ function SevenZip:retry_extractor(extractor_function, clean_up_wanted)
}
end
-- Clean up the extracted files
clean_up()
-- Set the error message to the standard error
error_message = output.stderr
@ -1585,9 +1590,6 @@ function SevenZip:retry_extractor(extractor_function, clean_up_wanted)
then
--
-- Clean up the extracted files
clean_up()
-- Return the extractor function result
return {
successful = false,
@ -1627,13 +1629,10 @@ function SevenZip:retry_extractor(extractor_function, clean_up_wanted)
if event == 1 and user_input ~= nil then
self.password = user_input
-- Otherwise
-- Otherwise, the user has cancelled the input
else
--
-- Call the clean up function
clean_up()
-- Return the result of the extractor command
return {
successful = false,

View File

@ -1,21 +0,0 @@
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.

View File

@ -1,56 +0,0 @@
# mime-ext.yazi
A mime-type provider based on a file extension database, replacing the [builtin `file(1)`](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/mime.lua) to speed up mime-type retrieval at the expense of accuracy.
See https://yazi-rs.github.io/docs/tips#make-yazi-even-faster for more information.
## 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"
name = "*"
run = "mime-ext"
prio = "high"
```
## Advanced
You can also customize it in your `~/.config/yazi/init.lua` with:
```lua
require("mime-ext"):setup {
-- Expand the existing filename database (lowercase), for example:
with_files = {
makefile = "text/makefile",
-- ...
},
-- Expand the existing extension database (lowercase), for example:
with_exts = {
mk = "text/makefile",
-- ...
},
-- If the mime-type is not in both filename and extension databases,
-- then fallback to Yazi's preset `mime` plugin, which uses `file(1)`
fallback_file1 = false,
}
```
## TODO
- Add more file types (PRs welcome!).
- Compress mime-type tables.
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

File diff suppressed because it is too large Load Diff

View File

@ -14,11 +14,13 @@ show_symlink = true
scrolloff = 8
[preview]
wrap = "yes"
tab_size = 2
max_width = 600
max_height = 900
cache_dir = ""
image_filter = "triangle"
image_delay = 0
image_quality = 75
sixel_fraction = 15
ueberzug_scale = 1
@ -26,7 +28,7 @@ ueberzug_offset = [ 0, 0, 0, 0 ]
[opener]
edit = [
{run = '${EDITOR:=vim} "$@"', desc = "$EDITOR", block = true, for = "unix"},
{run = '/usr/bin/nvim "$@"', desc = "$EDITOR", block = true, for = "unix"},
{run = 'code "%*"', orphan = true, desc = "code", for = "windows"},
{run = 'code -w "%*"', block = true, desc = "code (block)", for = "windows"},
]
@ -35,7 +37,6 @@ open = [
{run = 'open "$@"', desc = "Open", for = "macos"},
{run = 'start "" "%1"', orphan = true, desc = "Open", for = "windows"},
]
reveal = [
{run = 'xdg-open "$(dirname "$0")"', desc = "Reveal", for = "linux"},
{run = 'open -R "$1"', desc = "Reveal", for = "macos"},
@ -54,16 +55,23 @@ play = [
[open]
rules = [
# Folder
{name = "*/", use = [ "edit", "open", "reveal" ]},
# Text
{mime = "text/*", use = [ "edit", "reveal" ]},
{mime = "image/*", use = [ "reveal" ]},
# Image
{mime = "image/*", use = [ "open", "reveal" ]},
# Media
{mime = "{audio,video}/*", use = [ "play", "reveal" ]},
{mime = "inode/x-empty", use = [ "edit", "reveal" ]},
{mime = "application/*zip", use = [ "extract", "reveal" ]},
{mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ]},
{mime = "application/json", use = [ "edit", "reveal" ]},
# Archive
{mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", use = [ "extract", "reveal" ]},
# JSON
{mime = "application/{json,ndjson}", use = [ "edit", "reveal" ]},
{mime = "*/javascript", use = [ "edit", "reveal" ]},
{mime = "*", use = [ "open", "reveal" ]},
# Empty file
{mime = "inode/empty", use = [ "edit", "reveal" ]},
# Fallback
{name = "*", use = [ "open", "reveal" ]},
]
[tasks]
@ -75,7 +83,6 @@ image_bound = [ 0, 0 ]
suppress_preload = false
[plugin]
preloaders = [
{mime = "image/*", run = "image"},
{mime = "video/*", run = "video"},
@ -135,7 +142,6 @@ append_previewers = [
prepend_fetchers = [
{id = "git", name = "*", run = "git"},
{id = "git", name = "*/", run = "git"},
{id = "mime", name = "*", run = "mime-ext", prio = "high"},
]
[input]