xvc completions

Purpose

Xvc ships dynamic shell completions. When you press TAB, your shell calls Xvc to compute the candidates, so completions include values that a static script can't know in advance — pipeline names, step names, storage names, and even Xvc-tracked paths that aren't present in your workspace yet.

Enabling completions

Completions are driven by the COMPLETE environment variable: setting it makes xvc print a completion script for the named shell instead of running a command. Add the appropriate line to your shell's startup file once.

Bash

echo "source <(COMPLETE=bash xvc)" >> ~/.bashrc

Zsh

echo "source <(COMPLETE=zsh xvc)" >> ~/.zshrc

Fish

echo "source (COMPLETE=fish xvc | psub)" >> ~/.config/fish/config.fish

Elvish

echo "eval (E:COMPLETE=elvish xvc | slurp)" >> ~/.elvish/rc.elv

PowerShell

$env:COMPLETE = "powershell"
echo "xvc | Out-String | Invoke-Expression" >> $PROFILE
Remove-Item Env:\COMPLETE

Nushell

Nushell does not yet support the dynamic completion protocol. You can instead generate a static completion script with the xvc _comp helper and source it:

$ xvc _comp generate-nushell | save ($nu.config-path | path dirname | path join "xvc-completions.nu")
$ use ($nu.config-path | path dirname | path join "xvc-completions.nu") *

This provides completions for commands and options, but not for dynamic values like pipeline or storage names.

See also