mirror of
https://github.com/Cian-H/dotfiles.git
synced 2025-12-22 19:31:57 +00:00
Moved yazi dotfiles to the dotfiles subrepo
This commit is contained in:
27
.gitmodules
vendored
27
.gitmodules
vendored
@@ -13,3 +13,30 @@
|
||||
[submodule "dot_config/micro/plug/lsp"]
|
||||
path = dot_config/micro/plug/lsp
|
||||
url = https://github.com/AndCake/micro-plugin-lsp.git
|
||||
[submodule "dot_config/yazi/plugins/hexyl.yazi"]
|
||||
path = dot_config/yazi/plugins/hexyl.yazi
|
||||
url = https://github.com/Reledia/hexyl.yazi
|
||||
[submodule "dot_config/yazi/flavors/tokyo-night.yazi"]
|
||||
path = dot_config/yazi/flavors/tokyo-night.yazi
|
||||
url = https://github.com/BennyOe/tokyo-night.yazi.git
|
||||
[submodule "dot_config/yazi/plugins/sudo.yazi"]
|
||||
path = dot_config/yazi/plugins/sudo.yazi
|
||||
url = https://github.com/TD-Sky/sudo.yazi
|
||||
[submodule "dot_config/yazi/plugins/core"]
|
||||
path = dot_config/yazi/plugins/core
|
||||
url = https://github.com/yazi-rs/plugins
|
||||
[submodule "dot_config/yazi/plugins/ouch.yazi"]
|
||||
path = dot_config/yazi/plugins/ouch.yazi
|
||||
url = https://github.com/ndtoan96/ouch.yazi
|
||||
[submodule "dot_config/yazi/plugins/starship.yazi"]
|
||||
path = dot_config/yazi/plugins/starship.yazi
|
||||
url = https://github.com/Rolv-Apneseth/starship.yazi
|
||||
[submodule "dot_config/yazi/plugins/glow.yazi"]
|
||||
path = dot_config/yazi/plugins/glow.yazi
|
||||
url = https://github.com/Reledia/glow.yazi
|
||||
[submodule "dot_config/yazi/plugins/wl-clipboard.yazi"]
|
||||
path = dot_config/yazi/plugins/wl-clipboard.yazi
|
||||
url = https://github.com/grappas/wl-clipboard.yazi
|
||||
[submodule "dot_config/yazi/plugins/rich-preview.yazi"]
|
||||
path = dot_config/yazi/plugins/rich-preview.yazi
|
||||
url = https://github.com/AnirudhG07/rich-preview.yazi
|
||||
|
||||
1
dot_config/yazi/flavors/tokyo-night.yazi
Submodule
1
dot_config/yazi/flavors/tokyo-night.yazi
Submodule
Submodule dot_config/yazi/flavors/tokyo-night.yazi added at 695dac6bcc
@@ -1,5 +1,3 @@
|
||||
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
|
||||
|
||||
[manager]
|
||||
|
||||
keymap = [
|
||||
@@ -257,6 +255,48 @@ keymap = [
|
||||
# Help
|
||||
{ on = "~", run = "help", desc = "Open help" },
|
||||
{ on = "<F1>", run = "help", desc = "Open help" },
|
||||
|
||||
# Sudo
|
||||
{ on = [
|
||||
"R",
|
||||
"p",
|
||||
"p",
|
||||
], run = "plugin sudo -- paste", desc = "sudo paste" },
|
||||
{ on = [
|
||||
"R",
|
||||
"P",
|
||||
], run = "plugin sudo -- paste --force", desc = "sudo paste" },
|
||||
{ on = [
|
||||
"R",
|
||||
"r",
|
||||
], run = "plugin sudo -- rename", desc = "sudo rename" },
|
||||
{ on = [
|
||||
"R",
|
||||
"p",
|
||||
"l",
|
||||
], run = "plugin sudo -- link", desc = "sudo link" },
|
||||
{ on = [
|
||||
"R",
|
||||
"p",
|
||||
"r",
|
||||
], run = "plugin sudo -- link --relative", desc = "sudo link relative path" },
|
||||
{ on = [
|
||||
"R",
|
||||
"p",
|
||||
"L",
|
||||
], run = "plugin sudo -- hardlink", desc = "sudo hardlink" },
|
||||
{ on = [
|
||||
"R",
|
||||
"a",
|
||||
], run = "plugin sudo -- create", desc = "sudo create" },
|
||||
{ on = [
|
||||
"R",
|
||||
"d",
|
||||
], run = "plugin sudo -- remove", desc = "sudo trash" },
|
||||
{ on = [
|
||||
"R",
|
||||
"D",
|
||||
], run = "plugin sudo -- remove --permanently", desc = "sudo delete" },
|
||||
]
|
||||
|
||||
[tasks]
|
||||
@@ -489,3 +529,19 @@ desc = "Chmod on selected files"
|
||||
on = "T"
|
||||
run = "plugin --sync max-preview"
|
||||
desc = "Maximize or restore preview"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = "<C-y>"
|
||||
run = ["plugin wl-clipboard"]
|
||||
desc = "Yank to wl-clipboard"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = ["C"]
|
||||
run = "plugin ouch"
|
||||
desc = "Compress with ouch"
|
||||
|
||||
[opener]
|
||||
extract = [
|
||||
{ run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
|
||||
{ run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
|
||||
]
|
||||
|
||||
1
dot_config/yazi/plugins/core
Submodule
1
dot_config/yazi/plugins/core
Submodule
Submodule dot_config/yazi/plugins/core added at 4b027c7937
30
dot_config/yazi/plugins/glow.yazi/README.md
Normal file
30
dot_config/yazi/plugins/glow.yazi/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# glow.yazi
|
||||
|
||||
Plugin for [Yazi](https://github.com/sxyazi/yazi) to preview markdown files with [glow](https://github.com/charmbracelet/glow). To install, run the below mentioned command:
|
||||
|
||||
```bash
|
||||
ya pack -a Reledia/glow
|
||||
```
|
||||
|
||||
then include it in your `yazi.toml` to use:
|
||||
|
||||
```toml
|
||||
[plugin]
|
||||
prepend_previewers = [
|
||||
{ name = "*.md", run = "glow" },
|
||||
]
|
||||
```
|
||||
|
||||
Make sure you have [glow](https://github.com/charmbracelet/glow) installed, and can be found in `PATH`.
|
||||
|
||||
## Feature
|
||||
|
||||
+ You can modify line wrap in `main.lua`, the current value is 55.
|
||||
+ You can press `ctrl+e` to scroll up and `ctrl+y` to scroll down the readme file in preview panel in yazi: (add this to `keymap.toml`)
|
||||
```toml
|
||||
prepend_keymap = [
|
||||
# glow.yazi
|
||||
{ on = ["<C-e>"], run = "seek 5" },
|
||||
{ on = ["<C-y>"], run = "seek -5" },
|
||||
]
|
||||
```
|
||||
64
dot_config/yazi/plugins/glow.yazi/main.lua
Normal file
64
dot_config/yazi/plugins/glow.yazi/main.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
local M = {}
|
||||
|
||||
function M:peek(job)
|
||||
-- Set a fixed width of 50 characters for the preview
|
||||
local preview_width = 55
|
||||
|
||||
local child = Command("glow")
|
||||
:args({
|
||||
"--style",
|
||||
"dark",
|
||||
"--width",
|
||||
tostring(preview_width), -- Use fixed width instead of job.area.w
|
||||
tostring(job.file.url),
|
||||
})
|
||||
:env("CLICOLOR_FORCE", "1")
|
||||
:stdout(Command.PIPED)
|
||||
:stderr(Command.PIPED)
|
||||
:spawn()
|
||||
|
||||
if not child then
|
||||
return require("code").peek(job)
|
||||
end
|
||||
|
||||
local limit = job.area.h
|
||||
local i, lines = 0, ""
|
||||
repeat
|
||||
local next, event = child:read_line()
|
||||
if event == 1 then
|
||||
return require("code").peek(job)
|
||||
elseif event ~= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
if i > job.skip then
|
||||
lines = lines .. next
|
||||
end
|
||||
until i >= job.skip + limit
|
||||
|
||||
child:start_kill()
|
||||
if job.skip > 0 and i < job.skip + limit then
|
||||
ya.mgr_emit("peek", {
|
||||
tostring(math.max(0, i - limit)),
|
||||
only_if = job.file.url,
|
||||
upper_bound = true
|
||||
})
|
||||
else
|
||||
lines = lines:gsub("\t", string.rep(" ", rt.preview.tab_size))
|
||||
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
|
||||
end
|
||||
end
|
||||
|
||||
function M:seek(job)
|
||||
local h = cx.active.current.hovered
|
||||
if not h or h.url ~= job.file.url then
|
||||
return
|
||||
end
|
||||
ya.mgr_emit('peek', {
|
||||
math.max(0, cx.active.preview.skip + job.units),
|
||||
only_if = job.file.url,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
1
dot_config/yazi/plugins/hexyl.yazi
Submodule
1
dot_config/yazi/plugins/hexyl.yazi
Submodule
Submodule dot_config/yazi/plugins/hexyl.yazi added at 016a09bcc2
1
dot_config/yazi/plugins/ouch.yazi
Submodule
1
dot_config/yazi/plugins/ouch.yazi
Submodule
Submodule dot_config/yazi/plugins/ouch.yazi added at 2496cd9ac2
1
dot_config/yazi/plugins/rich-preview.yazi
Submodule
1
dot_config/yazi/plugins/rich-preview.yazi
Submodule
Submodule dot_config/yazi/plugins/rich-preview.yazi added at fdcf37320e
1
dot_config/yazi/plugins/starship.yazi
Submodule
1
dot_config/yazi/plugins/starship.yazi
Submodule
Submodule dot_config/yazi/plugins/starship.yazi added at 6fde3b2d9d
1
dot_config/yazi/plugins/sudo.yazi
Submodule
1
dot_config/yazi/plugins/sudo.yazi
Submodule
Submodule dot_config/yazi/plugins/sudo.yazi added at af70636fbc
1
dot_config/yazi/plugins/wl-clipboard.yazi
Submodule
1
dot_config/yazi/plugins/wl-clipboard.yazi
Submodule
Submodule dot_config/yazi/plugins/wl-clipboard.yazi added at c4edc4f6ad
@@ -1,12 +1,24 @@
|
||||
[plugin]
|
||||
prepend_previewers = [
|
||||
{ name = "*.md", run = "glow" },
|
||||
{ name = "*.bin", run = "hexyl" },
|
||||
{ name = "*.md", run = "glow" },
|
||||
{ name = "*.bin", run = "hexyl" },
|
||||
]
|
||||
append_previewers = [
|
||||
{ name = "*", run = "hexyl" },
|
||||
{ name = "*.md", run = "glow" },
|
||||
{ name = "*.csv", run = "rich-preview" },
|
||||
{ name = "*.rst", run = "rich-preview" },
|
||||
{ name = "*.ipynb", run = "rich-preview" },
|
||||
{ name = "*.json", run = "rich-preview" },
|
||||
{ mime = "application/*zip", run = "ouch" },
|
||||
{ mime = "application/x-tar", run = "ouch" },
|
||||
{ mime = "application/x-bzip2", run = "ouch" },
|
||||
{ mime = "application/x-7z-compressed", run = "ouch" },
|
||||
{ mime = "application/x-rar", run = "ouch" },
|
||||
{ mime = "application/x-xz", run = "ouch" },
|
||||
{ mime = "application/xz", run = "ouch" },
|
||||
{ name = "*", run = "hexyl" },
|
||||
]
|
||||
prepend_fetchers = [
|
||||
{ id = "git", name = "*", run = "git" },
|
||||
{ id = "git", name = "*/", run = "git" },
|
||||
{ id = "git", name = "*", run = "git" },
|
||||
{ id = "git", name = "*/", run = "git" },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user