-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.wezterm.lua
113 lines (100 loc) · 2.5 KB
/
.wezterm.lua
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local wezterm = require("wezterm")
-- Multiplexer module
local mux = wezterm.mux
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- Format tab title to contain the path's directory and current process
wezterm.on("format-tab-title", function(tab)
local cwd_uri = tab.active_pane.current_working_dir.path or ""
cwd_uri = string.match(cwd_uri, "[^/]+$")
local process = tab.active_pane.foreground_process_name
process = string.gsub(process, "^.*[/\\]+", "")
if not process or process == "" then
process = tab.active_pane.title
end
return string.format("%d: %s | %s", tab.tab_index + 1, cwd_uri, process)
end)
-- This is where you actually apply your config choices
wezterm.on("gui-startup", function()
local window = mux.spawn_window({})
window:gui_window():maximize()
end)
-- Color scheme
config.color_scheme = "tokyonight_night"
-- Disable close confirmaion
config.window_close_confirmation = "NeverPrompt"
config.leader = { key = "b", mods = "CTRL" }
config.keys = {
{
key = "w",
mods = "CMD",
action = wezterm.action.CloseCurrentTab({ confirm = false }),
},
{
key = "t",
mods = "CMD",
action = wezterm.action.SpawnCommandInNewTab({
cwd = wezterm.home_dir,
}),
},
{
key = "t",
mods = "CMD|SHIFT",
action = wezterm.action({ SpawnTab = "CurrentPaneDomain" }),
},
{
key = "<",
mods = "LEADER",
action = wezterm.action.MoveTabRelative(-1),
},
{
key = ">",
mods = "LEADER",
action = wezterm.action.MoveTabRelative(1),
},
-- multiplexing commands
-- opening / closing panes
{
key = "%",
mods = "LEADER",
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = '"',
mods = "LEADER",
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "X",
mods = "LEADER",
action = wezterm.action.CloseCurrentPane({ confirm = false }),
},
-- navigating through panes
{
key = "LeftArrow",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Left"),
},
{
key = "RightArrow",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Right"),
},
{
key = "UpArrow",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Up"),
},
{
key = "DownArrow",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Down"),
},
}
-- return the configuration to wezterm
return config