$spans | skip 1 | zoxide query -l ...$in | lines | where {|x| $x != $env.PWD}
}
```
This completer is not usable for almost every other command, so it's recommended to add it as an override in the [multiple completer](#multiple-completer):
```nu
{
z => $zoxide_completer
zi => $zoxide_completer
}
```
> **Note**
> Zoxide sets an alias (`z` by default) that calls the `__zoxide_z` function.
> If [alias completions](#alias-completions) are supported, the following snippet can be used instead:
>
> ```nu
> {
> __zoxide_z => $zoxide_completer
> __zoxide_zi => $zoxide_completer
> }
> ```
### Multiple completer
Sometimes, a single external completer is not flexible enough. Luckily, as many as needed can be combined into a single one. The following example uses `$default_completer` for all commands except the ones explicitly defined in the record:
```nu
let multiple_completers = {|spans|
match $spans.0 {
ls => $ls_completer
git => $git_completer
_ => $default_completer
} | do $in $spans
}
```
> **Note**
> In the example above, `$spans.0` is the command being run at the time. The completer will match the desired completer, and fallback to `$default_completer`.
>
> - If we try to autocomplete `git <tab>`, `spans` will be `[git ""]`. `match $spans.0 { ... }` will return the `$git_completer`.
> - If we try to autocomplete `other_command <tab>`, `spans` will be `[other_command ""]`. The match will fallback to the default case (`_`) and return the `$default_completer`.
## Troubleshooting
### Alias completions
Nushell currently has a [bug where autocompletions won't work for aliases](https://github.com/nushell/nushell/issues/8483). This can be worked around adding the following snippet at the beginning of the completer:
```nu
# if the current command is an alias, get it's expansion
let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion)
# overwrite
let spans = (if $expanded_alias != null {
# put the first word of the expanded alias first in the span
$spans | skip 1 | prepend ($expanded_alias | split row " " | take 1)