dotfiles
bugabingas dorkfiles
owned by bugabinga
wezterm: keybinds to like and dislike current code font.
b8331c2b3eeaa47a610ca7e31df5627087fc1ee5
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (6)
neovim/lazy-lock.json
Modified51 51 "nvim-neoclip.lua": {
"branch":
"main",
"commit":
"32e05f2d23dc5b6a284a688c0535a83d1bfc633f" },
52 52 "nvim-rulebook": {
"branch":
"main",
"commit":
"bc5e3874a9870709ec91152f9efce6dad49ca862" },
53 53 "nvim-surround": {
"branch":
"main",
"commit":
"ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
54 - "nvim-treesitter": {
"branch":
"master",
"commit":
"36b78d112bddd69a05e24679241962e29e494d9e" },
54 + "nvim-treesitter": {
"branch":
"master",
"commit":
"707313b80a2f1e65fa06dba2052cc49ce6762a60" },
55 55 "nvim-treesitter-endwise": {
"branch":
"master",
"commit":
"8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
56 56 "nvim-treesitter-textobjects": {
"branch":
"master",
"commit":
"4a2d05ec24eaa6b655c7d19092a3b6c0219d46b9" },
57 57 "nvim-ts-autotag": {
"branch":
"main",
"commit":
"e239a560f338be31337e7abc3ee42515daf23f5e" },
60 60 "plenary.nvim": {
"branch":
"master",
"commit":
"2d9b06177a975543726ce5c73fca176cedbffe9d" },
61 61 "precognition.nvim": {
"branch":
"main",
"commit":
"8a81c310b4e76b4884fc5350a5741cf683c645c7" },
62 62 "range-highlight.nvim": {
"branch":
"master",
"commit":
"8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9" },
63 - "refjump.nvim": {
"branch":
"main",
"commit":
"ae526d94864ddabced9cdb44d2158c9b3d6e0d9c" },
63 + "refjump.nvim": {
"branch":
"main",
"commit":
"a78b585cff29505f7558f3a596bca567474cd663" },
64 64 "scratch.nvim": {
"branch":
"main",
"commit":
"3e3d2ad0d7f565bc794d9d3ad40e92509802ecad" },
65 65 "specs.nvim": {
"branch":
"main",
"commit":
"8a108c8b37dec1b184a1d3d76c6cf867bfbe9636" },
66 66 "spellwarn.nvim": {
"branch":
"main",
"commit":
"2f4dbc58bb90bc63b295461216b91ccf4e7f782d" },
wezterm/bugabinga/code_font.lua
Modified 1 1 local wez
= require 'wezterm' 5 - local selected
= 'JetBrains Mono' 6 - local font_names
= {}
8 - local total_weight
= 1 9 - local code_fonts
= io.
open( wez.config_dir
.. '/bugabinga/code_fonts.csv',
'r' )
12 - for line
in code_fonts:lines()
do 13 - local weight, font_name
= line:match
'^%s*(%d*)%s*,%s*(.*)%s*$' 14 - table.
insert( font_names, font_name )
15 - table.
insert( weights,
tonumber( weight ) )
16 - total_weight
= total_weight
+ weight
3 +local adjust_font_randomness_weight = function ( font_family, adjust )
4 + local code_fonts
= io.
open( wez.config_dir
.. '/bugabinga/code_fonts.csv',
'r+' )
7 + for line
in code_fonts:lines()
do 8 + local weight, font_name
= line:match
'^%s*(%d+)%s*,%s*(.-)%s*$' 9 + if not weight
or not font_name
then 10 + wez.log_error
'Could not parse code_fonts.csv. Borked?' 13 + weight
= tonumber( weight )
14 + if font_name
== font_family
then 15 + weight
= math.
max(
0, adjust( weight ) )
17 + table.
insert( new_lines, weight
.. ', ' .. font_name )
19 + code_fonts:seek(
'set',
0 )
20 + for _, new_line
in ipairs( new_lines )
do 21 + code_fonts:write( new_line,
'\n' )
25 + wez.log_error
'Unable to read and write code_fonts.csv!' 20 - local random_weight
= math.
random( total_weight )
22 - for idx, weight
in ipairs( weights )
do 23 - cursor
= cursor
+ weight
24 - if cursor
>= random_weight
then 25 - selected
= font_names[idx]
34 +local like_current_font = function ( window )
35 + local font
= window:effective_config().font.font
37 + local family
= font[
1].family
38 + adjust_font_randomness_weight( family,
function ( weight )
39 + local new_weight
= weight
+ 1 41 + window:toast_notification(
'code_fonts',
'Font ' .. family
.. '(' .. new_weight
.. ') liked! ',
nil,
500 )
46 +local dislike_current_font = function ( window )
47 + local font
= window:effective_config().font.font
49 + local family
= font[
1].family
50 + adjust_font_randomness_weight( family,
function ( weight )
51 + local new_weight
= weight
- 1 52 + window:toast_notification(
'code_fonts',
'Font ' .. family
.. '(' .. new_weight
.. ') NOT liked! ',
nil,
500 )
57 +local ban_current_font = function ( window )
58 + local font
= window:effective_config().font.font
60 + local family
= font[
1].family
61 + adjust_font_randomness_weight( family,
function ()
62 + window:toast_notification(
'code_fonts',
'Font ' .. family
.. ' BANNED!',
nil,
500 )
68 +wez.on(
'like-current-font', like_current_font )
69 +wez.on(
'dislike-current-font', dislike_current_font )
70 +wez.on(
'ban-current-font', ban_current_font )
72 +local random = function ()
73 + local selected
= 'JetBrains Mono' 74 + local font_names
= {}
76 + local total_weight
= 1 77 + local code_fonts
= io.
open( wez.config_dir
.. '/bugabinga/code_fonts.csv',
'r' )
80 + for line
in code_fonts:lines()
do 81 + local weight, font_name
= line:match
'^%s*(%d+)%s*,%s*(.-)%s*$' 82 + if not weight
or not font_name
then 83 + wez.log_error
'Could not parse code_fonts.csv. Borked?' 86 + weight
= tonumber( weight )
87 + table.
insert( font_names, font_name )
88 + table.
insert( weights, weight )
89 + total_weight
= total_weight
+ weight
93 + local random_weight
= math.
random( total_weight )
95 + for idx, weight
in ipairs( weights )
do 96 + cursor
= cursor
+ weight
97 + if cursor
>= random_weight
then 98 + selected
= font_names[idx]
31 - return wez.font( selected )
104 + return wez.font( selected )
108 + like_current_font = like_current_font,
109 + dislike_current_font = dislike_current_font,
110 + ban_current_font = ban_current_font,
wezterm/bugabinga/code_fonts.csv
Modified 2 - 1,
Anonymous Pro Minus 3 - 1,
Aurulent Sans Mono 6 - 1,
BigBlue TerminalPlus 7 - 1,
Bitstream Vera Sans Mono 9 - 1,
CMU Typewriter Text 16 - 1,
Courier Prime Code 26 - 1,
Fantasque Sans Mono 29 - 1,
Fixedsys Excelsior 3.01 46 - 1,
JetBrains Mono NL 48 - 1,
Latin Modern Mono Light 52 - 1,
Linux Libertine Mono 62 - 1,
Monaspace Argon Var 63 - 1,
Monaspace Krypton Var 64 - 1,
Monaspace Neon Var 65 - 1,
Monaspace Radon Var 66 - 1,
Monaspace Xenon Var 70 - 1,
MonteCarlo Fixed 12 71 - 1,
NanumGothic_Coding 74 - 1,
Office Code Pro D 78 - 0,
PixelCarnageMonoTT 93 - 1,
Share-TechMonoTrue 97 - 1,
Symbols Nerd Font 98 - 1,
Symbols Nerd Font Mono 102 - 1,
Verily Serif Mono 106 - 1,
iA Writer Mono V 2 +1,
Anonymous Pro Minus 6 +1,
BigBlue TerminalPlus 7 +1,
Bitstream Vera Sans Mono 9 +1,
CMU Typewriter Text 16 +1,
Courier Prime Code 26 +1,
Fantasque Sans Mono 29 +1,
Fixedsys Excelsior 3.01 48 +1,
Latin Modern Mono Light 52 +1,
Linux Libertine Mono 62 +1,
Monaspace Argon Var 63 +1,
Monaspace Krypton Var 64 +1,
Monaspace Neon Var 65 +1,
Monaspace Radon Var 66 +1,
Monaspace Xenon Var 70 +1,
MonteCarlo Fixed 12 71 +1,
NanumGothic_Coding 78 +0,
PixelCarnageMonoTT 93 +1,
Share-TechMonoTrue 98 +1,
Symbols Nerd Font Mono 102 +1,
Verily Serif Mono wezterm/bugabinga/fonts.lua
Modified1 1 local wez
= require 'wezterm' 3 3 return function ( cfg )
4 - local font_size
= 16.0 4 + local font_size
= 11.0 5 5 local font
= wez.font
'Cousine' 7 7 cfg.font_size
= font_size
wezterm/bugabinga/key_binds.lua
Modified 10 10 if wez.target_triple:find
'windows' then 11 11 leader
= {
key =
'raw:255', }
13 -local font_size_mode
= ' Change Font Size (=-+)' 13 +local font_mode
= ' Font mode (-=🠙🠛␡)' 14 14 local pane_mode
= ' Pane (hjklqr)' 15 15 local resize_pane_mode
= 'ﭕ Resize Pane (hjkl)' 17 +wez.on(
"inc-font-size",
function(window)
18 + local size
= window:effective_config().font_size
+ 1 19 + local overrides
= window:get_config_overrides()
or {}
20 + overrides.font_size
= size
21 + window:set_config_overrides(overrides)
24 +wez.on(
"dec-font-size",
function(window)
25 + local size
= window:effective_config().font_size
- 1 26 + local overrides
= window:get_config_overrides()
or {}
27 + overrides.font_size
= size
28 + window:set_config_overrides(overrides)
17 31 local key_tables
= {
18 32 [resize_pane_mode] = {
19 33 {
key =
'h',
action = wez.action.AdjustPaneSize {
'Left',
1, }, },
25 39 {
key =
'Escape',
action =
'PopKeyTable', },
27 - [font_size_mode]
= {
28 - {
key =
'-',
action = wez.action.DecreaseFontSize, },
29 - {
key =
'=',
action = wez.action.IncreaseFontSize, },
42 + {
key =
'-',
action = wez.action.EmitEvent
'dec-font-size', },
43 + {
key =
'=',
action = wez.action.EmitEvent
'inc-font-size', },
30 44 {
key =
'0',
action = wez.action.ResetFontSize, },
46 + {
key =
'UpArrow',
action = wez.action.EmitEvent
'like-current-font' },
47 + {
key =
'DownArrow',
action = wez.action.EmitEvent
'dislike-current-font' },
48 + {
key =
'Delete',
action = wez.action.EmitEvent
'ban-current-font' },
32 50 {
key =
'Escape',
action =
'PopKeyTable', },
56 - action = wez.action.ActivateKeyTable {
name = font_size_mode,
one_shot =
false, },
74 + action = wez.action.ActivateKeyTable {
name = font_mode,
one_shot =
false, },
97 115 {
Foreground = {
AnsiColor =
'Purple', }, },
98 116 {
Text =
'New workspace:', },
100 119 action
= wez.action_callback(
function ( window, pane, line )
102 121 window:perform_action(
wezterm/bugabinga/status.lua
Modified22 22 local zoomed_state
= zoomed( pane )
24 24 if window:leader_is_active()
then 28 28 local config
= window:effective_config()
39 39 local pane_domain
= pane:get_domain_name()
41 - local status
= {
'', }
41 + local status
= {
' ', }
43 43 table.
insert( status, leader )