local wezterm = require 'wezterm'; local config = wezterm.config_builder() config.default_prog = {"/opt/homebrew/bin/fish", "-l"} config.window_decorations = 'RESIZE' config.scrollback_lines = 3500 config.font = wezterm.font('Berkeley Mono') config.font_size = 18 config.front_end = "OpenGL" config.color_scheme = "Catppuccin Latte" -- Use CTRL-A as the leader, similar to my tmux conf! config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 } local function move_pane(key, direction) return { key = key, mods = 'LEADER', action = wezterm.action.ActivatePaneDirection(direction), } end config.keys = { { key = 'z', mods = 'LEADER', action = wezterm.action.TogglePaneZoomState, }, { key = '|', mods = 'LEADER', action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, { key = '-', mods = 'LEADER', action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, { key = 't', mods = 'LEADER', action = wezterm.action.SpawnTab 'CurrentPaneDomain' }, { -- Hit CTRL + A twice to send a CTRL + A to the terminal key = 'a', -- When we're in leader mode _and_ CTRL + A is pressed... mods = 'LEADER|CTRL', -- Actually send CTRL + A key to the terminal action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' }, }, move_pane('j', 'Down'), move_pane('k', 'Up'), move_pane('h', 'Left'), move_pane('l', 'Right') } -- Equivalent to POSIX basename(3) -- Given "/foo/bar" returns "bar" -- Given "c:\\foo\\bar" returns "bar" function basename(s) return string.gsub(s, '(.*[/\\])(.*)', '%2') end -- show the directory of the active pane in the tab title wezterm.on( 'format-tab-title', function(tab, tabs, panes, config, hover, max_width) local pane = tab.active_pane local title = basename(pane.current_working_dir.path) return { { Text = ' ' .. title .. ' ' }, } end ) return config