local wezterm = require('wezterm') local config = wezterm.config_builder() wezterm.on('gui-startup', function() local tab, pane, window = wezterm.mux.spawn_window({}) tab:set_title('home') end) if string.find(wezterm.target_triple, 'windows') then config.default_prog = { 'powershell.exe', '-ExecutionPolicy', 'Bypass', '-NoLogo', '-NoExit' } end config.font = wezterm.font('CaskaydiaCove Nerd Font Mono') config.font_size = 9 config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' } config.color_scheme = 'Firefly Traditional' config.colors = { foreground = '#D3D7CF', cursor_fg = 'black', cursor_bg = 'white', cursor_border = 'white', } config.use_fancy_tab_bar = false config.tab_max_width = 64 config.window_padding = { left = 0, right = 0, top = 0, bottom = 0, } config.keys = { { key = 'r', mods = 'CTRL|SHIFT', action = wezterm.action.PromptInputLine({ description = 'Enter new name for tab', action = wezterm.action_callback(function(window, pane, line) if line then window:active_tab():set_title(line) end end), }), }, { key = 'w', mods = 'CTRL|SHIFT', action = wezterm.action.CloseCurrentPane { confirm = true }, }, } local move_mods = 'CTRL|SHIFT' local function send_key(window, pane) -- TODO: Detect if tmux is running -- Detect if vim/nvim is running -- Failing that, check if there is only a single pane return false end for _, map in pairs({ { key = 'h', direction = 'Left' }, { key = 'l', direction = 'Right' }, { key = 'k', direction = 'Up' }, { key = 'j', direction = 'Down' }, }) do table.insert(config.keys, { key = map.key, mods = move_mods, action = wezterm.action_callback(function(window, pane) if send_key(window, pane) then window:perform_action( wezterm.action.SendKey({ key = map.key, modes = move_mods }), pane) else window:perform_action( wezterm.action.ActivatePaneDirection(map.direction), pane) end end), }) end -- Attempt require(module) load a module, don't fail if its missing. -- Additionally, call the returned function passing in the wezterm and config -- objects defined in this file. local try_require = function(module) pcall(function() require(module)(wezterm, config) end) end; try_require('local') return config