{"slug": "wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm", "title": "WezTerm config for iTerm users https://vladkens.cc/from-iterm-to-wezterm/", "summary": "The article provides a WezTerm configuration file (wezterm.lua) designed for users migrating from iTerm2, featuring settings like Catppuccin color schemes, JetBrains Mono font, and macOS window blur effects. The configuration includes custom keybindings, tab bar customization, automatic window maximization on startup, and integration with tmux-like session persistence through Unix socket connections.", "body_md": "wezterm.lua\n\n      This file contains hidden or 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.\n      \nLearn more about bidirectional Unicode characters\n\n \n    Show hidden characters\n\n-- https://wezfurlong.org/wezterm/config/files.html\n\n-- https://alexplescan.com/posts/2024/08/10/wezterm/\n\n-- https://github.com/wez/wezterm/issues/6112\n\n-- https://github.com/wez/wezterm/issues/5754\n\nlocal wezterm = require \"wezterm\"\n\nlocal config = wezterm.config_builder()\n\nlocal action = wezterm.action\n\nlocal mux = wezterm.mux\n\nconfig.audible_bell = \"Disabled\"\n\nconfig.check_for_updates = false -- managed by brew\n\nconfig.set_environment_variables = {\n\n  PATH = '/opt/homebrew/bin:/usr/local/bin/:' .. os.getenv('PATH')\n\n}\n\nlocal function scheme_for_appearance(a)\n\n  return a:find(\"Dark\") and \"Catppuccin Macchiato\" or \"Catppuccin Latte\"\n\nend\n\nconfig.font = wezterm.font { family = 'JetBrains Mono', weight = 'Medium', harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' } }\n\nconfig.font_size = 15.0\n\nconfig.line_height = 1.0\n\nconfig.bold_brightens_ansi_colors = true\n\nconfig.color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())\n\nconfig.macos_window_background_blur = 20\n\nconfig.window_background_opacity = 0.96\n\nconfig.window_decorations = 'RESIZE|INTEGRATED_BUTTONS'\n\nconfig.window_padding = { left = '0.5cell', right = '0.5cell', top = '1.5cell', bottom = '0.5cell' }\n\nconfig.enable_tab_bar = true\n\nconfig.use_fancy_tab_bar = false\n\nconfig.tab_bar_at_bottom = true\n\nconfig.tab_max_width = 32\n\nconfig.show_new_tab_button_in_tab_bar = false\n\n-- config.hide_tab_bar_if_only_one_tab = true -- sometimes procude wrong window size on maximize\n\nconfig.default_cursor_style = 'BlinkingBar'\n\nconfig.animation_fps = 1\n\nconfig.cursor_blink_rate = 500\n\nconfig.prefer_egl = true\n\nconfig.max_fps = 60\n\nconfig.enable_scroll_bar = true\n\nconfig.scrollback_lines = 10000\n\n-- makes wezterm to work like tmux; see also: https://bower.sh/zmx-session-persistence\n\nconfig.default_gui_startup_args = { 'connect', 'unix' }\n\nconfig.window_close_confirmation = 'NeverPrompt'\n\nlocal function maximize_window(window)\n\n  if not window.gui_window then return end\n\n  local screen = wezterm.gui.screens().active\n\n  local guiwin = window:gui_window()\n\n  if not screen or not guiwin then return end\n\n  -- window:gui_window():maximize() -- have long animation\n\n  guiwin:set_position(screen.x, screen.y)\n\n  guiwin:set_inner_size(screen.width, screen.height)\n\nend\n\n-- https://github.com/wez/wezterm/issues/3299#issuecomment-2145712082\n\nwezterm.on(\"gui-startup\", function(cmd)\n\n\tlocal tab, pane, window = mux.spawn_window(cmd or {})\n\n  maximize_window(window)\n\nend)\n\nwezterm.on(\"gui-attached\", function(window)\n\n  local workspace = mux.get_active_workspace()\n\n  for _, window in ipairs(mux.all_windows()) do\n\n    if window:get_workspace() == workspace then\n\n      maximize_window(window)\n\n    end\n\n  end\n\nend)\n\nwezterm.on(\"window-resized\", function(window, pane)\n\n  maximize_window(window)\n\nend)\n\n-- see also https://wezterm.org/config/lua/wezterm/battery_info.html\n\nwezterm.on(\"format-tab-title\", function(tab, tabs, panes, config, hover, max_width)\n\n  local title = (tab.tab_title ~= \"\" and tab.tab_title) or tab.active_pane.title\n\n  title = title:lower()\n\n  local prefix = tostring(tab.tab_index + 1) .. \":\"\n\n  local width = math.max(1, max_width - (#prefix + 2))\n\n  title = wezterm.truncate_right(title, width)\n\n  return \" \" .. prefix .. title .. \" \"\n\nend)\n\n-- https://github.com/wezterm/wezterm/issues/1988#issuecomment-2462216249\n\nlocal function search_cmd(window, pane)\n\n  window:perform_action(action.Search 'CurrentSelectionOrEmptyString', pane)\n\n  window:perform_action(action.Multiple {\n\n    action.CopyMode 'ClearPattern',\n\n    action.CopyMode 'ClearSelectionMode',\n\n    action.CopyMode 'MoveToScrollbackBottom'\n\n  }, pane)\n\nend\n\nconfig.keys = {\n\n  { key = 'q', mods = 'CMD', action = wezterm.action.Nop }, -- prevent accidental quit\n\n  { key = 't', mods = 'CMD', action = action.SpawnTab 'CurrentPaneDomain' },\n\n  { key = 'd', mods = 'CMD', action = action.SplitHorizontal { domain = 'CurrentPaneDomain' } },\n\n  { key = 'd', mods = 'CMD|SHIFT', action = action.SplitVertical { domain = 'CurrentPaneDomain' } },\n\n  { key = 'k', mods = 'CMD', action = action.ClearScrollback 'ScrollbackAndViewport' },\n\n  { key = 'w', mods = 'CMD', action = action.CloseCurrentPane { confirm = false } },\n\n  { key = 'w', mods = 'CMD|SHIFT', action = action.CloseCurrentTab { confirm = false } },\n\n  { key = 'a', mods = 'CMD', action = action.SelectTextAtMouseCursor 'SemanticZone', },\n\n  { key = 'LeftArrow', mods = 'CMD', action = action.SendKey { key = 'Home' } },\n\n  { key = 'RightArrow', mods = 'CMD', action = action.SendKey { key = 'End' } },\n\n  { key = 'Backspace', mods = 'CMD', action = action.SendKey({ mods = \"CTRL\", key = \"u\" }) },\n\n  { key = 'Backspace', mods = 'OPT', action = action.SendKey({ mods = \"CTRL\", key = \"w\" }) },\n\n  { key = 'P', mods = 'CMD|SHIFT', action = action.ActivateCommandPalette },\n\n  { key = 'f', mods = 'CMD', action = wezterm.action_callback(search_cmd) },\n\n  { key = ',', mods = 'CMD', action = action.SpawnCommandInNewTab { cwd = wezterm.home_dir, args = { 'code', wezterm.config_file } } },\n\n  { key = 'E', mods = 'CMD|SHIFT', action = action.PromptInputLine {\n\n    description = 'Enter tab title (empty to unset):',\n\n    action = wezterm.action_callback(function(window, _, line)\n\n      window:active_tab():set_title(line)\n\n    end),\n\n  }},\n\n}\n\nconfig.mouse_bindings = {\n\n  { event = { Up = { streak = 1, button = \"Left\" } }, mods = \"NONE\", action = action.Nop },\n\n  { event = { Up = { streak = 1, button = \"Left\" } }, mods = \"CMD\", action = action.OpenLinkAtMouseCursor },\n\n  -- Disable CMD + LeftClick window drag (make it behave like normal select)\n\n  -- { event = { Drag = { streak = 1, button = 'Left' } }, mods = \"CMD\", action = action.Nop },\n\n  { event = { Drag = { streak = 1, button = \"Left\" } }, mods = \"CMD\", action = action.ExtendSelectionToMouseCursor(\"Cell\") },\n\n}\n\n-- https://code.visualstudio.com/docs/configure/command-line#_opening-vs-code-with-urls\n\n-- path-symbols: [\\w@\\.\\/\\-\\[\\]\\(\\)]\n\nlocal function path_exists(path)\n\n  local ok, _, _ = wezterm.run_child_process { \"test\", \"-e\", path }\n\n  return ok\n\nend\n\nconfig.hyperlink_rules = wezterm.default_hyperlink_rules()\n\n-- config.hyperlink_rules = {}\n\ntable.insert(config.hyperlink_rules, {\n\n  regex = [[((?:[\\w@\\.\\/\\-\\[\\]\\(\\)]+\\/)+[\\w@\\.\\/\\-\\[\\]\\(\\)]+\\.\\w+)\\b]],\n\n  format = \"vscode://file/$PWD/$1\",\n\n  highlight = 1,\n\n})\n\ntable.insert(config.hyperlink_rules, {\n\n  regex = [[((?:[\\w@\\.\\/\\-\\[\\]\\(\\)]+\\/)+[\\w@\\.\\/\\-\\[\\]\\(\\)]+\\.\\w+):(\\d+):(\\d+)]],\n\n  format = \"vscode://file/$PWD/$1:$2:$3\",\n\n  highlight = 1,\n\n})\n\nwezterm.on(\"open-uri\", function(window, pane, uri)\n\n  if uri:find(\"$PWD\") then\n\n    local cwd_uri = pane:get_current_working_dir()\n\n    local before, after = uri:match(\"^(.-)$PWD/(.+)$\")\n\n    wezterm.log_info(before, after, path_exists(after))\n\n    if path_exists(after) then\n\n      uri = before .. after\n\n    else\n\n      uri = uri:gsub(\"$PWD\", cwd_uri.file_path)\n\n    end\n\n    wezterm.log_info(uri)\n\n    wezterm.open_with(uri)\n\n    return false\n\n  end\n\n \n\n  return true\n\nend)\n\nreturn config", "url": "https://wpnews.pro/news/wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm", "canonical_source": "https://gist.github.com/vladkens/f2ae7c374c1752c4b1581c5e7dffa900", "published_at": "2025-01-10 04:40:58+00:00", "updated_at": "2026-05-23 17:35:49.268770+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["WezTerm", "iTerm", "JetBrains Mono", "Catppuccin Macchiato", "Catppuccin Latte", "Homebrew"], "alternates": {"html": "https://wpnews.pro/news/wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm", "markdown": "https://wpnews.pro/news/wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm.md", "text": "https://wpnews.pro/news/wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm.txt", "jsonld": "https://wpnews.pro/news/wezterm-config-for-iterm-users-https-vladkens-cc-from-iterm-to-wezterm.jsonld"}}