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)

neovim/lua/bugabinga/nugu/palette_dark.lua

Modified
4 4 return {
5 5 debug = '#ff00ff',
6 6 error = '#6f1d3a',
7 7 info = '#5f7796',
8 8 warning = '#967653',
10 - content_normal = '#d4d4d4',
11 - content_backdrop = '#121212',
12 - content_accent = '#750b75',
13 - content_minor = '#4f4f4f',
14 - content_focus = '#51818c',
15 - content_unfocus = '#28454b',
16 - content_important_global = '#6d5bb1',
17 - content_important_local = '#483a7b',
10 + content_normal = '#fafafa',
11 + content_backdrop = '#020202',
12 + content_accent = '#5d005d',
13 + content_minor = '#757575',
14 + content_focus = '#2eb3d1',
15 + content_unfocus = '#016a85',
16 + content_important_global = '#5e45c5',
17 + content_important_local = '#5e45c5',
19 - ui_normal = '#e6e6e6',
19 + ui_normal = '#fcfcfc',
20 20 ui_backdrop = '#000000',
21 21 ui_accent = '#5a265a',
22 22 ui_minor = '#242424',
21 21 ui_unfocus = '#0c1010',
22 22 ui_important_global = '#514a6c',
23 23 ui_important_local = '#2a2638',
24 -}

neovim/lua/bugabinga/nugu/palette_light.lua

Modified
4 4 return {
5 5 debug = '#ff00ff',
6 6 error = '#d6638b',
7 7 info = '#c7d0db',
8 8 warning = '#d9cbbb',
10 - content_normal = '#2b2b2b',
11 - content_backdrop = '#ededed',
12 - content_accent = '#750b75',
13 - content_minor = '#787878',
14 - content_focus = '#267b8e',
15 - content_unfocus = '#929292',
16 - content_important_global = '#553d98',
17 - content_important_local = '#8169c3',
10 + content_normal = '#050505',
11 + content_backdrop = '#fdfdfd',
12 + content_accent = '#a300a3',
13 + content_minor = '#525252',
14 + content_focus = '#017b9a',
15 + content_unfocus = '#40b8d6',
16 + content_important_global = '#4a25a9',
17 + content_important_local = '#4a25a9',
19 - ui_normal = '#1a1a1a',
19 + ui_normal = '#030303',
20 20 ui_backdrop = '#ffffff',
21 21 ui_accent = '#5a265a',
22 22 ui_minor = '#a3a3a3',
21 21 ui_unfocus = '#bdbdbd',
22 22 ui_important_global = '#897bb1',
23 23 ui_important_local = '#bab1d1',
24 -}

wezterm/bugabinga/code_fonts.csv

Modified
53 53 1,Luculent
54 54 3,Luxi Mono
55 55 1,M+ 1m
56 -14,M+ 1mn
56 +54,M+ 1mn
57 57 14,M+ 2m
58 58 1,Martian Mono
59 59 1,Mensch

wezterm/bugabinga/nugu/palette_dark.lua

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

yazi/plugins/ouch.yazi/README.md

Added
new file mode 100644
1 +# ouch.yazi
3 +[ouch](https://github.com/ouch-org/ouch) plugin for [Yazi](https://github.com/sxyazi/yazi).
5 +![ouch.yazi](https://github.com/ndtoan96/ouch.yazi/assets/33489972/946397ec-b37b-4bf4-93f1-c676fc8e59f2)
7 +## Features
8 +- Archive preview
9 +- Compression
11 +## Installation
13 +```bash
14 +# Linux/macOS
15 +git clone https://github.com/ndtoan96/ouch.yazi.git ~/.config/yazi/plugins/ouch.yazi
17 +# Windows
18 +git clone https://github.com/ndtoan96/ouch.yazi.git %AppData%\yazi\config\plugins\ouch.yazi
19 +```
21 +Make sure you have [ouch](https://github.com/ouch-org/ouch) installed and in your `PATH`.
23 +## Usage
25 +### Preview
26 +For archive preview, add this to your `yazi.toml`:
28 +```toml
29 +[plugin]
30 +prepend_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" },
39 +```
41 +Now 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.
43 +If 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
46 +For compession, add this to your `keymap.toml`:
48 +```toml
49 +[[manager.prepend_keymap]]
50 +on = ["C"]
51 +run = "plugin ouch --args=zip"
52 +desc = "Compress with ouch"
53 +```
55 +The `--args=zip` part tells the plugin that default format is `zip`. You can change that to whatever format you want.
57 +### Decompression
58 +This plugin does not provide a decompression feature because it already is supported by Yazi.
59 +To decompress with `ouch`, configure the opener in `yazi.toml`.
61 +```toml
62 +[opener]
63 +extract = [
64 + { run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
65 + { run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
67 +```

yazi/plugins/ouch.yazi/init.lua

Added
new file mode 100644
1 +local M = {}
3 +function 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
41 +end
43 +function 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
52 +end
54 +-- Check if file exists
55 +local 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
63 +end
65 +-- Get the files that need to be compressed and infer a default archive name
66 +local 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
87 +end)
89 +local 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
111 +end
113 +function 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)
141 +end
143 +return M