+/config

my dotfiles and nix configuration

git clone https://git.julia.blue/+/config

Julia RyanUpdate minecraft server8dbea4b

main
3.8 KiB116 linesraw
1local w = require "wezterm"
2local a = w.action
3local c = {
4    front_end = "WebGpu",
5    default_prog = { "zsh" },
6    font = w.font "Source Code Pro",
7    font_rules = {
8        {
9            intensity = "Bold",
10            italic = true,
11            font = w.font { family = "Source Code Pro", weight = "Bold", style = "Italic" },
12        },
13        {
14            intensity = "Bold",
15            font = w.font { family = "Source Code Pro", weight = "Bold" },
16        },
17    },
18    window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
19    color_scheme = "iTerm2 Default",
20    colors = { foreground = "#DDDDDD" },
21    default_cursor_style = "BlinkingBar",
22    hide_tab_bar_if_only_one_tab = true,
23    enable_kitty_keyboard = true,
24}
25
26local h = w.hostname()
27if h == "WOPR" then c.font_size = 15 end
28
29local function get_zone_around_cursor(pane)
30    local cursor = pane:get_cursor_position()
31    print(cursor)
32    local zone = pane:get_semantic_zone_at(math.max(cursor.x - 1, 0), cursor.y)
33    if zone then
34        print(zone) -- return pane:get_text_from_semantic_zone(zone)
35    end
36    return nil
37end
38
39-- TODO: semantic zone in pager
40w.on("view-zone-in-pager", function(window, _pane)
41    print(window:current_event())
42    -- get_zone_around_cursor(pane)
43end)
44
45w.on("view-history-in-pager", function(window, pane)
46    local text = pane:get_lines_as_escapes(pane:get_dimensions().scrollback_rows)
47
48    -- TODO: mkfifo or something to avoid writing tmpfile?
49    local name = os.tmpname()
50    local f = io.open(name, "w+")
51    f:write(text)
52    f:flush()
53    f:close()
54
55    window:perform_action(a.SpawnCommandInNewTab { args = { "less", "-R", name } }, pane)
56    w.sleep_ms(5000)
57    os.remove(name)
58end)
59
60c.disable_default_key_bindings = true
61local m = "CTRL|SHIFT"
62c.keys = {
63    { mods = m, key = "c", action = a.CopyTo "Clipboard" },
64    { mods = m, key = "v", action = a.PasteFrom "Clipboard" },
65    { mods = m, key = "+", action = a.IncreaseFontSize },
66    { mods = m, key = "_", action = a.DecreaseFontSize },
67    { mods = m, key = ")", action = a.ResetFontSize },
68    { mods = m, key = "r", action = a.ReloadConfiguration },
69    { mods = m, key = "u", action = a.ScrollByPage(-1) },
70    { mods = m, key = "d", action = a.ScrollByPage(1) },
71    { key = "PageUp", action = a.ScrollToPrompt(-1) },
72    { key = "PageDown", action = a.ScrollToPrompt(1) },
73    { mods = m, key = "Space", action = a.QuickSelect },
74    { mods = m, key = "h", action = a.EmitEvent "view-history-in-pager" },
75    { mods = m, key = "~", action = a.ShowDebugOverlay },
76    { mods = "ALT", key = "r", action = a.ShowLauncher },
77}
78
79local l = { streak = 1, button = "Left" }
80local r = { streak = 1, button = "Right" }
81c.mouse_bindings = {
82    {
83        event = { Down = { streak = 1, button = { WheelUp = 1 } } },
84        mods = "NONE",
85        alt_screen = false,
86        action = a.ScrollByLine(-1),
87    },
88    {
89        event = { Down = { streak = 1, button = { WheelDown = 1 } } },
90        mods = "NONE",
91        alt_screen = false,
92        action = a.ScrollByLine(1),
93    },
94    {
95        event = { Down = { streak = 4, button = "Left" } },
96        action = a.SelectTextAtMouseCursor "SemanticZone",
97        mods = "NONE",
98    },
99    { event = { Down = l }, mods = m, action = a.Nop },
100    { event = { Up = l }, mods = m, action = a.OpenLinkAtMouseCursor },
101    {
102        event = { Down = r },
103        mods = m,
104        alt_screen = false,
105        action = a.EmitEvent "view-zone-in-pager",
106    },
107    { event = { Down = { streak = 1, button = "Middle" } }, action = a.Nop },
108    { event = { Up = { streak = 1, button = "Left" } }, action = a.Nop },
109    { event = { Up = { streak = 2, button = "Left" } }, action = a.Nop },
110    { event = { Up = { streak = 3, button = "Left" } }, action = a.Nop },
111}
112
113c.text_blink_ease_in = "Constant"
114c.text_blink_ease_out = "Constant"
115
116return c