Home

dotnix @6e0dcedd3ff9f2b9ba7b9934b51e97c3230a2c5a - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / apps / wezterm / wezterm.lua
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local wezterm = require "wezterm"

-- Choose theme based on system 
function theme_for_appearance(appearance)
  if appearance:find "Dark" then
    return "Catppuccin Mocha"
  else
    return "Catppuccin Latte"
  end
end

-- Update right status with "mode"
wezterm.on('update-right-status', function(window, pane)
  local name = window:active_key_table()
  if name then
    name = " " .. string.upper(string.sub(name, 1, 1)) .. " "
  end
  window:set_right_status(name or '')
end)

-- Toggle opacity
local opacity = 0.8
wezterm.on('toggle-opacity', function(window, pane)
  if opacity == 0.8 then
    opacity = 0.9
  elseif opacity == 0.9 then
    opacity = 1.0
  else
    opacity = 0.8
  end
  window:set_config_overrides({ window_background_opacity = opacity })
end)

-- config
return {
  default_prog = { "nu", "--config", "~/.config/nushell/config.nu", "--env-config", "~/.config/nushell/env.nu" },
  color_scheme = theme_for_appearance(wezterm.gui.get_appearance()),
  window_close_confirmation = 'NeverPrompt',
  window_background_opacity = opacity,
  window_decorations = "RESIZE",
  leader = {
    key = "Space",
    mods = "CTRL",
    timeout_milliseconds = math.maxinteger,
  },
  keys = {
    { key = "p", mods = "LEADER", action = wezterm.action.ActivateKeyTable({ name = "pane_mode", one_shot = false }) },
    { key = "h", mods = "SHIFT|CTRL|ALT", action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) },
    { key = "v", mods = "SHIFT|CTRL|ALT", action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }) },
    { key = "c", mods = "SHIFT|CTRL|ALT", action = wezterm.action.CloseCurrentPane({ confirm = false }) },
    { key = "s", mods = "SHIFT|CTRL|ALT", action = wezterm.action.PaneSelect({ alphabet = "1234567890", mode = "SwapWithActive" }) },

    { key = "o", mods = "SHIFT|CTRL|ALT", action = wezterm.action.EmitEvent("toggle-opacity") },

    { key = "1", mods = "LEADER", action = wezterm.action.ActivateTab(0) },
    { key = "2", mods = "LEADER", action = wezterm.action.ActivateTab(1) },
    { key = "3", mods = "LEADER", action = wezterm.action.ActivateTab(2) },
    { key = "4", mods = "LEADER", action = wezterm.action.ActivateTab(3) },
    { key = "5", mods = "LEADER", action = wezterm.action.ActivateTab(4) },
    { key = "6", mods = "LEADER", action = wezterm.action.ActivateTab(5) },
    { key = "7", mods = "LEADER", action = wezterm.action.ActivateTab(6) },
    { key = "8", mods = "LEADER", action = wezterm.action.ActivateTab(7) },
    { key = "9", mods = "LEADER", action = wezterm.action.ActivateTab(8) },
    { key = "0", mods = "LEADER", action = wezterm.action.ActivateTab(-1) },
  },
  key_tables = {
    pane_mode = {
      { key = "h", action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }) },
      { key = "v", action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }) },
      { key = "c", action = wezterm.action.CloseCurrentPane({ confirm = false }) },
      { key = "s", action = wezterm.action.PaneSelect({ alphabet = "1234567890", mode = "SwapWithActive" }) },
      { key = "LeftArrow", action = wezterm.action.ActivatePaneDirection("Left") },
      { key = "UpArrow", action = wezterm.action.ActivatePaneDirection("Up") },
      { key = "RightArrow", action = wezterm.action.ActivatePaneDirection("Right") },
      { key = "DownArrow", action = wezterm.action.ActivatePaneDirection("Down") },
      { key = "Delete", action = wezterm.action.CloseCurrentPane({ confirm = false }) },
      { key = "LeftArrow", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Left", 1 }) },
      { key = "RightArrow", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Right", 1 }) },
      { key = "UpArrow", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Up", 1 }) },
      { key = "DownArrow", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Down", 1 }) },
      { key = "Escape", action = "PopKeyTable" },
    },
  },
}