Skip to main content

Wezterm is my new favourite terminal AND multiplexer

·4 mins·

As I’ve mentioned in previous posts, I like to mess around with my dotfiles and consistently change what tools & software I use. However, alacritty has been the one constant for me for many years, it was fast, lightweight, easily configurable & I just had no reason to change.

I started going down the rabit hole of increasing my terminal speed & overall experience by moving from Oh My Zsh to using zinit for plugin management & starship as a prompt.

This reduced my terminal load speed by around ~22%.

I am speed
when I reduce startup time by 100ms

During this escapade I found out about Wezterm. The more I read, the more I liked, so I gave it a go.

What is Wezterm #

Wezterm is also a GPU-accelerated cross-platform terminal which written in rust. It comes with pretty much every modern terminal feature you can hope for; here’s full list here. The gamechanger for me & what made me seriously start looking into it was the built-in multiplexing, so long tmux & zellij. I could now have one terminal which handled all of my multiplexing needs.

Multiplexing #

Windows #

In tmux,for example, windows let you create multiple screens within a session and easily tab between them. In Wezterm, they are simply just tabs at the top. In all honesty I changed my keybindings for creating & switching windows in Wezterm and they work perfectly.

I will say though, I’ve not looked at any configuration for the UI of the tabs yet, or if its possible. They are very out of the way in Wezterm which I don’t personally mind as I never named my windows in tmux anyway.

Tabs in Wezterm

Sessions #

One thing I use every day now in my workflow is sessions in tmux. I switch between codebases creating a session for each one, which I can just attach & detach from as needed throughout my day. Also, I like having stuff like notes in a session & monitoring tools.

tmux session example

Wezterm allows me to do that with workspaces.

Wezterm workspace

This can be created by adding this to your configuration.

	{
		key = "w",
		mods = "LEADER",
		action = act.PromptInputLine({
			description = Wezterm.format({
				{ Attribute = { Intensity = "Bold" } },
				{ Foreground = { AnsiColor = "Fuchsia" } },
				{ Text = "Enter name for new workspace" },
			}),
			action = wezterm.action_callback(function(window, pane, line)
				-- line will be `nil` if they hit escape without entering anything
				-- An empty string if they just hit enter
				-- Or the actual line of text they wrote
				if line then
					window:perform_action(
						act.SwitchToWorkspace({
							name = line,
						}),
						pane
					)
				end
			end),
		}),
	},

I remapped all of the main keys I use with the mod of leader & ‘w’ for workspaces, but feel free to swap them with what feels comfortable.

I’m currently adding a local function where if I create a workspace witch matches a name set in the function, you can explicilty load programs & templates like in tmux!

There are examples in the documentation here.

Configuration #

Over the last 6 months I’ve switched to neovim (btw) & previously used Awesome Window Manager which both have configuration files written in lua. I’m no expert by any means but know enough to get by.

So the config being written in lua for it was rather nice, it’s an easy language but extensible enough to let me to tweak to my hearts content.

I won’t go over every config but here is a segment of my personal config, which in full can be found here.

-- Pull in the Wezterm API
local Wezterm = require("Wezterm")

-- This will hold the configuration.
local config = Wezterm.config_builder()

-- font
config.font = Wezterm.font("Fira Code")

-- Change leader key
config.leader = { key = "Space", mods = "CTRL", timeout_milliseconds = 1000 }
-- This is where you actually apply your config choices

-- For example, changing the color scheme:
config.color_scheme = "Catppuccin Mocha"
config.hide_tab_bar_if_only_one_tab = true
config.font_size = 14.0
config.window_background_opacity = 0.8
config.window_padding = {
	left = "3cell",
	right = "3cell",
	top = "1cell",
	bottom = "1cell",
}

It’s very cookie-cutter currently but I don’t hate that. The full documentatio and walkthrough can be found in their docs.

Error handling #

As it’s written in Rust, it has a very verbose error handling system which will inform you on any errors to your configuration when hot reloaded with a nice popup.

In this example, you can’t put a pipe between to keys when setting a keybind.

Error in code

Error popup

Conclusion #

In short, I’ve been very impressed in my short usage of Wezterm & fully plan on using this going forward. Who knows, maybe I’ll run into some things I don’t like, but so far it’s ticked every box.

The main selling points for me:

  • I don’t need seperate configurations for terminal & multiplexer.
  • The configuration is written in lua, which allows much more flexibility and customization.
  • The configuration is also very straight forward.
  • As it’s written in rust, you get very verbose errors.
  • Configuration is hot loaded.
  • Great documentation & examples, for example using ssh in multiplexing.