Last active
August 23, 2024 06:22
-
-
Save lindskogen/c74cbadfd09dcd986e2a49b49baa912c to your computer and use it in GitHub Desktop.
My wezterm configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Place in ~/.config/wezterm/wezterm.lua | |
local wezterm = require 'wezterm' | |
local act = wezterm.action | |
local config = wezterm.config_builder() | |
config.set_environment_variables = { | |
PATH = '/opt/homebrew/bin:' .. os.getenv('PATH') | |
} | |
local font_family = "MonoLisa" | |
function set_color_scheme(name) | |
config.color_scheme = name | |
return wezterm.color.get_builtin_schemes()[name] | |
end | |
local color_scheme = set_color_scheme('Catppuccin Mocha') | |
config.adjust_window_size_when_changing_font_size = false | |
config.pane_focus_follows_mouse = true | |
config.quit_when_all_windows_are_closed = false | |
config.enable_scroll_bar = true | |
config.hide_tab_bar_if_only_one_tab = false | |
config.use_fancy_tab_bar = true | |
config.show_new_tab_button_in_tab_bar = false | |
config.font = wezterm.font({ family = font_family }) | |
config.font_size = 15 | |
config.window_frame = { | |
font = wezterm.font({ family = font_family, weight = 'Bold' }), | |
font_size = 11, | |
active_titlebar_bg = color_scheme.background, | |
inactive_titlebar_bg = color_scheme.background, | |
} | |
config.colors = { | |
tab_bar = { | |
active_tab = { | |
bg_color = color_scheme.background, | |
fg_color = color_scheme.foreground, | |
}, | |
inactive_tab = { | |
bg_color = wezterm.color.parse(color_scheme.background):darken(0.2), | |
fg_color = wezterm.color.parse(color_scheme.foreground):darken(0.2), | |
}, | |
new_tab = { | |
bg_color = color_scheme.background, | |
fg_color = color_scheme.foreground, | |
} | |
} | |
} | |
config.window_padding = { | |
left = '0.5cell', | |
right = '0.5cell', | |
top = '0.2cell', | |
bottom = '0.2cell', | |
} | |
config.window_decorations = 'RESIZE' | |
config.keys = { | |
{ | |
key = 'f', | |
mods = 'SUPER', | |
action = act.Search { CaseInSensitiveString = "" } | |
}, | |
{ | |
key = 'k', | |
mods = 'SUPER', | |
action = act.ClearScrollback 'ScrollbackAndViewport' | |
}, | |
{ | |
key = 'd', | |
mods = 'SUPER', | |
action = act.SplitPane { direction = 'Right' } | |
}, | |
{ | |
key = 'D', | |
mods = 'SUPER', | |
action = act.SplitPane { direction = 'Down' } | |
}, | |
{ | |
key = 'Enter', | |
mods = 'SUPER|SHIFT', | |
action = act.TogglePaneZoomState, | |
}, | |
{ | |
key = 'Enter', | |
mods = 'SUPER', | |
action = act.ToggleFullScreen, | |
}, | |
{ | |
key = '+', | |
mods = 'SUPER', | |
action = act.IncreaseFontSize | |
}, | |
{ | |
key = '-', | |
mods = 'SUPER', | |
action = act.DecreaseFontSize | |
}, | |
{ | |
key = 'P', | |
mods = 'SUPER', | |
action = act.ActivateCommandPalette | |
}, | |
{ | |
key = 'LeftArrow', | |
mods = 'OPT', | |
action = act.SendString '\x1bb', | |
}, | |
{ | |
key = 'RightArrow', | |
mods = 'OPT', | |
action = act.SendString '\x1bf', | |
}, | |
{ | |
key = ',', | |
mods = 'SUPER', | |
action = act.SpawnCommandInNewTab { | |
cwd = wezterm.home_dir, | |
args = { '/opt/homebrew/bin/subl', wezterm.config_file }, | |
}, | |
}, | |
} | |
local function trim_path_string(path_string) | |
local home_dir = wezterm.home_dir | |
-- Set your "Projects" root folder here: | |
return path_string:gsub(home_dir .. "/Projects/", ""):gsub(home_dir, "~") | |
end | |
wezterm.on( | |
'format-tab-title', | |
function(tab) | |
local path = tab.active_pane.current_working_dir.file_path | |
return " " .. trim_path_string(path) .. " " | |
end | |
) | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment