irongit

My wezterm configuration. Allows workspace configurations with environment variables for each new workspace pane.

hygo-term/wezterm.lua
98 lines2.9 KBLua
1local wezterm = require("wezterm")
2local utils = require("utils")
3local act = wezterm.action
4local mux = wezterm.mux
5local config = wezterm.config_builder()
6
7-- basic config
8config.default_domain = "WSL:Ubuntu"
9
10-- window config
11config.font = wezterm.font("Hack Nerd Font")
12config.font_size = 11.0
13config.window_decorations = "RESIZE"
14config.window_background_opacity = 0.85
15config.enable_scroll_bar = true
16config.colors = {
17 scrollbar_thumb = "grey",
18}
19config.color_scheme = "Tokyo Night Storm"
20
21-- keymap
22config.keys = {
23 -- vim-like pane movement
24 { key = "h", mods = "CTRL|SHIFT", action = act.ActivatePaneDirection("Left") },
25 { key = "j", mods = "CTRL|SHIFT", action = act.ActivatePaneDirection("Down") },
26 { key = "k", mods = "CTRL|SHIFT", action = act.ActivatePaneDirection("Up") },
27 { key = "l", mods = "CTRL|SHIFT", action = act.ActivatePaneDirection("Right") },
28 { key = "h", mods = "CTRL|SHIFT|ALT", action = act.AdjustPaneSize({ "Left", 3 }) },
29 { key = "j", mods = "CTRL|SHIFT|ALT", action = act.AdjustPaneSize({ "Down", 3 }) },
30 { key = "k", mods = "CTRL|SHIFT|ALT", action = act.AdjustPaneSize({ "Up", 3 }) },
31 { key = "l", mods = "CTRL|SHIFT|ALT", action = act.AdjustPaneSize({ "Right", 3 }) },
32
33 -- debug
34 { key = "d", mods = "CTRL|SHIFT", action = act.ShowDebugOverlay },
35
36 -- quit all
37 { key = "q", mods = "CTRL|SHIFT", action = act.QuitApplication },
38
39 -- Show the launcher in fuzzy selection mode and have it list all workspaces
40 -- and allow activating one.
41 {
42 key = "9",
43 mods = "ALT",
44 action = act.ShowLauncherArgs({
45 flags = "FUZZY|WORKSPACES",
46 }),
47 },
48 { key = "n", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
49 { key = "p", mods = "ALT", action = act.SwitchWorkspaceRelative(-1) },
50 -- Prompt for a name to use for a new workspace and switch to it.
51 {
52 key = "w",
53 mods = "CTRL|SHIFT",
54 action = act.PromptInputLine({
55 description = wezterm.format({
56 { Attribute = { Intensity = "Bold" } },
57 { Foreground = { AnsiColor = "Fuchsia" } },
58 { Text = "Enter name for new workspace" },
59 }),
60 action = wezterm.action_callback(function(window, pane, line)
61 -- line will be `nil` if they hit escape without entering anything
62 -- An empty string if they just hit enter
63 -- Or the actual line of text they wrote
64 if line then
65 window:perform_action(
66 act.SwitchToWorkspace({
67 name = line,
68 }),
69 pane
70 )
71 end
72 end),
73 }),
74 },
75
76 -- open lazygit
77 {
78 key = "g",
79 mods = "CTRL|SHIFT",
80 action = utils.SpawnMaximizedCommandInNewWindow({ "lazygit" }),
81 },
82}
83
84-- plugins
85local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
86tabline.setup()
87tabline.apply_to_config(config)
88
89-- log success on reload
90wezterm.on("window-config-reloaded", function(_, _)
91 wezterm.log_info("Successfully loaded config from .config")
92end)
93
94-- load workspaces
95local workspaces = require("workspaces")
96workspaces.setup(config)
97
98return config