forked from ohmyzsh/ohmyzsh
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwezterm.lua
More file actions
191 lines (165 loc) · 5.19 KB
/
wezterm.lua
File metadata and controls
191 lines (165 loc) · 5.19 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local action = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- disable bell
config.audible_bell = "Disabled"
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
-- config.color_scheme = 'Solarized Dark - Patched'
-- config.color_scheme = 'Solarized (dark) (terminal.sexy)'
-- config.color_scheme = 'Solarized Dark Higher Contrast'
config.ssh_domains = {
{
name = 'universe2',
remote_address = 'devbox.databricks.com',
username = 'ahirreddy',
},
}
config.window_decorations = 'RESIZE|INTEGRATED_BUTTONS'
wezterm.on('spawn-new-tab-in-devbox', function(window, pane)
wezterm.log_info('Spawning new tab in devbox')
wezterm.log_info('Current pane domain: ' .. pane:get_domain_name())
local cwd = pane:get_current_working_dir().file_path;
wezterm.log_info('Spawning from devbox pane')
wezterm.log_info('Current working directory: ' .. cwd)
-- Spawn a new tab in devbox using the current working directory
window:perform_action(
wezterm.action.SpawnCommandInNewTab {
domain = { DomainName = pane:get_domain_name() },
cwd = cwd,
},
pane
)
end)
config.keys = {
{ key = 'd', mods = 'CMD|SHIFT', action = action.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = 'd', mods = 'CMD', action = action.SplitHorizontal { domain = 'CurrentPaneDomain' } },
{ key = 'k', mods = 'CMD', action = action.ClearScrollback 'ScrollbackAndViewport' },
{ key = 'w', mods = 'CMD', action = action.CloseCurrentPane { confirm = false } },
{ key = 'w', mods = 'CMD|SHIFT', action = action.CloseCurrentTab { confirm = false } },
{ key = 'LeftArrow', mods = 'CMD', action = action.SendKey { key = 'Home' } },
{ key = 'RightArrow', mods = 'CMD', action = action.SendKey { key = 'End' } },
{ key = 'p', mods = 'CMD|SHIFT', action = action.ActivateCommandPalette },
{
key = 't',
mods = 'CMD',
action = action.SpawnCommandInNewTab {
domain = 'DefaultDomain', -- DefaultDomain is "local"
},
},
{
key = 'T',
mods = 'CMD|SHIFT',
action = wezterm.action_callback(function(window, pane)
wezterm.emit('spawn-new-tab-in-devbox', window, pane)
end),
}
}
-- Font settings
config.font = wezterm.font("Monaco")
config.font_size = 12.0
-- Font rendering settings
config.harfbuzz_features = { "calt=0", "clig=0", "liga=0" } -- Disable ligatures
-- Colors
config.colors = {
foreground = "#839496",
background = "#002B36",
cursor_bg = "#839496",
cursor_fg = "#002B36",
cursor_border = "#839496",
selection_fg = "#839496",
selection_bg = "#073642",
ansi = {
"#073642", -- Black (Ansi 0)
"#DC322F", -- Red (Ansi 1)
"#859900", -- Green (Ansi 2)
"#B58900", -- Yellow (Ansi 3)
"#268BD2", -- Blue (Ansi 4)
"#D33682", -- Magenta (Ansi 5)
"#2AA198", -- Cyan (Ansi 6)
"#EEE8D5", -- White (Ansi 7)
},
brights = {
"#002B36", -- Bright Black (Ansi 8)
"#CB4B16", -- Bright Red (Ansi 9)
"#586E75", -- Bright Green (Ansi 10)
"#657B83", -- Bright Yellow (Ansi 11)
"#839496", -- Bright Blue (Ansi 12)
"#6C71C4", -- Bright Magenta (Ansi 13)
"#93A1A1", -- Bright Cyan (Ansi 14)
"#FDF6E3", -- Bright White (Ansi 15)
},
}
-- Window settings
config.enable_wayland = false -- Disable Wayland by default
config.window_padding = {
left = 10,
right = 10,
top = 15,
bottom = 2,
}
-- Cursor
config.cursor_blink_rate = 0
config.default_cursor_style = "BlinkingBlock"
-- Scrollback
config.scrollback_lines = 10000
-- Tab settings
config.tab_bar_at_bottom = false
config.use_fancy_tab_bar = false -- Use square tabs
config.colors.tab_bar = {
background = "#002B36", -- Match terminal background color
active_tab = {
bg_color = "#002B36",
fg_color = "#839496",
intensity = "Bold",
},
inactive_tab = {
bg_color = "#073642",
fg_color = "#586E75",
},
inactive_tab_hover = {
bg_color = "#073642",
fg_color = "#839496",
},
new_tab = {
bg_color = "#002B36",
fg_color = "#839496",
},
new_tab_hover = {
bg_color = "#073642",
fg_color = "#839496",
},
}
config.tab_max_width = 200 -- Ensure tabs expand proportionally and are visible
-- Other settings
config.enable_tab_bar = true
config.enable_scroll_bar = true
config.min_scroll_bar_height = '2cell'
config.colors.scrollbar_thumb = 'gray'
config.tab_max_width = 10000
config.scrollback_lines = 1000000
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
local domain_name = tab.active_pane.domain_name
-- Default colors
local bg_color = "#586E75"
local fg_color = "#FDF6E3"
-- Calculate tab width
local total_tabs = #tabs
local tab_width = math.floor(10000 / total_tabs)
-- Truncate and pad title based on tab width
local title = wezterm.truncate_right(tab.active_pane.title, tab_width - 2)
title = wezterm.pad_right(title, tab_width - 2)
-- Customize for devbox domain
if domain_name ~= 'local' then
title = '⚡' .. domain_name .. ': ' .. title
end
return {
{ Text = ' ' .. title .. ' ' },
Background = bg_color,
Foreground = fg_color,
}
end)
-- and finally, return the configuration to wezterm
return config