repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk

d273182e44d6f7ac1bd76d413b91de9cb710e1f2

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (8)

+254 / −23 text lines

Diff layout

neovim/lua/bugabinga/nugu/palette_dark.lua

Modified

+10 / −10 text lines

44 info = '#5f7796',
55 warning = '#967653',
7 content_normal = '#d4d4d4',
8 content_backdrop = '#121212',
9 content_accent = '#750b75',
10 content_minor = '#4f4f4f',
11 content_focus = '#51818c',
12 content_unfocus = '#28454b',
13 content_important_global = '#6d5bb1',
14 content_important_local = '#483a7b',
7 content_normal = '#fafafa',
8 content_backdrop = '#020202',
9 content_accent = '#5d005d',
10 content_minor = '#757575',
11 content_focus = '#2eb3d1',
12 content_unfocus = '#016a85',
13 content_important_global = '#5e45c5',
14 content_important_local = '#5e45c5',
16 ui_normal = '#e6e6e6',
16 ui_normal = '#fcfcfc',
1717 ui_backdrop = '#000000',
1818 ui_accent = '#5a265a',
1919 ui_minor = '#242424',
2121 ui_unfocus = '#0c1010',
2222 ui_important_global = '#514a6c',
2323 ui_important_local = '#2a2638',
24}No final newline
24}

neovim/lua/bugabinga/nugu/palette_light.lua

Modified

+10 / −10 text lines

44 info = '#c7d0db',
55 warning = '#d9cbbb',
7 content_normal = '#2b2b2b',
8 content_backdrop = '#ededed',
9 content_accent = '#750b75',
10 content_minor = '#787878',
11 content_focus = '#267b8e',
12 content_unfocus = '#929292',
13 content_important_global = '#553d98',
14 content_important_local = '#8169c3',
7 content_normal = '#050505',
8 content_backdrop = '#fdfdfd',
9 content_accent = '#a300a3',
10 content_minor = '#525252',
11 content_focus = '#017b9a',
12 content_unfocus = '#40b8d6',
13 content_important_global = '#4a25a9',
14 content_important_local = '#4a25a9',
16 ui_normal = '#1a1a1a',
16 ui_normal = '#030303',
1717 ui_backdrop = '#ffffff',
1818 ui_accent = '#5a265a',
1919 ui_minor = '#a3a3a3',
2121 ui_unfocus = '#bdbdbd',
2222 ui_important_global = '#897bb1',
2323 ui_important_local = '#bab1d1',
24}No final newline
24}

wezterm/bugabinga/code_fonts.csv

Modified

+1 / −1 text lines

53531,Luculent
54543,Luxi Mono
55551,M+ 1m
5614,M+ 1mn
5654,M+ 1mn
575714,M+ 2m
58581,Martian Mono
59591,Mensch

wezterm/bugabinga/nugu/palette_dark.lua

Modified

+1 / −1 text lines

11return
2{palette = {debug = "#ff00ff", error = "#6f1d3a", warning = "#967653", info = "#5f7796", content = {normal = "#d4d4d4", backdrop = "#121212", accent = "#750b75", minor = "#4f4f4f", focus = "#51818c", unfocus = "#28454b", important_local = "#483a7b", important_global = "#6d5bb1"}, ui = {normal = "#e6e6e6", backdrop = "#000000", accent = "#5a265a", minor = "#242424", focus = "#3d474a", unfocus = "#0c1010", important_local = "#2a2638", important_global = "#514a6c"}}}No final newline
2{palette = {debug = "#ff00ff", error = "#6f1d3a", warning = "#967653", info = "#5f7796", content = {normal = "#d4d4d4", backdrop = "#121212", accent = "#750b75", minor = "#4f4f4f", focus = "#51818c", unfocus = "#28454b", important_local = "#483a7b", important_global = "#6d5bb1"}, ui = {normal = "#e6e6e6", backdrop = "#000000", accent = "#230723", minor = "#242424", focus = "#3d474a", unfocus = "#0c1010", important_local = "#2a2638", important_global = "#514a6c"}}}

wezterm/bugabinga/nugu/palette_light.lua

Modified

+1 / −1 text lines

11return
2{palette = {debug = "#ff00ff", error = "#d6638b", warning = "#d9cbbb", info = "#c7d0db", content = {normal = "#2b2b2b", backdrop = "#ededed", accent = "#750b75", minor = "#787878", focus = "#267b8e", unfocus = "#929292", important_local = "#8169c3", important_global = "#553d98"}, ui = {normal = "#1a1a1a", backdrop = "#ffffff", accent = "#5a265a", minor = "#a3a3a3", focus = "#53a5b7", unfocus = "#bdbdbd", important_local = "#bab1d1", important_global = "#897bb1"}}}No final newline
2{palette = {debug = "#ff00ff", error = "#d6638b", warning = "#d9cbbb", info = "#c7d0db", content = {normal = "#2b2b2b", backdrop = "#ededed", accent = "#750b75", minor = "#787878", focus = "#267b8e", unfocus = "#929292", important_local = "#8169c3", important_global = "#553d98"}, ui = {normal = "#1a1a1a", backdrop = "#ffffff", accent = "#b225b2", minor = "#a3a3a3", focus = "#53a5b7", unfocus = "#bdbdbd", important_local = "#bab1d1", important_global = "#897bb1"}}}

yazi/plugins/ouch.yazi/LICENSE

Added
new file mode 100644

+21 / −0 text lines

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

yazi/plugins/ouch.yazi/README.md

Added
new file mode 100644

+67 / −0 text lines

1# ouch.yazi
2
3[ouch](https://github.com/ouch-org/ouch) plugin for [Yazi](https://github.com/sxyazi/yazi).
4
5![ouch.yazi](https://github.com/ndtoan96/ouch.yazi/assets/33489972/946397ec-b37b-4bf4-93f1-c676fc8e59f2)
6
7## Features
8- Archive preview
9- Compression
11## Installation
13```bash
14# Linux/macOS
15git clone https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.yazi
17# Windows
18git clone https://github.com/ndtoan96/ouch.yazi.git %AppData%\yazi\config\plugins\ouch.yazi
19```
21Make sure you have [ouch](https://github.com/ouch-org/ouch) installed and in your `PATH`.
23## Usage
25### Preview
26For archive preview, add this to your `yazi.toml`:
28```toml
29[plugin]
30prepend_previewers = [
31 # Archive previewer
32 { mime = "application/*zip", run = "ouch" },
33 { mime = "application/x-tar", run = "ouch" },
34 { mime = "application/x-bzip2", run = "ouch" },
35 { mime = "application/x-7z-compressed", run = "ouch" },
36 { mime = "application/x-rar", run = "ouch" },
37 { mime = "application/x-xz", run = "ouch" },
38]
39```
41Now go to an archive on Yazi, you should see the archive's content in the preview pane. You can use `Alt-j` and `Alt-k` to roll up and down the preview.
43If you want to change the icon or the style of text, you can modify the `peek` function in `init.lua` file (all of them are stored in the `lines` variable).
45### Compression
46For compession, add this to your `keymap.toml`:
48```toml
49[[manager.prepend_keymap]]
50on = ["C"]
51run = "plugin ouch --args=zip"
52desc = "Compress with ouch"
53```
55The `--args=zip` part tells the plugin that default format is `zip`. You can change that to whatever format you want.
57### Decompression
58This plugin does not provide a decompression feature because it already is supported by Yazi.
59To decompress with `ouch`, configure the opener in `yazi.toml`.
61```toml
62[opener]
63extract = [
64 { run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
65 { run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
66]
67```

yazi/plugins/ouch.yazi/init.lua

Added
new file mode 100644

+143 / −0 text lines

1local M = {}
2
3function M:peek()
4 local child = Command("ouch")
5 :args({ "l", "-t", "-y", tostring(self.file.url) })
6 :stdout(Command.PIPED)
7 :stderr(Command.PIPED)
8 :spawn()
9 local limit = self.area.h
10 local file_name = string.match(tostring(self.file.url), ".*[/\\](.*)")
11 local lines = string.format("\x1b[2m📁 %s\x1b[0m\n", file_name)
12 local num_lines = 1
13 local num_skip = 0
14 repeat
15 local line, event = child:read_line()
16 if event == 1 then
17 ya.err(tostring(event))
18 elseif event ~= 0 then
19 break
20 end
22 if line:find('Archive', 1, true) ~= 1 and line:find('[INFO]', 1, true) ~= 1 then
23 if num_skip >= self.skip then
24 lines = lines .. line
25 num_lines = num_lines + 1
26 else
27 num_skip = num_skip + 1
28 end
29 end
30 until num_lines >= limit
32 child:start_kill()
33 if self.skip > 0 and num_lines < limit then
34 ya.manager_emit(
35 "peek",
36 { tostring(math.max(0, self.skip - (limit - num_lines))), only_if = tostring(self.file.url), upper_bound = "" }
37 )
38 else
39 ya.preview_widgets(self, { ui.Paragraph.parse(self.area, lines) })
40 end
41end
43function M:seek(units)
44 local h = cx.active.current.hovered
45 if h and h.url == self.file.url then
46 local step = math.floor(units * self.area.h / 10)
47 ya.manager_emit("peek", {
48 math.max(0, cx.active.preview.skip + step),
49 only_if = tostring(self.file.url),
50 })
51 end
52end
54-- Check if file exists
55local function file_exists(name)
56 local f = io.open(name, "r")
57 if f ~= nil then
58 io.close(f)
59 return true
60 else
61 return false
62 end
63end
65-- Get the files that need to be compressed and infer a default archive name
66local get_compression_target = ya.sync(function()
67 local tab = cx.active
68 local default_name
69 local paths = {}
70 if #tab.selected == 0 then
71 if tab.current.hovered then
72 local name = tab.current.hovered.name
73 default_name = name
74 table.insert(paths, name)
75 else
76 return
77 end
78 else
79 default_name = tab.current.cwd:name()
80 for _, url in pairs(tab.selected) do
81 table.insert(paths, tostring(url))
82 end
83 -- The compression targets are aquired, now unselect them
84 ya.manager_emit("escape", {})
85 end
86 return paths, default_name
87end)
89local function invoke_compress_command(paths, name)
90 local cmd_output, err_code = Command("ouch")
91 :args({ "c", "-y" })
92 :args(paths)
93 :arg(name)
94 :stderr(Command.PIPED)
95 :output()
96 if err_code ~= nil then
97 ya.notify({
98 title = "Failed to run ouch command",
99 content = "Status: " .. err_code,
100 timeout = 5.0,
101 level = "error",
102 })
103 elseif not cmd_output.status.success then
104 ya.notify({
105 title = "Compression failed: status code " .. cmd_output.status.code,
106 content = cmd_output.stderr,
107 timeout = 5.0,
108 level = "error",
109 })
110 end
111end
113function M:entry(args)
114 local default_fmt = args[1]
116 -- Get the files that need to be compressed and infer a default archive name
117 local paths, default_name = get_compression_target()
119 -- Get archive name from user
120 local output_name, name_event = ya.input({
121 title = "Create archive:",
122 value = default_name .. "." .. default_fmt,
123 position = { "top-center", y = 3, w = 40 },
124 })
125 if name_event ~= 1 then
126 return
127 end
129 -- Get confirmation if file exists
130 if file_exists(output_name) then
131 local confirm, confirm_event = ya.input({
132 title = "Overwrite " .. output_name .. "? (y/N)",
133 position = { "top-center", y = 3, w = 40 },
134 })
135 if not (confirm_event == 1 and confirm:lower() == "y") then
136 return
137 end
138 end
140 invoke_compress_command(paths, output_name)
141end
143return M