My_wezterm_conf

My wezterm.lua as of 2025-07-17. Still testing and trying.

Need structure.. so hope to understand if you can ‘import’ or ‘require’ files into config.

local wt = require("wezterm")
local conf = wt.config_builder()
local act = wt.action
local mux = wt.mux

wt.on("gui-startup", function()
  local tab_1, pane_1, win = mux.spawn_window {}
  pane_1:split { direction = "Bottom", size = 0.2 }
  
  local _, pane_2, _ = win:spawn_tab {}
  pane_2:split { direction = "Bottom", size = 0.2 }
  pane_2:activate()
  
  tab_1:activate()
  pane_1:activate()
end)

conf.initial_cols = 106
conf.initial_rows = 66

conf.color_scheme = "Tokyo Night (Gogh)"

conf.font = wt.font("0xProto Nerd Font")
conf.font_size = 10.7

conf.window_decorations = "INTEGRATED_BUTTONS|RESIZE"

conf.window_background_opacity = 1

conf.use_dead_keys = false
conf.scrollback_lines = 5000
conf.adjust_window_size_when_changing_font_size = false
conf.hide_tab_bar_if_only_one_tab = true

conf.default_prog = { 'bash', '-i' }

conf.window_frame = {
	font = wt.font({ family = "Noto Sans", weight = "Regular" }),
}

conf.window_padding = {
	left = "1cell",
	right = "1cell",
	top = "0.0cell",
	bottom = "0.5cell",
}

conf.enable_scroll_bar = true
conf.default_workspace = "main"

conf.inactive_pane_hsb = {
  saturation = 0.9,
  brightness = 0.6,
}


conf.mouse_bindings = {
  {
    event = { Down = { streak = 1, button = "Right" } },
    mods = "NONE",
	action = wt.action_callback(function(window, pane)
	  local has_selection = window:get_selection_text_for_pane(pane) ~= ""
	  if has_selection then
	    window:perform_action(act.CopyTo("ClipboardAndPrimarySelection"), pane)
		window:perform_action(act.ClearSelection, pane)
	  else
	    window:perform_action(act({ PasteFrom = "Clipboard" }), pane)
	  end
	end),
  },
}

conf.leader = { key = " ", mods = "CTRL", timeout_milliseconds = 2000 }

conf.keys = {
  {
    key = 'c',
    mods = 'LEADER',
    action = act.SpawnCommandInNewTab {
      cwd = os.getenv('WEZTERM_CONFIG_DIR'),
      set_environment_variables = {
        TERM = 'screen-256color',
      },
      args = {
        'nvim',
        os.getenv('WEZTERM_CONFIG_FILE'),
      },
    },
  },

  {
    key = 'f',
    mods = 'LEADER',
    action = act.ToggleFullScreen,
  },

  {
    key = 'r',
    mods = 'LEADER',
    action = wt.action_callback(function(win, pane)
      win:toggle_fullscreen {}
      local wmux = win:mux_window {}
      local t, p, w = wmux:spawn_tab {}
      p:split {direction = 'Bottom', size = 0.2, args = { 'irb' }}
      p:split {direction = 'Right', size = 0.2, args = { 'ri' }}
      p:activate()
    end),
  },

  {
    key = 'h',
    mods = 'LEADER',
    action = act.SpawnCommandInNewWindow({
      cwd = os.getenv('WEZTERM_CONFIG_DIR'),
      args = { os.getenv('SHELL'), '-c', '$EDITOR wezterm_help.md'},
    }),
  },

  {
    key = 'w',
    mods = 'LEADER',
    action = act.CloseCurrentTab { confirm = false }
  },

  {
    key = 'P',
    mods = 'CTRL',
    action = act.ActivateCommandPalette,
  },

  {
    key = 'Q',
    mods = 'CTRL',
    action = act.QuitApplication,
  },
}

return config