Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework completions section in docs #5879

Merged
merged 5 commits into from
Jun 21, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 42 additions & 16 deletions docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,42 +282,68 @@ To uninstall Poetry, simply delete the entire `$VENV_PATH` directory.
`poetry` supports generating completion scripts for Bash, Fish, and Zsh.
See `poetry help completions` for full details, but the gist is as simple as using one of the following:

### Bash

There are few options in `bash`, choose the one that suits your workflow.
Secrus marked this conversation as resolved.
Show resolved Hide resolved

#### Local, recommended
Secrus marked this conversation as resolved.
Show resolved Hide resolved

```bash
# Bash
poetry completions bash > /etc/bash_completion.d/poetry
poetry completions bash >> ~/.bash_completion
```

# Fish
poetry completions fish > ~/.config/fish/completions/poetry.fish
#### Local, based on XDG directory spec
Secrus marked this conversation as resolved.
Show resolved Hide resolved

# Zsh
poetry completions zsh > ~/.zfunc/_poetry
```bash
poetry completions bash > ${XDG_DATA_HOME:~/.local/share}/bash_completion/completions/poetry
```

# Oh-My-Zsh
mkdir $ZSH_CUSTOM/plugins/poetry
poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry
#### Global, might require root priviledges
Secrus marked this conversation as resolved.
Show resolved Hide resolved

# prezto
poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry
```bash
poetry completions bash > /etc/bash_completion.d/poetry
```

### Fish

```fish
poetry completions fish > ~/.config/fish/completions/poetry.fish
```

{{% note %}}
You may need to restart your shell in order for the changes to take effect.
{{% /note %}}
### Zsh

```zsh
poetry completions zsh > ~/.zfunc/_poetry
```

For `zsh`, you must then add the following lines in your `~/.zshrc`
You must then add the following lines in your `~/.zshrc`
Secrus marked this conversation as resolved.
Show resolved Hide resolved

```bash
fpath+=~/.zfunc
autoload -Uz compinit && compinit
```

For `oh-my-zsh`, you must then enable poetry in your `~/.zshrc` plugins
#### Oh-My-Zsh
Secrus marked this conversation as resolved.
Show resolved Hide resolved

```zsh
mkdir $ZSH_CUSTOM/plugins/poetry
poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry
```
You must then enable poetry in your `~/.zshrc` plugins
Secrus marked this conversation as resolved.
Show resolved Hide resolved

```text
plugins(
poetry
...
)
```

#### prezto

```zsh
poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry
```

{{% note %}}
You may need to restart your shell in order for the changes to take effect.
Secrus marked this conversation as resolved.
Show resolved Hide resolved
{{% /note %}}