repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

feat(wezterm): add navigation bindings and project checks

dcc240bdabd823d6f4144931a634a665af1146d9

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (20)

neovim/puk.nu

Modified
243 243 let tmp_path = mktemp --directory
244 244 # hopefully strip-componets works on win32 as well
245 245 print $archive_path $tmp_path
246 - tar --extract --file $archive_path --directory $tmp_path --strip-components=1
246 + let tar_command = if (sys host | get name) =~ 'Windows' {
247 + [$env.SystemRoot System32 tar.exe] | path join
248 + } else { 'tar' }
249 + let tar_args = [--extract --file $archive_path --directory $tmp_path --strip-components=1]
250 + run-external $tar_command ...$tar_args
248 252 if $spec.build != null {
249 253 print $"Build step for plugin ($spec.name) detected! Executing now..."

neovim/puk.plugins.nuon

Modified
16 16 [nvim-surround, github, kylechui/nvim-surround, main, "8b47db616ef658b8fc27e61db2896aa2f40134de", null],
17 17 [conform, github, "stevearc/conform.nvim", master, "016802de402556da54c36bd7359b441266b01cdd", null],
18 18 [plenary, github, "nvim-lua/plenary.nvim", master, "74b06c6c75e4eeb3108ec01852001636d85a932b", null],
19 + [wezterm-types, github, "DrKJeff16/wezterm-types", main, "e40662a318c89284402f7f18e6e447b1c7fc1476", null],
19 20 ["mini.splitjoin", github, "echasnovski/mini.splitjoin", main, "9301717c7612ccb72e89629df89416585dd54c9b", null],
20 21 ["mini.pick", github, "echasnovski/mini.pick", main, "360c1bb33610e030698d07ed15969ab4762dbcd6", null],
21 22 ["mini.extra", github, "echasnovski/mini.extra", main, "9c6affac2b176142f48b185bd7abc5db7ec20ac8", null],

nushell/config.nu

Modified
65 65 $env.config.cursor_shape.vi_insert = "line"
66 66 $env.config.cursor_shape.vi_normal = "block"
67 67 $env.config.float_precision = 3
68 -# unfortunately, osc9_9 seems to be buggy on win32 with wezterm
69 -$env.config.shell_integration.osc133 = ($nu.os-info.family | str contains "unix")
68 +$env.config.shell_integration.osc133 = true
70 69 $env.config.highlight_resolved_externals = true
71 70 $env.config.use_kitty_protocol = (not $env.WIN32)
72 71 $env.config.history.file_format = "sqlite"

wezterm/.lsp.settings.lua

Deleted
deleted file mode 100644
1 -return {
2 - LuaLS = {
3 - Lua = {
4 - runtime = { version = 'Lua 5.4', },
5 - },
6 - },
7 -}

wezterm/.luarc.jsonc

Added
new file mode 100644
1 +{
2 + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
3 + "runtime.version": "Lua 5.4",
4 + "hint.enable": true,
5 + "hint.setType": true,
6 + "workspace.checkThirdParty": false,
7 + "workspace.library": [
8 + "${env:LOCALAPPDATA}/nvim-data/site/pack/puk/opt/wezterm-types",
9 + "${env:XDG_DATA_HOME}/nvim/site/pack/puk/opt/wezterm-types",
10 + "${env:HOME}/.local/share/nvim/site/pack/puk/opt/wezterm-types"
11 + ]

wezterm/bugabinga/agent.lua

Modified
22 22 value = clean( value )
23 23 if not value then return nil end
24 24 value = value:gsub( '\\', '/' )
25 - return value:match( '([^/]+)$' ) or value
25 + return value:match '([^/]+)$' or value
28 28 local function program( user_vars )
29 29 local command = clean( user_vars and user_vars.WEZTERM_PROG )
30 30 if not command then return nil end
31 31 command = command:gsub( '^%^', '' )
32 - local executable = basename( command:match( '^([^%s]+)' ) )
32 + local executable = basename( command:match '^([^%s]+)' )
33 33 return executable and executable:lower():gsub( '%.exe$', '' ):gsub( '%.cmd$', '' ):gsub( '%.bat$', '' ) or nil

wezterm/bugabinga/exec_domains.lua

Modified
1 1 local wez = require 'wezterm'
3 -local function append_all(dst, src)
4 - for _, value in ipairs(src) do
5 - table.insert(dst, value)
3 +local function append_all( dst, src )
4 + for _, value in ipairs( src ) do
5 + table.insert( dst, value )
9 -local function scoped_domain(name, label, properties)
10 - return wez.exec_domain(name, function(cmd)
11 - local args = cmd.args or { 'nu', '--login' }
12 - local env = cmd.set_environment_variables or {}
13 - env.WEZTERM_EXEC_DOMAIN = name
14 - cmd.set_environment_variables = env
15 - local unit = 'wezterm-' .. name:gsub('[^%w_.-]', '-') .. '-' .. tostring(env.WEZTERM_PANE or os.time())
16 - local wrapped = {
17 - 'systemd-run',
18 - '--user',
19 - '--scope',
20 - '--same-dir',
21 - '--collect',
22 - '--quiet',
23 - '--unit=' .. unit,
24 - '--description=WezTerm ' .. name,
25 - }
9 +local function scoped_domain( name, label, properties )
10 + return wez.exec_domain( name, function ( cmd )
11 + local args = cmd.args or { 'nu', '--login', }
12 + local env = cmd.set_environment_variables or {}
13 + env.WEZTERM_EXEC_DOMAIN = name
14 + cmd.set_environment_variables = env
15 + local unit = 'wezterm-' ..
16 + name:gsub( '[^%w_.-]', '-' ) .. '-' .. tostring( env.WEZTERM_PANE or os.time() )
17 + local wrapped = {
18 + 'systemd-run',
19 + '--user',
20 + '--scope',
21 + '--same-dir',
22 + '--collect',
23 + '--quiet',
24 + '--unit=' .. unit,
25 + '--description=WezTerm ' .. name,
26 + }
27 - for _, property in ipairs(properties) do
28 - table.insert(wrapped, '-p')
29 - table.insert(wrapped, property)
30 - end
28 + for _, property in ipairs( properties ) do
29 + table.insert( wrapped, '-p' )
30 + table.insert( wrapped, property )
31 + end
32 - append_all(wrapped, args)
33 - cmd.args = wrapped
34 - return cmd
35 - end, label)
33 + append_all( wrapped, args )
34 + cmd.args = wrapped
35 + return cmd
36 + end, label )
38 -return function(cfg)
39 +return function ( cfg )
40 + ---@cast cfg Config
39 41 if not wez.target_triple:find( 'linux', 1, true ) then return end
41 43 cfg.exec_domains = {
42 - scoped_domain('scope:build', 'scope:build CPU 25% MEM max 256M', {
44 + scoped_domain( 'scope:build', 'scope:build CPU 25% MEM max 256M', {
43 45 'CPUQuota=25%',
44 46 'MemoryMax=256M',
45 47 'MemorySwapMax=0',
46 48 'OOMPolicy=stop',
47 - }),
49 + } ),

wezterm/bugabinga/instances.lua

Modified
25 25 local ok, rows = pcall( wez.json_parse, stdout )
26 26 if not ok or type( rows ) ~= 'table' then
27 - wez.log_error( 'invalid WezTerm GUI instance list' )
27 + wez.log_error 'invalid WezTerm GUI instance list'
28 28 return nil
30 30 return rows
49 49 local function parse_target_id( id )
50 - local gui_pid, pane_id = id:match( '^niri:(%d+):(%d+)$' )
50 + local gui_pid, pane_id = id:match '^niri:(%d+):(%d+)$'
51 51 return tonumber( gui_pid ), tonumber( pane_id )

wezterm/bugabinga/key_binds.lua

Modified
7 7 leader = { key = 'raw:255', }
9 9 local font_mode = ' Font mode (- + 0) ESC to exit'
10 -local pane_mode = ' Pane (hjklaqrvsrR=q HL)'
11 -local resize_pane_mode = ( wez.nerdfonts.md_resize or '↔' ) .. ' Resize Pane (hjkl HJKL)'
10 +local pane_mode = ' Pane (hjkl a v s x t c r R = q H L)'
11 +local resize_pane_mode = (wez.nerdfonts.md_resize or '↔') .. ' Resize Pane (hjkl HJKL)'
13 +local confirm_quit = wez.action.Confirmation {
14 + message = 'Quit WezTerm?',
15 + action = wez.action_callback( function ( window, pane )
16 + window:perform_action( wez.action.QuitApplication, pane )
17 + end ),
20 +local open_url = wez.action.QuickSelectArgs {
21 + label = 'open URL',
22 + patterns = { 'https?://[^"\'<>\\s]+', },
23 + action = wez.action_callback( function ( window, pane )
24 + local url = window:get_selection_text_for_pane( pane )
25 + if url ~= '' then wez.open_with( url ) end
26 + end ),
29 +local rename_tab = wez.action.PromptInputLine {
30 + description = 'Enter a new tab name, or leave empty to reset it',
31 + action = wez.action_callback( function ( window, _, line )
32 + if line then window:active_tab():set_title( line ) end
33 + end ),
13 36 local key_tables = {
14 37 [resize_pane_mode] = {
25 48 { key = 'Escape', action = 'PopKeyTable', },
27 50 [font_mode] = {
28 - { key = 'Minus', action = wez.action.DecreaseFontSize, },
29 - { key = 'Equal', action = wez.action.IncreaseFontSize, },
30 - { key = '0', action = wez.action.ResetFontSize, },
51 + { key = 'Minus', action = wez.action.DecreaseFontSize, },
52 + { key = 'Equal', action = wez.action.IncreaseFontSize, },
53 + { key = '0', action = wez.action.ResetFontSize, },
32 - { key = 'Escape', action = 'PopKeyTable', },
55 + { key = 'Escape', action = 'PopKeyTable', },
34 57 [pane_mode] = {
35 58 { key = 'h', action = wez.action.ActivatePaneDirection 'Left', },
44 67 { key = 'r', action = wez.action.RotatePanes 'CounterClockwise', },
45 68 { key = 'R', action = wez.action.RotatePanes 'Clockwise', },
69 + { key = 'x', action = wez.action.PaneSelect { mode = 'SwapWithActiveKeepFocus', }, },
70 + { key = 't', action = wez.action.PaneSelect { mode = 'MoveToNewTab', }, },
71 + { key = 'c', action = rename_tab, },
46 72 { key = '=', action = wez.action.ActivateKeyTable { name = resize_pane_mode, one_shot = false, }, },
47 73 { key = 'H', action = wez.action.MoveTabRelative( -1 ), },
48 74 { key = 'L', action = wez.action.MoveTabRelative( 1 ), },
117 143 mods = 'LEADER',
118 144 action = wez.action.PromptInputLine {
119 145 description = wez.format {
146 + ---@diagnostic disable-next-line: missing-fields
120 147 { Attribute = { Intensity = 'Bold', }, },
121 148 { Foreground = { AnsiColor = 'Purple', }, },
122 149 { Text = 'New workspace:', },
174 201 action = wez.action_callback( function ( window, pane )
175 202 window:perform_action(
176 203 pane:is_alt_screen_active()
177 - and wez.action.SendKey { key = 'PageUp', }
178 - or wez.action.ScrollByLine( -1 ),
204 + and wez.action.SendKey { key = 'PageUp', }
205 + or wez.action.ScrollByLine( -1 ),
181 208 end ),
185 212 action = wez.action_callback( function ( window, pane )
186 213 window:perform_action(
187 214 pane:is_alt_screen_active()
188 - and wez.action.SendKey { key = 'PageDown', }
189 - or wez.action.ScrollByLine( 1 ),
215 + and wez.action.SendKey { key = 'PageDown', }
216 + or wez.action.ScrollByLine( 1 ),
192 219 end ),
197 224 action = wez.action_callback( function ( window, pane )
198 225 window:perform_action(
199 226 pane:is_alt_screen_active()
200 - and wez.action.SendKey { key = 'PageUp', mods = 'SHIFT', }
201 - or wez.action.ScrollByPage( -0.42 ),
227 + and wez.action.SendKey { key = 'PageUp', mods = 'SHIFT', }
228 + or wez.action.ScrollByPage( -0.42 ),
204 231 end ),
209 236 action = wez.action_callback( function ( window, pane )
210 237 window:perform_action(
211 238 pane:is_alt_screen_active()
212 - and wez.action.SendKey { key = 'PageDown', mods = 'SHIFT', }
213 - or wez.action.ScrollByPage( 0.42 ),
239 + and wez.action.SendKey { key = 'PageDown', mods = 'SHIFT', }
240 + or wez.action.ScrollByPage( 0.42 ),
216 243 end ),
220 247 mods = 'LEADER',
221 248 action = wez.action.ShowLauncherArgs {
222 249 title = '🔭 Launcher',
223 - flags = 'FUZZY|DOMAINS|KEY_ASSIGNMENTS|COMMANDS',
250 + flags = 'FUZZY|DOMAINS|KEY_ASSIGNMENTS|COMMANDS|TABS',
262 289 key = ' ',
263 290 mods = 'LEADER',
264 - action = wez.action.QuickSelect,
291 + action = open_url,
267 294 key = 'Enter',
268 295 mods = 'LEADER',
269 296 action = wez.action.QuickSelect,
299 + key = 'v',
300 + mods = 'LEADER',
301 + action = wez.action.ActivateCopyMode,
302 + },
304 + key = 'UpArrow',
305 + mods = 'LEADER',
306 + action = wez.action.ScrollToPrompt( -1 ),
307 + },
309 + key = 'DownArrow',
310 + mods = 'LEADER',
311 + action = wez.action.ScrollToPrompt( 1 ),
312 + },
272 314 key = 'q',
273 315 mods = 'LEADER',
274 - action = wez.action.QuitApplication,
316 + action = confirm_quit,
288 330 return function ( cfg )
331 + ---@cast cfg Config
289 332 cfg.disable_default_key_bindings = true
290 333 cfg.leader = leader
291 334 cfg.keys = keys

wezterm/bugabinga/launch.lua

Modified
1 1 local wez = require 'wezterm'
3 3 return function ( cfg )
4 + ---@cast cfg Config
4 5 local launch_menu = {
6 7 label = 'Anime (new)',

wezterm/bugabinga/mouse_binds.lua

Modified
3 3 local wez = require 'wezterm'
5 5 local bindings = {
6 6 -- Wheel: scroll 1 line per tick
8 - event = { Down = { streak = 1, button = { WheelUp = 1 } } },
8 + event = { Down = { streak = 1, button = { WheelUp = 1, }, }, },
9 9 mods = 'NONE',
10 - action = wez.action.ScrollByLine(-1),
10 + action = wez.action.ScrollByLine( -1 ),
13 - event = { Down = { streak = 1, button = { WheelDown = 1 } } },
13 + event = { Down = { streak = 1, button = { WheelDown = 1, }, }, },
14 14 mods = 'NONE',
15 - action = wez.action.ScrollByLine(1),
15 + action = wez.action.ScrollByLine( 1 ),
17 17 -- SHIFT+Wheel: scroll normal-screen scrollback 5 lines
19 - event = { Down = { streak = 1, button = { WheelUp = 1 } } },
19 + event = { Down = { streak = 1, button = { WheelUp = 1, }, }, },
20 20 mods = 'SHIFT',
21 21 alt_screen = false,
22 - action = wez.action.ScrollByLine(-5),
22 + action = wez.action.ScrollByLine( -5 ),
25 - event = { Down = { streak = 1, button = { WheelDown = 1 } } },
25 + event = { Down = { streak = 1, button = { WheelDown = 1, }, }, },
26 26 mods = 'SHIFT',
27 27 alt_screen = false,
28 - action = wez.action.ScrollByLine(5),
28 + action = wez.action.ScrollByLine( 5 ),
30 30 -- SHIFT+Wheel: send 5 line-scroll keys to mouse-aware alternate-screen apps
32 - event = { Down = { streak = 1, button = { WheelUp = 1 } } },
32 + event = { Down = { streak = 1, button = { WheelUp = 1, }, }, },
33 33 mods = 'SHIFT',
34 34 alt_screen = true,
35 35 mouse_reporting = true,
43 - event = { Down = { streak = 1, button = { WheelDown = 1 } } },
43 + event = { Down = { streak = 1, button = { WheelDown = 1, }, }, },
44 44 mods = 'SHIFT',
45 45 alt_screen = true,
46 46 mouse_reporting = true,
60 60 -- CTRL+Wheel: font size
62 - event = { Down = { streak = 1, button = { WheelUp = 1 }, }, },
62 + event = { Down = { streak = 1, button = { WheelUp = 1, }, }, },
63 63 mods = 'CTRL',
64 64 action = wez.action.IncreaseFontSize,
67 - event = { Down = { streak = 1, button = { WheelDown = 1 }, }, },
67 + event = { Down = { streak = 1, button = { WheelDown = 1, }, }, },
68 68 mods = 'CTRL',
69 69 action = wez.action.DecreaseFontSize,
72 72 return function ( cfg )
73 + ---@cast cfg Config
73 74 cfg.mouse_bindings = bindings

wezterm/bugabinga/nugu/init.lua

Modified
24 24 split = palette.ui.unfocus,
25 25 ansi = {
26 26 -- Predictable ANSI 0-7 for general terminal applications.
27 - palette.content.backdrop, -- Index 0: BLACK (terminal background)
28 - palette.error, -- Index 1: RED (error)
29 - palette.content.focus, -- Index 2: GREEN (success/focus)
30 - palette.warning, -- Index 3: YELLOW (warning)
31 - palette.content.important_local, -- Index 4: BLUE (link/primary)
32 - palette.content.accent, -- Index 5: MAGENTA (accent)
33 - palette.info, -- Index 6: CYAN (info)
34 - palette.content.normal, -- Index 7: WHITE (terminal foreground)
27 + palette.content.backdrop, -- Index 0: BLACK (terminal background)
28 + palette.error, -- Index 1: RED (error)
29 + palette.content.focus, -- Index 2: GREEN (success/focus)
30 + palette.warning, -- Index 3: YELLOW (warning)
31 + palette.content.important_local, -- Index 4: BLUE (link/primary)
32 + palette.content.accent, -- Index 5: MAGENTA (accent)
33 + palette.info, -- Index 6: CYAN (info)
34 + palette.content.normal, -- Index 7: WHITE (terminal foreground)
36 36 brights = {
37 37 -- Predictable ANSI 8-15. Nugu-specific UI colors live in indexed 16+.
38 - palette.content.minor, -- Index 8: BRIGHT BLACK (muted)
39 - palette.error, -- Index 9: BRIGHT RED
40 - palette.ui.focus, -- Index 10: BRIGHT GREEN
41 - palette.warning, -- Index 11: BRIGHT YELLOW
42 - palette.content.important_global, -- Index 12: BRIGHT BLUE
43 - palette.ui.accent, -- Index 13: BRIGHT MAGENTA
44 - palette.ui.important_local, -- Index 14: BRIGHT CYAN
45 - palette.ui.important_global, -- Index 15: BRIGHT WHITE
38 + palette.content.minor, -- Index 8: BRIGHT BLACK (muted)
39 + palette.error, -- Index 9: BRIGHT RED
40 + palette.ui.focus, -- Index 10: BRIGHT GREEN
41 + palette.warning, -- Index 11: BRIGHT YELLOW
42 + palette.content.important_global, -- Index 12: BRIGHT BLUE
43 + palette.ui.accent, -- Index 13: BRIGHT MAGENTA
44 + palette.ui.important_local, -- Index 14: BRIGHT CYAN
45 + palette.ui.important_global, -- Index 15: BRIGHT WHITE
47 47 -- Nugu semantic extras for apps explicitly coupled to this palette.
48 48 indexed = {
49 - [16] = palette.debug, -- nugu semantic: debug
50 - [17] = palette.ui.normal, -- nugu semantic: ui.normal
51 - [18] = palette.ui.backdrop, -- nugu semantic: ui.backdrop
52 - [19] = palette.ui.minor, -- nugu semantic: ui.minor
53 - [20] = palette.ui.focus, -- nugu semantic: ui.focus
54 - [21] = palette.ui.unfocus, -- nugu semantic: ui.unfocus
55 - [22] = palette.content.unfocus, -- nugu semantic: content.unfocus
49 + [16] = palette.debug, -- nugu semantic: debug
50 + [17] = palette.ui.normal, -- nugu semantic: ui.normal
51 + [18] = palette.ui.backdrop, -- nugu semantic: ui.backdrop
52 + [19] = palette.ui.minor, -- nugu semantic: ui.minor
53 + [20] = palette.ui.focus, -- nugu semantic: ui.focus
54 + [21] = palette.ui.unfocus, -- nugu semantic: ui.unfocus
55 + [22] = palette.content.unfocus, -- nugu semantic: content.unfocus
57 57 -- When the IME, a dead key or a leader key are being processed and are effectively
58 58 -- holding input pending the result of input composition, change the cursor

wezterm/bugabinga/options.lua

Modified
1 1 local wez = require 'wezterm'
3 3 return function ( cfg )
4 + ---@cast cfg Config
4 5 cfg.inactive_pane_hsb = {
5 6 saturation = 0.42,
6 7 brightness = 0.69,
19 20 cfg.unzoom_on_switch_pane = true
22 + if wez.target_triple:find( 'windows', 1, true ) then
23 + -- OpenGL causes rendering artifacts on Win32.
24 + cfg.front_end = 'WebGpu'
25 + end
21 27 if wez.hostname() == 'x230' then
22 28 cfg.font_size = 11
23 29 else

wezterm/bugabinga/startup.lua

Modified
1 1 local wez = require 'wezterm'
3 3 return function ( cfg )
4 + ---@cast cfg Config
4 5 cfg.default_prog = { 'nu', '--login', }
5 6 if wez.target_triple:find( 'windows', 1, true ) then
6 - cfg.set_environment_variables = { LANG = 'en_US.UTF-8' }
7 + cfg.set_environment_variables = { LANG = 'en_US.UTF-8', }
7 8 end
8 9 end

wezterm/bugabinga/status.lua

Modified
2 2 local wez = require 'wezterm'
3 3 local bat = require 'bugabinga.battery'
4 4 local agent = require 'bugabinga.agent'
6 +---@diagnostic disable-next-line: different-requires
6 7 local nugu_dark = require 'bugabinga.nugu.palette_dark'.palette
8 +---@diagnostic disable-next-line: different-requires
7 9 local nugu_light = require 'bugabinga.nugu.palette_light'.palette
8 10 local palette = nugu_dark
15 17 claude = wez.nerdfonts.md_robot_outline,
16 18 cmus = wez.nerdfonts.md_music,
17 19 code = wez.nerdfonts.custom_neovim,
18 - codex = wez.nerdfonts.cod_openai,
20 + codex = '',
19 21 edit = wez.nerdfonts.custom_neovim,
20 22 fd = wez.nerdfonts.md_folder_search_outline,
21 23 fin = wez.nerdfonts.md_magnify,
74 76 local basename = function ( value )
75 77 if not value or value == '' then return nil end
76 78 value = value:gsub( '\\', '/' ):gsub( '/+$', '' )
77 - return value:match( '([^/]+)$' ) or value
79 + return value:match '([^/]+)$' or value
80 82 local use_palette_for_scheme = function ( scheme )
131 133 name = name:lower()
132 134 if lower:sub( 1, #name ) ~= name then return false end
133 135 local boundary = lower:sub( #name + 1, #name + 1 )
134 - return boundary == '' or boundary:match( '%W' ) ~= nil
136 + return boundary == '' or boundary:match '%W' ~= nil
137 139 local function pane_project( pane )
186 188 if triple:find( 'windows', 1, true ) then return 'WIN', wez.nerdfonts.dev_windows or ' ', palette.warning end
187 189 if triple:find( 'darwin', 1, true ) then return 'MAC', wez.nerdfonts.dev_apple or ' ', palette.ui.important_local end
188 190 if triple:find( 'linux', 1, true ) then return 'LIN', wez.nerdfonts.dev_linux or ' ', palette.ui.important_local end
189 - if triple:find( 'bsd', 1, true ) then return 'BSD', wez.nerdfonts.dev_freebsd or '󰣠 ', palette.ui.important_local end
191 + if triple:find( 'bsd', 1, true ) then return 'BSD', wez.nerdfonts.md_freebsd or '󰣠 ', palette.ui.important_local end
190 192 return 'LOC', wez.nerdfonts.cod_terminal or ' ', palette.ui.important_local
195 197 if not domain or domain == 'local' or domain == 'Local' then return host_domain() end
196 198 if domain:find( '^WSL:', 1, false ) then return 'WSL', wez.nerdfonts.dev_linux or ' ', palette.ui.important_local end
197 199 if domain:find( '^scope:', 1, false ) then return 'EXE', wez.nerdfonts.cod_gear or ' ', palette.warning end
198 - return ( domain:upper():gsub( '[^%w]', '' ):sub( 1, 3 ) .. 'LOC' ):sub( 1, 3 ), wez.nerdfonts.cod_terminal or ' ', palette.ui.important_local
200 + return (domain:upper():gsub( '[^%w]', '' ):sub( 1, 3 ) .. 'LOC'):sub( 1, 3 ), wez.nerdfonts.cod_terminal or ' ',
201 + palette.ui.important_local
201 204 wez.on( 'format-tab-title', function ( tab, tabs, panes, config, hover, max_width )
222 225 label = wez.truncate_right( label, math.max( 1, max_width or 32 ) )
224 227 return {
225 - { Background = { Color = bg } },
226 - { Foreground = { Color = fg } },
227 - { Attribute = { Intensity = tab.is_active and 'Bold' or 'Normal' } },
228 - { Text = label },
228 + { Background = { Color = bg, }, },
229 + { Foreground = { Color = fg, }, },
230 + { Attribute = { Intensity = tab.is_active and 'Bold' or 'Normal', }, },
231 + { Text = label, },
229 232 'ResetAttributes',
247 250 if window:leader_is_active() then key_table = 'LEADER' end
248 251 if key_table then
249 252 right = {
250 - { Background = { Color = palette.error } },
251 - { Foreground = { Color = palette.ui.backdrop } },
252 - { Attribute = { Intensity = 'Bold' } },
253 - { Text = ' ' .. key_table .. ' ' },
253 + { Background = { Color = palette.error, }, },
254 + { Foreground = { Color = palette.ui.backdrop, }, },
255 + { Attribute = { Intensity = 'Bold', }, },
256 + { Text = ' ' .. key_table .. ' ', },
254 257 'ResetAttributes',
255 - { Text = ' ' },
258 + { Text = ' ', },
259 262 local ok_zoom, zoomed_state = pcall( zoomed, pane )
260 263 if ok_zoom and zoomed_state then
261 - table.insert( right, { Foreground = { Color = palette.ui.minor } } )
262 - table.insert( right, { Text = zoomed_state .. ' ' } )
264 + table.insert( right, { Foreground = { Color = palette.ui.minor, }, } )
265 + table.insert( right, { Text = zoomed_state .. ' ', } )
264 267 window:set_right_status( wez.format( right ) )
271 274 local workspace = workspace_chips( window:active_workspace() )
273 276 window:set_left_status( wez.format {
274 - { Text = battery },
275 - { Foreground = { Color = palette.ui.important_local } },
276 - { Attribute = { Intensity = 'Bold' } },
277 - { Text = '● ' .. workspace .. ' ' },
278 - { Foreground = { Color = domain_color } },
279 - { Text = domain_icon .. ' ' .. domain_text .. ' ' },
277 + { Text = battery, },
278 + { Foreground = { Color = palette.ui.important_local, }, },
279 + ---@diagnostic disable-next-line: missing-fields
280 + { Attribute = { Intensity = 'Bold', }, },
281 + { Text = '● ' .. workspace .. ' ', },
282 + { Foreground = { Color = domain_color, }, },
283 + { Text = domain_icon .. ' ' .. domain_text .. ' ', },
280 284 'ResetAttributes',
284 288 if not ok_status then
285 289 wez.log_error( 'status render failed: ' .. tostring( status_error ) )
286 290 window:set_right_status( wez.format {
287 - { Foreground = { Color = palette.error } },
288 - { Text = ' status error ' },
291 + { Foreground = { Color = palette.error, }, },
292 + { Text = ' status error ', },
293 297 return function ( cfg )
298 + ---@cast cfg Config
294 299 cfg.enable_tab_bar = true
295 300 cfg.hide_tab_bar_if_only_one_tab = false
296 301 cfg.use_fancy_tab_bar = false

wezterm/bugabinga/theme.lua

Modified
28 28 return function ( cfg )
29 + ---@cast cfg Config
29 30 local current_scheme = scheme_for_appearance( get_appearance() )
30 31 cfg.color_scheme = current_scheme

wezterm/bugabinga/window.lua

Modified
1 1 local wez = require 'wezterm'
3 3 return function ( cfg )
4 + ---@cast cfg Config
5 5 cfg.window_decorations = 'RESIZE'
6 6 cfg.use_resize_increments = true
7 7 cfg.adjust_window_size_when_changing_font_size = false

wezterm/bugabinga/workspace_switcher.lua

Modified
75 75 local function get_zoxide_elements( choice_table, workspace_ids )
76 - local stdout = run_child_process { zoxide_path, 'query', '-l' }
76 + local stdout = run_child_process { zoxide_path, 'query', '-l', }
78 78 for _, path in ipairs( wezterm.split_by_newlines( stdout ) ) do
79 79 add_path_element( choice_table, workspace_ids, path )
90 90 current = nil
93 - for raw_line in (output .. '\n'):gmatch( '([^\n]*)\n' ) do
93 + for raw_line in (output .. '\n'):gmatch '([^\n]*)\n' do
94 94 local line = raw_line:gsub( '\r$', '' )
95 95 if line == '' then
96 96 finish()
98 - local path = line:match( '^worktree (.+)$' )
99 - local branch = line:match( '^branch refs/heads/(.+)$' )
98 + local path = line:match '^worktree (.+)$'
99 + local branch = line:match '^branch refs/heads/(.+)$'
100 100 if path then
101 101 finish()
102 102 current = { path = path, branch = 'detached', }
119 119 local ok_path, path = pcall( function () return cwd.file_path end )
120 120 if not ok_path or not path then
121 - path = tostring( cwd ):match( '^file://[^/]*(/.*)$' )
121 + path = tostring( cwd ):match '^file://[^/]*(/.*)$'
123 123 if not path then return nil end
124 - if wezterm.target_triple:find( 'windows', 1, true ) and path:match( '^/[A-Za-z]:/' ) then
124 + if wezterm.target_triple:find( 'windows', 1, true ) and path:match '^/[A-Za-z]:/' then
125 125 path = path:sub( 2 )
127 127 return path
194 194 -- increment zoxide path score
195 - run_child_process { zoxide_path, 'add', path }
195 + run_child_process { zoxide_path, 'add', path, }
198 198 local function workspace_chosen( window, pane, workspace )
208 208 -- `mux.spawn_window()` and `wezterm cli spawn --new-window` create mux
209 209 -- windows, which can appear in the workspace HUD without necessarily mapping
210 210 -- a new OS/WM window. For the workflow-window use-case, force a fresh GUI.
211 - local args = { os.getenv 'WEZTERM_EXECUTABLE' or 'wezterm', 'start', '--always-new-process', '--workspace', workspace }
211 + local args = { os.getenv 'WEZTERM_EXECUTABLE' or 'wezterm', 'start', '--always-new-process', '--workspace', workspace, }
212 212 if cwd then
213 213 table.insert( args, '--cwd' )
214 214 table.insert( args, cwd )
220 220 local function zoxide_chosen_in_new_window( window, path, label_path )
221 221 spawn_workspace_window( window, label_path, path )
222 222 -- increment zoxide path score
223 - run_child_process { zoxide_path, 'add', path }
223 + run_child_process { zoxide_path, 'add', path, }
226 226 local function workspace_chosen_in_new_window( window, workspace )

wezterm/bugabinga/wsl.lua

Modified
1 1 local wez = require 'wezterm'
3 3 return function ( cfg )
4 + ---@cast cfg Config
4 5 if not wez.target_triple:find 'windows' then return end
6 7 cfg.wsl_domains = {

wezterm/mise.toml

Added
new file mode 100644
1 +[task_config]
2 +shell = "nu --no-config-file --commands"
4 +[tool_alias]
5 +codeformat = "github:CppCXY/EmmyLuaCodeStyle"
7 +[tools]
8 +"aqua:nushell/nushell" = "0.115.1"
9 +codeformat = "1.6.0"
10 +lua-language-server = "3.19.1"
12 +[tasks.default]
13 +description = "List tasks"
14 +run = "mise tasks ls"
16 +[tasks.fmt]
17 +description = "Format Lua with the same engine used by LuaLS"
18 +run = "CodeFormat format -w . -c .editorconfig --ignores 'bugabinga/nugu/palette_*.lua'"
20 +[tasks.lint]
21 +description = "Check Lua formatting and diagnostics"
22 +run = [
23 + "CodeFormat check -w . -c .editorconfig --ignores 'bugabinga/nugu/palette_*.lua' --diagnosis-as-error",
24 + "lua-language-server --check=. --checklevel=Warning --check_format=pretty",
27 +[tasks.test]
28 +description = "Run WezTerm tests"
29 +run = "nu --no-config-file tests/wezterm_instances_test.nu"
31 +[tasks.check]
32 +description = "Lint and test WezTerm configuration"
33 +depends = ["lint", "test"]