Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: autocompletion's odd behaviour with packages installed through pip
- X-seq: zsh-workers 53043
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: Silejonu <silejonu@xxxxxxxx>
- Subject: Re: autocompletion's odd behaviour with packages installed through pip
- Date: Thu, 22 Aug 2024 12:16:37 +0900
- Archived-at: <https://zsh.org/workers/53043>
- In-reply-to: <O4qTABW--B-9@tuta.com>
- List-id: <zsh-workers.zsh.org>
- References: <O4qTABW--B-9@tuta.com>
> 2024/08/22 4:45, Silejonu <silejonu@xxxxxxxx> wrote:
>
> Steps to reproduce:
> • `python -m venv /tmp/test`
> • `source /tmp/test/bin/activate`
> • `pip install ansible`
> • Type `ans` and hit tab to autocomplete
> • Nothing happens (though syntax highlighting recognizes than `ansible` is a valid command)
This is not specific to pip.
zsh keeps an internal hash for all the commands in the PATH,
and this hash is not automatically updated when a new command
is added to your PATH.
A simple workaround is to manually run the rehash (or 'hash -r')
builtin to update the hash ('source activate' also does this):
% pip install ansible
% rehash
% ansi<TAB>
If you feel typing 'rehash' is tedious, then you can put
zstyle ':completion:*:commands' rehash on
into your .zshrc. Then 'rehash' is run every time you complete
a command name. If you don't notice any slowdown then this may be
the easiest solution.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author