Skip to main content

Synopsis

wezterm shell-completion --shell <SHELL>

Description

Generate shell completion scripts that provide tab completion for WezTerm commands, subcommands, and options in your shell.

Options

--shell
string
required
The shell to generate completions for.Supported shells:
  • bash
  • fish
  • zsh
  • powershell
  • elvish
  • fig

Installation

Bash

# Generate and install completion script
wezterm shell-completion --shell bash > ~/.local/share/bash-completion/completions/wezterm

# Or for system-wide installation (requires sudo)
sudo wezterm shell-completion --shell bash > /etc/bash_completion.d/wezterm
Then restart your shell or source your profile:
source ~/.bashrc

Zsh

# Create completions directory if it doesn't exist
mkdir -p ~/.zsh/completions

# Generate completion script
wezterm shell-completion --shell zsh > ~/.zsh/completions/_wezterm

# Add to .zshrc if not already present
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
Restart your shell:
exec zsh

Fish

# Generate and install completion script
wezterm shell-completion --shell fish > ~/.config/fish/completions/wezterm.fish
Fish will automatically load the completions.

PowerShell

# Generate completion script
wezterm shell-completion --shell powershell > $PROFILE\..\Completions\wezterm.ps1

# Or add to your profile
wezterm shell-completion --shell powershell | Out-File -Append $PROFILE
Reload your profile:
. $PROFILE

Elvish

# Generate completion script
wezterm shell-completion --shell elvish > ~/.config/elvish/lib/wezterm.elv

# Add to rc.elv
echo 'use wezterm' >> ~/.config/elvish/rc.elv

Fig

Fig (now Amazon Q) provides visual autocomplete:
wezterm shell-completion --shell fig > ~/.fig/autocomplete/wezterm.js

Usage

Once installed, you can use tab completion with WezTerm commands:
# Type and press Tab
wezterm <Tab>
# Shows: start, connect, ssh, serial, ls-fonts, ...

wezterm start --<Tab>
# Shows: --help, --no-auto-connect, --cwd, --class, ...

wezterm ssh <Tab>
# Shows available SSH hosts from your config

Completion Features

The generated completions provide:
  • Command completion: All wezterm subcommands
  • Option completion: Flags and arguments for each command
  • Value completion: Where applicable (e.g., shell types, domains)
  • Description hints: Brief descriptions of commands and options

Troubleshooting

Ensure bash-completion is installed:
# macOS
brew install bash-completion@2

# Ubuntu/Debian
sudo apt install bash-completion

# Fedora
sudo dnf install bash-completion
Add to your .bashrc:
if [ -f /etc/bash_completion ]; then
  . /etc/bash_completion
fi
Make sure you have these lines in your .zshrc before any completion initialization:
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit
If completions still don’t work, rebuild the completion cache:
rm ~/.zcompdump
compinit
Fish should automatically load completions from ~/.config/fish/completions/.Verify the file exists:
ls -la ~/.config/fish/completions/wezterm.fish
You can manually trigger a reload:
fish_update_completions

Updating Completions

When you update WezTerm, regenerate your completions to get completion support for new commands and options:
# Bash
wezterm shell-completion --shell bash > ~/.local/share/bash-completion/completions/wezterm

# Zsh
wezterm shell-completion --shell zsh > ~/.zsh/completions/_wezterm
rm ~/.zcompdump && compinit

# Fish
wezterm shell-completion --shell fish > ~/.config/fish/completions/wezterm.fish

See Also

Build docs developers (and LLMs) love