Comments (8)
I tried installing the completion via antibody, which loads the plugin into
$fpath
fine. However, it does not work in my dotfiles due my placement ofautoload -U compinit; compinit
. For all of my other completion settings (including https://github.com/zsh-users/zsh-completions/),compinit
must be run before they are sourced. By contrast, conda-zsh-completion requires thatcompinit
be run after it is sourced. So my .zshrc ends up looking like:autoload -U compinit; compinit source /path/to/completion_settings.zsh # includes the zstyle commands for conda-zsh-completion source /antibody/plugin/source.zsh # includes conda-zsh-completion in $fpath compinit # only required for conda-zsh-completionTwo primary questions:
- Why this completion plugin is different to the others?
- Whether this can be changed to match the behavior?
I'm not familiar enough with zsh completions to figure out the answers to either of these unfortunately.
I am not very well versed in zsh either, unfortunately, but I did ask some people "in the know" on the libera IRC chat and the response I received was:
for the compsys to notice a completer, it has to be in fpath before compinit is ran.
And:
all compinit is really doing is defining the compdef function, then search for files in fpath that begins with _ and has a magic comment #compdef so if you extend fpath after compinit is ran. nothing of interest will happen within the compsys
So, now I am very confused. Do you have any documentation on which plugins suggest to run compinit
before adding to the path? I'd like to take a closer look.
from conda-zsh-completion.
Do you have any documentation on which plugins suggest to run compinit before adding to the path?
Not explicitly, but I had followed this guide to get everything setup.
Other than that, there are two cases that require it:
1. Plugins that call compdef
Instead of having a separate #compdef ___
file and relying on compinit
to be run after adding it to $fpath
, these define the completion function in their *.zsh
file (which is sourced by antibody
) and explicitly call compdef
to set the completion up. Example of this is the OMZ tmux plugin.
2. The anomalies I don't understand (https://github.com/zsh-users/zsh-completions/)
The https://github.com/zsh-users/zsh-completions/ appears to work pretty much exactly the same as yours. However, I was also seeing behavior for the https://github.com/zsh-users/zsh-completions/ plugin where it was required to run before for the completion to work. However, once I disabled the https://github.com/Aloxaf/fzf-tab plugin, then it works either way. Which makes no sense to me.
Other interesting attempts
Based on this, I went ahead and tried to add your _conda
file to the src
directory of the zsh-completions to allow it to load the conda completion file. However, doing this still requires running compinit
after zsh-completions is loaded. So it's definitely something to do with _conda
itself. As for what, I don't know.
For reference, I was testing the other zsh-complete completion functions for cmake and dhcpcd to verify whether it was _conda
or the whole of https://github.com/zsh-users/zsh-completions/ that was not loading correctly. I might check out those files to spot differences. The one for dhcpcd is very short.
from conda-zsh-completion.
Regarding the 2. anomaly, I've just seen that for https://github.com/Aloxaf/fzf-tab, it states that it is required to be loaded after compinit
. So since I use antibody to handle both completions and other zsh plugins, I have to run compinit
before anything is loaded. This in addition to reason 1. (which I use explicitly in my custom completions file and is used by the afore mentioned tmux plugin).
from conda-zsh-completion.
@jrwrigh ok, you clearly know more about zsh and completions than I do. I really haven't touched my setup for years now. If you figure out a solution, please do submit a pull-request. As for the issue. I'm not sure if it is a good idea to keep it open. It is more of a discussion than a bug to be fixed or a feature to be added?
from conda-zsh-completion.
I remember that I did use zsh-completions as an inspiration so it would make sense that the conda completion is similar to those.
from conda-zsh-completion.
Do you have any documentation on which plugins suggest to run compinit before adding to the path?
Not explicitly, but I had followed this guide to get everything setup. Other than that, there are two cases that require it:
1. Plugins that call
compdef
Instead of having a separate
#compdef ___
file and relying oncompinit
to be run after adding it to$fpath
, these define the completion function in their*.zsh
file (which is sourced byantibody
) and explicitly callcompdef
to set the completion up. Example of this is the OMZ tmux plugin.
As inefficient and non idiomatic as foregoing autoloadable functions for a completer, your example isn't doing that. it is creating a wrapper function for tmux
and associating the _tmux
completer provided by zsh
's source tree to the wrapper so it has the same completion as tmux
.
An example of this completer working fine when it is in fpath
prior to compinit
running; just like any other completer.
from conda-zsh-completion.
Circling back to this (after a hot minute), it turns out that my Manjaro installation automatically installs zsh-completions
to /usr/share/zsh/site-functions
. So the above behavior makes sense, the initial compinit
run was picking up the completions /usr/share/zsh/site-functions
rather than what was sourced by antibody. You must run compinit
after putting functions in $fpath
, but they can also be placed in path locations and be picked up there.
from conda-zsh-completion.
Circling back to this (after a hot minute), it turns out that my Manjaro installation automatically installs
zsh-completions
to/usr/share/zsh/site-functions
. So the above behavior makes sense, in that you must runcompinit
after putting functions in$fpath
and thezsh-completions
functions were already installed (not to$fpath
but at a location wherecompinit
could find it).
Thank you for circling back!
from conda-zsh-completion.
Related Issues (20)
- Error when mistype subcommand HOT 4
- How about a LICENSE file? HOT 2
- Documentation / HowTo? HOT 1
- Completions do not work at all for certain combinations of OS/conda/zsh/OMZ HOT 4
- `autoload -U compinit && compinit` has no effect unless put in the end of the file HOT 9
- Some bugs when completing -h and -V HOT 3
- Inefficient env list calculation HOT 1
- Installation is not working, any debugging tips? HOT 5
- Not working with Prezto HOT 1
- conda activate completion HOT 5
- Multi-user environments cannot completion HOT 2
- conda create fails on macOS HOT 1
- 'Conda activate' always completes with all environment variables HOT 15
- parse error near `^M' HOT 1
- Clarity for implementing for oh-my-zsh users HOT 4
- Create a tag for v0.10 HOT 4
- Adding custom env directory HOT 1
- Crashes when trying to complete `conda create --clone` HOT 6
- micromamba HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conda-zsh-completion.