Shell Integration
Make aliases available as real shell commands.
How the hook works
Section titled “How the hook works”Every new shell session evaluates the hook, which calls
qwik init <shell> and generates native alias/function definitions from the
store. That means edits made anywhere — qwik edit, imports, sync pulls —
appear automatically in every new session.
One-time setup
Section titled “One-time setup”bash:
qwik init bash --installsource ~/.bashrczsh:
qwik init zsh --installsource ~/.zshrcfish:
qwik init fish --installsource ~/.config/fish/config.fishPowerShell:
qwik init pwsh --installThe --install flag:
- Creates a timestamped backup of your rc file
- Appends the hook (idempotent — safe to run multiple times)
Manual setup
Section titled “Manual setup”If you prefer to edit your rc file directly, qwik init <shell> prints the
hook:
eval "$(qwik init zsh)"Or paste the printed snippet into your rc file by hand.
Per-shell rendering
Section titled “Per-shell rendering”The hook generates native aliases/functions for each shell:
| Shell | Append mode | Template mode |
|---|---|---|
| bash / zsh | alias gs='git status' |
gs() { git checkout "$1" ; } |
| fish | alias gs 'git status' |
function gs ; … ; end |
| PowerShell | function gs { & ([ScriptBlock]::Create('git status')) @args } |
function gs { qwik run "gs" @args } |
| nu | def gs [...args] { qwik run "gs" ...$args } |
def gs [...args] { qwik run "gs" ...$args } |
| cmd | doskey gs=git status $* |
(best-effort, no template) |
PowerShell’s append mode wraps the command as a string literal compiled into
a script block at call time rather than splicing it into the function body
as source, and cmd’s doskey macros are $/metacharacter-escaped — both so
a command containing }, &, $, or another shell’s syntax can’t break
out of the generated definition. Nu has no equivalent to pwsh’s
compiled-string script block, so both modes delegate to qwik run.
Supported characters in a command are documented per shell in the
Shell Quoting & Escaping reference.
Disabling or removing aliases
Section titled “Disabling or removing aliases”qwik disable gs— hides the alias from the generated hook without deleting it;qwik enable gsbrings it backqwik rm gs— removes it from the store entirely (with a backup)
The regenerated hook in the next session reflects the change; the current session keeps its generated definitions until restarted.
Variable expansion behavior
Section titled “Variable expansion behavior”On cmd and pwsh, %VAR% and $VAR in alias commands are expanded by the
shell at run time, not treated as literal text. qwik add warns when it
detects these patterns. On bash/zsh/fish, $VAR expansion is the expected
behavior and no warning is shown. When the active shell is cmd and a
template alias ({1}, {name}) is created, qwik add also warns that
cmd/doskey cannot expand parameters and the alias will be omitted from cmd
hooks.
WSL, Git Bash, and mixed environments
Section titled “WSL, Git Bash, and mixed environments”Shell detection picks the renderer by the shell that will actually run the
command — not the host platform. Running POSIX bash under WSL on a Windows
host gets POSIX quoting; running PowerShell on Linux gets PowerShell
quoting. If auto-detection picks the wrong shell in an unusual setup, force
it with the QWIK_SHELL environment variable:
export QWIK_SHELL=bash # bash, zsh, fish, pwsh, cmd, nu, or xonshqwik doctor # confirm what qwik detectedSupported shells
Section titled “Supported shells”qwik init supports: bash, zsh, fish, pwsh, plus rendering for
cmd, nu, and xonsh. Third-party shells can register additional
renderers via the Plugin System.