repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

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

b1f3fe131f7ecee1799f8566755dbdc38df184c2

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (7)

+234 / −124 text lines

Diff layout

helix/config.toml

Modified

+1 / −1 text lines

1theme = "nugu-dark"
1theme = "nugu-light"
33[editor]
44shell = ["nu", "--commands"]

neovim/lua/bugabinga/nugu/init.lua

Modified

+1 / −0 text lines

306306_['@tag'] = _.Tag
308308_['@markup.raw.block'] = _.PreProc
309_['@markup.raw.block.vimdoc'] = _.Normal
310311_['@lsp.type.namespace'] = _['@namespace']
311312_['@lsp.type.type'] = _['@type']

neovim/puck.lua

Modified

+179 / −108 text lines

1414-- TODO export some kind of structure
1515local dev = 'plugin_under_development'
1616local gh = 'plugin_from_github'
17local srht = 'plugin_from_srht'
18local cb = 'plugin_from_codeberg'
1719local gh_format = 'https://github.com/%s/archive/%s.tar.gz'
20local cb_format = 'https://codeberg.org/%s/archive/%s.tar.gz'
21local srht_format = 'https://git.sr.ht/%s/archive/%s.tar.gz'
19local as_name = function(plugin_coords)
20 return (plugin_coords):gsub('(%w+)%.?%w*', '%1')
23local plugins = {}
25local as_name = function ( plugin_coords )
26 return vim.fs.basename(plugin_coords):gsub( '(%w+)%.?%w*', '%1' )
2127end
23local download_plugin_into = function(plugin_tarball_url, plugin_install_path)
24 --TODO
29local download_plugin_into = function ( plugin_tarball_url, plugin_install_path )
31 assert(vim.fn.executable 'curl', 'curl not found')
32 assert(vim.fn.executable 'tar', 'tar not found')
34 vim.fn.mkdir( plugin_install_path, 'p' )
36 local tarball_data_stream = vim.uv.new_pipe(true)
37 local error_stream = vim.uv.new_pipe()
39 vim.uv.read_start(error_stream, function(err, data)
40 assert(not err, err)
41 if data then vim.notify(data, vim.log.levels.ERROR) end
42 end)
44 local curl_handle, curl_pid = vim.uv.spawn( 'curl',
45 {
46 args = { '--silent', '--location', plugin_tarball_url },
47 cwd = plugin_install_path,
48 stdio = {nil, tarball_data_stream, error_stream},
49 hide = true,
50 },
51 function(code, signal)
52 vim.print('curl done', code, signal)
53 end )
54 local tar_handle, tar_pid = vim.uv.spawn( 'tar',
55 {
56 args = { '--extract','--gzip', '--file', '-' },
57 cwd = plugin_install_path,
58 stdio = { tarball_data_stream, nil, error_stream},
59 hide = true,
60 },
61 function(code, signal)
62 vim.print('tar done', code, signal)
63 end )
65 print(curl_handle, curl_handle, tar_handle, tar_pid)
67 vim.uv.shutdown(tarball_data_stream, function()
68 vim.uv.close(curl_handle, function()
69 vim.print("curl closed")
70 end)
71 vim.uv.close(tar_handle, function()
72 vim.print("tar closed")
73 end)
74 end)
2675end
28local delete_directory_recursive = function(path)
29 local stat = vim.uv.fs_stat(path)
30 if stat and stat.type == "directory" then
31 local dir = vim.uv.fs_scandir(path)
32 if dir then
33 while true do
34 local name, type = vim.uv.fs_scandir_next(dir)
35 if not name then
36 break
37 end
39 local full_path = vim.fs.joinpath(path, name)
40 if type == "directory" then
41 return delete_directory_recursive(full_path)
42 else
43 return vim.uv.fs_unlink(full_path)
44 end
45 end
77local delete_directory_recursive = function ( path )
78 local stat = vim.uv.fs_stat( path )
79 if stat and stat.type == 'directory' then
80 local dir = vim.uv.fs_scandir( path )
81 if dir then
82 while true do
83 local name, type = vim.uv.fs_scandir_next( dir )
84 if not name then
85 break
4686 end
47 return vim.uv.fs_rmdir(path)
48 else
49 return false
88 local full_path = vim.fs.joinpath( path, name )
89 if type == 'directory' then
90 return delete_directory_recursive( full_path )
91 else
92 return vim.uv.fs_unlink( full_path )
93 end
94 end
5095 end
96 return vim.uv.fs_rmdir( path )
97 else
98 return false
99 end
52 return true
101 return true
53102end
55local install_plugin = function(puck_root, plugin_type, plugin_coords, plugin_rev)
56 local plugin_name = as_name(plugin_coords)
57 local plugin_install_path = vim.fs.normalize(vim.fs.joinpath(puck_root, plugin_name))
58 local plugin_install_path_stat = vim.uv.fs_stat(plugin_install_path)
59 local plugin_already_exists = plugin_install_path_stat and plugin_install_path_stat.type == 'directory'
61 local plugin_install_rev_path = vim.fs.normalize(puck_root, plugin_name .. '.rev')
63 -- either do nothing or update/fresh install
64 if(vim.uv.fs_access(plugin_install_rev_path,'R') then
65 local current_rev = io:open(plugin_install_rev_path, 'r'):read()
66 if current_rev == plugin_rev then return end
67 end
68 -- rev is different, must be update (we don`t care if up or down) or fresh install
69 local removed = delete_directory_recursive(plugin_install_path)
70 local plugin_tarball_url = gh_format:format(plugin_coords, plugin_rev)
71 local ok = xpcall(download_plugin_into,plugin_tarball_url, plugin_install_path)
72 if ok then
73 io.open(plugin_install_rev_path, 'w+'):write(plugin_rev)
74 if removed then
75 vim.notify('Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' updated!', vim.log.levels.INFO)
76 else
77 vim.notify('Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' installed!', vim.log.levels.INFO)
78 end
80 else
81 vim.notify('Failed to download tarball for plugin ' .. plugin_coords .. '@' .. plugin_rev ..'!', vim.log.levels.ERROR)
82 end
104local as_url_format = function(plugin_type)
105 assert(plugin_type ~= dev, 'local plugins need not have an url format!')
106 if plugin_type == gh then return gh_format end
107 if plugin_type == cb then return cb_format end
108 if plugin_type == srht then return srht_format end
110 error('unknown plugin type '..plugin_type..' given.')
84111end
86local delete_unused_plugins = function(puck_root) end
113local install_plugin = function ( puck_root, plugin_type, plugin_coords, plugin_rev )
114 local plugin_name = as_name( plugin_coords )
115 local plugin_install_path = vim.fs.normalize( vim.fs.joinpath( puck_root, plugin_name ) ) --TODO unused?
116 local plugin_install_path_stat = vim.uv.fs_stat( plugin_install_path )
117 local plugin_already_exists = plugin_install_path_stat and plugin_install_path_stat.type == 'directory'
88local register_local_plugin = function(plugin_coords)
89 local plugin_path = vim.fs.normalize(plugin_coords)
90 local plugin_path_stat = vim.uv.fs_stat(plugin_path)
119 local plugin_install_rev_path = vim.fs.normalize( vim.fs.joinpath(puck_root, plugin_name .. '.rev' ))
92 if( plugin_path_stat and plugin_path_stat.type == 'directory') then
93 vim.opt.runtimepath:prepend(plugin_path)
94 else
95 vim.notify('Failed to load local plugin ' .. plugin_path .. '!',vim.log.levels.ERROR)
96 end
121 -- either do nothing or update/fresh install
122 if (vim.uv.fs_access( plugin_install_rev_path, 'R' )) then
123 local plugin_install_rev_file = io.open( plugin_install_rev_path, 'r' )
124 if not plugin_install_rev_file then vim.notify('Unable to read rev file ' .. plugin_install_rev_path, vim.log.levels.ERROR) end
125 local current_rev = plugin_install_rev_file:read()
126 plugin_install_rev_file:close()
127 if current_rev == plugin_rev then return end
128 end
129 -- rev is different, must be update (we don`t care if up or down) or fresh install
130 local removed = delete_directory_recursive( plugin_install_path )
131 local url_format = as_url_format(plugin_type)
132 local plugin_tarball_url = url_format:format( plugin_coords, plugin_rev )
133 local ok = pcall( download_plugin_into, plugin_tarball_url, puck_root )
134 if ok then
135 local mode = vim.uv.fs_access(plugin_install_rev_path, 'W') and 'w+' or 'w'
136 local plugin_install_rev_file = io.open( plugin_install_rev_path, mode)
137 if not plugin_install_rev_file then vim.notify('Unable to write rev file ' .. plugin_install_rev_path, vim.log.levels.ERROR) end
138 plugin_install_rev_file:write( plugin_rev )
139 plugin_install_rev_file:close()
140 if removed then
141 vim.notify( 'Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' updated!', vim.log.levels.INFO )
142 else
143 vim.notify( 'Plugin ' .. plugin_coords .. '@' .. plugin_rev .. ' installed!', vim.log.levels.INFO )
144 end
145 else
146 vim.notify( 'Failed to download tarball for plugin ' .. plugin_coords .. '@' .. plugin_rev .. '!',
147 vim.log.levels.ERROR )
148 end
97149end
99local load_local_plugin = function(plugin_coords)
100 local plugin_name = as_name(plugin_coords)
101 local plugin_init = {}
102 vim.tbl_extend('keep',plugin_init, vim.api.nvim_get_runtime_file('plugin/' .. plugin_name .. '.vim', false ))
103 vim.tbl_extend('keep',plugin_init, vim.api.nvim_get_runtime_file('plugin/' .. plugin_name .. '.lua', false ))
104 for _, init in pairs(plugin_init) do
105 vim.cmd.source(init)
106 end
151local delete_unused_plugins = function ( puck_root ) end
153local register_local_plugin = function ( workspace, plugin_coords )
154 local plugin_path = vim.fs.normalize( vim.fs.joinpath(workspace, vim.fs.basename(plugin_coords) ) )
155 local plugin_path_stat = vim.uv.fs_stat( plugin_path )
157 if (plugin_path_stat and plugin_path_stat.type == 'directory') then
158 vim.opt.runtimepath:prepend( plugin_path )
159 else
160 vim.notify( 'Failed to load local plugin ' .. plugin_path .. '!', vim.log.levels.ERROR )
161 end
107162end
109local load_registered_plugin = function(plugin_name)
110 -- TODO
164local load_local_plugin = function ( plugin_coords )
165 local plugin_name = as_name( plugin_coords )
166 local plugin_init = {}
167 vim.tbl_extend( 'keep', plugin_init, vim.api.nvim_get_runtime_file( 'plugin/' .. plugin_name .. '.vim', false ) )
168 vim.tbl_extend( 'keep', plugin_init, vim.api.nvim_get_runtime_file( 'plugin/' .. plugin_name .. '.lua', false ) )
169 for _, init in pairs( plugin_init ) do
170 vim.cmd.source( init )
171 end
111172end
113local setup = function(options)
114 options = options or {}
115 options.plugins = options.plugins or {}
116 -- take control of loading plugins.
117 -- that means we have to take care of builtin plugins later
118 vim.opt.loadplugins = false
174local load_registered_plugin = function ( plugin_name )
175 -- TODO
176end
120 local puck_root = vim.fs.normalize(vim.fn.stdpath 'data' .. '/site/pack/puck')
121 vim.fn.mkdir(puck_root, 'p')
178local setup = function ( options )
179 options = options or {}
180 vim.validate { ['options.workspace'] = { options.workspace, 'string'}}
123 for _, plugin in pairs(plugins) do
124 local plugin_type = plugin[1]
125 local plugin_coords = plugin[2]
126 local plugin_rev = plugin[3]
127 if plugin_type == dev then
128 register_local_plugin(plugin_coords)
129 else
130 install_plugin(puck_root, plugin_type, plugin_coords, plugin_rev)
131 end
132 end
182 options.plugins = options.plugins or {}
183 plugins = options.plugins
184 -- take control of loading plugins.
185 -- that means we have to take care of builtin plugins later
186 vim.opt.loadplugins = false
134 delete_unused_plugins(puck_root)
188 local puck_root = vim.fs.normalize( vim.fn.stdpath 'data' .. '/site/pack/puck' )
189 vim.fn.mkdir( puck_root, 'p' )
136 -- manually load builtin plugins, that we disabled earlier
137 -- loads only a subset of builtins, that i find useful.
138 load_local_plugin 'plugin/shada.vim'
139 load_local_plugin 'plugin/tutor.vim'
140 load_local_plugin 'plugin/spellfile.vim'
141 load_local_plugin 'plugin/osc52.lua'
142 -- can this be useful on win32?
143 -- load_local_plugin 'plugin/man.lua'
144 load_local_plugin 'plugin/editorconfig.lua'
191 for _, plugin in pairs( plugins ) do
192 local plugin_type = plugin[1]
193 local plugin_coords = plugin[2]
194 local plugin_rev = plugin[3]
195 if plugin_type == dev then
196 register_local_plugin(options.workspace, plugin_coords )
197 else
198 install_plugin( puck_root, plugin_type, plugin_coords, plugin_rev )
199 end
200 end
202 delete_unused_plugins( puck_root )
204 -- manually load builtin plugins, that we disabled earlier
205 -- loads only a subset of builtins, that i find useful.
206 load_local_plugin 'plugin/shada.vim'
207 load_local_plugin 'plugin/tutor.vim'
208 load_local_plugin 'plugin/spellfile.vim'
209 load_local_plugin 'plugin/osc52.lua'
210 -- can this be useful on win32?
211 -- load_local_plugin 'plugin/man.lua'
212 load_local_plugin 'plugin/editorconfig.lua'
145213end
147215-- TODO move this outside
148216-- testing the puck
149217local plugins = {
150 { dev , '~\\Workspaces\\venn.nvim' },
151 { gh, 'nyoom-engineering/oxocarbon.nvim', 'c5846d10cbe4131cc5e32c6d00beaf59cb60f6a2' },
218 { dev, 'bugabinga/venn.nvim', },
219 { gh, 'nyoom-engineering/oxocarbon.nvim', 'c5846d10cbe4131cc5e32c6d00beaf59cb60f6a2', },
220 { srht, '~adigitoleo/haunt.nvim', 'e3e3c8f45663fed8225ba5efb0af00a2df14a736', },
221 { cb, 'jthvai/lavender.nvim', 'a5187e6f4afe4b1f2fbcd0fe0bad34c40002ba48', },
222 { dev, 'bugabinga/auto-dark-mode.nvim', nil, },
153setup { plugins = plugins }
154load_registered_plugin'oxocarbon'
155vim.cmd.colorscheme'oxocarbon'
224setup { plugins = plugins, workspace = '~/Workspace'} -- TODO change Workspace on win32
225load_registered_plugin 'oxocarbon'
226vim.cmd.colorscheme 'oxocarbon'
157228return {
158 load = load_registered_plugin,
159 setup = setup,
229 load = load_registered_plugin,
230 setup = setup,

nushell/gen-aliases.nu

Added
new file mode 100644

+20 / −0 text lines

1#!/usr/bin/env nu
2
3let file = $"($nu.default-config-dir)/aliases.nu"
4
5def save-alias [...args: string] {
6 $"alias ($args | str join ' ')\n" | save -a $file
7}
8
9'' | save -f $file
11########################################
12# Start defining your aliases here
14if not (which bat | is-empty) {
15 save-alias cat = bat
16}
18if not (which bsdtar | is-empty) {
19 save-alias tar = bsdtar
20}

wezterm/bugabinga/key_binds.lua

Modified

+20 / −5 text lines

2020 { key = 'Escape', action = 'PopKeyTable' },
2121 },
2222 [font_size_mode] = {
23 { key = '+', mods = 'SHIFT', action = wez.action.IncreaseFontSize },
23 { key = '+', action = wez.action.IncreaseFontSize },
2424 { key = '-', action = wez.action.DecreaseFontSize },
2525 { key = '=', action = wez.action.ResetFontSize },
3535 { key = 'v', action = wez.action.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
3636 { key = 's', action = wez.action.SplitVertical { domain = 'CurrentPaneDomain' }, },
38 { key = 'r', action = wez.action.ActivateKeyTable { name = resize_pane_mode, one_shot = false } },
38 { key = '=', action = wez.action.ActivateKeyTable { name = resize_pane_mode, one_shot = false } },
40 { key = 'q', action = wez.action.CloseCurrentPane { confirm = true } },
40 { key = 'q', action = wez.action.CloseCurrentPane { confirm = false } },
4242 { key = 'Escape', action = 'PopKeyTable' },
4343 },
138138 action = wez.action.ActivateCommandPalette,
139139 },
140140 {
141 key = 'p',
142 mods = 'LEADER|SHIFT',
141 key = 'c',
142 mods = 'LEADER',
143 action = wez.action.SwitchToWorkspace { name = 'code' },
144 },
145 {
146 key = 'k',
147 mods = 'LEADER',
148 action = wez.action.SwitchToWorkspace { name = 'dorkfiles editing' },
149 },
150 {
151 key = 'd',
152 mods = 'LEADER',
153 action = wez.action.SwitchToWorkspace { name = 'default' },
154 },
155 {
156 key = 'r',
157 mods = 'LEADER',
143158 action = wez.action.ShowLauncherArgs {
144159 flags = 'FUZZY|WORKSPACES',
145160 },

wezterm/nerdfonts

Modified

+9 / −9 text lines

1IBM 3270
1Bitstream Vera Sans Mono
2# Terminus
23Anonymous Pro
34Aurulent Sans Mono
4BigBlueTerminalPlus
5Bitstream Vera Sans Mono
6IBM Plex Mono
5# BigBlueTerminalPlus
76Cascadia Code
87Cousine
98D2Coding
1110Droid Sans Mono
1211Envy Code R
1312Fantasque Sans Mono
14FiraCode
13# FiraCode
1514GeistMono
1615Hack
1716Hasklig
1817Hermit
19iA Writer Mono V
20Inconsolata
18IBM 3270
19IBM Plex Mono
20# Inconsolata
2121Intel One Mono
2222JetBrainsMono
2323Lekton
24Liberation Mono
24# Liberation Mono
2525Lilex
2626MartianMono
2727Monaspace Argon Var
3535RobotoMono
3636Share Tech Mono
3737Source Code Pro
38Terminus
3938VictorMono
39iA Writer Mono V

wezterm/wezterm.lua

Modified

+4 / −1 text lines

11local wez = require 'wezterm'
22local nugu = require 'bugabinga.nugu'
4local win32 = wez.target_triple:find 'windows'
45local key_binds = require 'bugabinga.key_binds'
56local auto_dark_mode = require 'bugabinga.auto_dark_mode'
67local workspaces = require 'bugabinga.workspaces'
2526 local nerdfonts = io.open(wez.config_dir .. '/nerdfonts', 'r')
2627 if nerdfonts then
2728 for font_name in nerdfonts:lines() do
28 table.insert(font_names, font_name)
29 if not font_name:match '^#.*' then
30 table.insert(font_names, font_name)
31 end
2932 end
3033 local random_font = font_names[math.random(#font_names)]
3134 font = wez.font(random_font)