> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/wezterm/wezterm/llms.txt
> Use this file to discover all available pages before exploring further.

# wezterm shell-completion

> Generate shell completion scripts for WezTerm commands

## Synopsis

```bash theme={null}
wezterm shell-completion --shell <SHELL>
```

## Description

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

## Options

<ParamField path="--shell" type="string" required>
  The shell to generate completions for.

  Supported shells:

  * `bash`
  * `fish`
  * `zsh`
  * `powershell`
  * `elvish`
  * `fig`
</ParamField>

## Installation

### Bash

```bash theme={null}
# 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:

```bash theme={null}
source ~/.bashrc
```

### Zsh

```bash theme={null}
# 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:

```bash theme={null}
exec zsh
```

### Fish

```bash theme={null}
# Generate and install completion script
wezterm shell-completion --shell fish > ~/.config/fish/completions/wezterm.fish
```

Fish will automatically load the completions.

### PowerShell

```powershell theme={null}
# 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:

```powershell theme={null}
. $PROFILE
```

### Elvish

```bash theme={null}
# 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:

```bash theme={null}
wezterm shell-completion --shell fig > ~/.fig/autocomplete/wezterm.js
```

## Usage

Once installed, you can use tab completion with WezTerm commands:

```bash theme={null}
# 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

<Accordion title="Completions not working in Bash">
  Ensure bash-completion is installed:

  ```bash theme={null}
  # macOS
  brew install bash-completion@2

  # Ubuntu/Debian
  sudo apt install bash-completion

  # Fedora
  sudo dnf install bash-completion
  ```

  Add to your `.bashrc`:

  ```bash theme={null}
  if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
  ```
</Accordion>

<Accordion title="Completions not working in Zsh">
  Make sure you have these lines in your `.zshrc` **before** any completion initialization:

  ```bash theme={null}
  fpath=(~/.zsh/completions $fpath)
  autoload -Uz compinit && compinit
  ```

  If completions still don't work, rebuild the completion cache:

  ```bash theme={null}
  rm ~/.zcompdump
  compinit
  ```
</Accordion>

<Accordion title="Completions not loading in Fish">
  Fish should automatically load completions from `~/.config/fish/completions/`.

  Verify the file exists:

  ```bash theme={null}
  ls -la ~/.config/fish/completions/wezterm.fish
  ```

  You can manually trigger a reload:

  ```bash theme={null}
  fish_update_completions
  ```
</Accordion>

## Updating Completions

When you update WezTerm, regenerate your completions to get completion support for new commands and options:

```bash theme={null}
# 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

* [CLI Overview](/cli/overview)
* [wezterm start](/cli/start)
* [wezterm ssh](/cli/ssh)
