WezTerm projects selector
3 min read April 04, 2025 #productivityPersonally, I like WezTerm for using lua configs instead of boring json/yaml/toml files, and for the powerful and configurable multiplexer. In this post I'll show you how to create a fuzzy project selector that launches a named workspace, splits a window and executes predefined commands.
Multiplexer#
Let's start with the basic configuration to understand the power of multiplexing. Imagine that after starting a terminal, we want to have a preconfigured workspace with the narrow pane for spotify-player on the right, a very small pane at the bottom and the main working pane with weather.
-- ~/.config/wezterm.lua
local wezterm = require
wezterm.
We use the gui-startup
event to configure WezTerm startup, in which we spawn a new window with a single pane pane_main
, workspace name main
and some working directory ~/dev
. Next we split the pane_main
to the right with a size of 0.12
and another working directory and call this pane pane_spoti
. Same for pane_bottom
.
The rest is simple: maximize WezTerm window, activate the main pane and execute some commands on each pane.
We've just configured only one workspace, but you can create as many as you like by spawning more windows with workspace = 'something'
.
Projects#
This time we'll use a similar multiplexing approach, but instead of the gui-startup
event, we'll trigger the project selector manually using a key binding:
-- ~/.config/wezterm.lua
local wezterm = require
local projects = require
-- .. config ..
-- leader = { mods="CTRL", key = '\\', timeout_milliseconds = 1200 },
keys =
Here I've configured the same action for the two different key bindings: key combination and the leader key. Use the one you prefer or both like me.
In choose_project
we'll construct the list of projects and will use the InputSelector action action with the fuzzy option enabled:
In list_projects
we'll specify an object with project names and their initialization functions. For single pane it will be a single_project
, and for other more complicated project configurations it will have a separate function:
-- ~/.config/projects.lua
local wezterm = require
local utils = require
local module =
-- Creates a project with single workspace
local
local
local
-- function module.choose_project()
-- see the previous code snippet
-- end
return module
Here I only use single and dual pane project workspaces, but you can modify this example and setup really powerful projects with dynamic checks, setting environment variables, sourcing .env
files, some preconditions, etc. Have fun!
If a project needs to be started frequently, consider assigning it to a different key binding directly:
-- ~/.config/projects.lua
-- ~/.config/wezterm.lua
keys =
See a full config: github.com/annimon-tutorials/wezterm-projects
Styling#
That gray project selector looks so boring, let's add some colors and icons to it. You can use wezterm.format
to apply styles to fuzzy_description
:
Instead of defining custom colors, you can use AnsiColor
with 16 values: Black
, Maroon
, Green
, Olive
, Navy
, Purple
, Teal
, Silver
, Grey
, Red
, Lime
, Yellow
, Blue
, Fuchsia
, Aqua
or White
.
,
To use icons, see the wezterm.nerdfonts page.
The list of projects needs to be slightly modified:
local
And the project selector function too:
)
Here's what I got:
Full config: github.com/annimon-tutorials/wezterm-projects