Comments (9)
Well, I suggested you try the standalone-file-in-the-completions-directory route, mainly as a measure of debugging.
if it works in this approach - it means your zshrc is not loaded properly.
If it does not work - it means the zsh bash completion functions are not working properly.
Also simple test: If you do source ~/.zshrc
in a terminal where it does not work - does it start to work?
And - sine you have oh-my-zsh - I believe you do not need the autoload calls - oh-my-zsh should already be taking care of this.
Finally - when testing a new approach, be sure to start from a completely new zsh terminal - as I don't know what misconfiguration is carried over to the subshells you open.
Other than this, I am pretty much out of ideas...
from completely.
Excellent, thanks for reporting.
No need for autoload or compinit stuff.
I suspect something loads it for you. If you have OhMyZsh, I think it does this.
from completely.
Well, I can try, but I am not a zsh user myself, so I can only propose some thing sto try.
First of all - we are talking about ~/.zshrc
- in your home directory yes? if so, then you should not need to source it - any new zsh terminal you open should source it on its own. To test it put some "export WORKS=1" in it or something, to verify it is loaded.
If it isn't, then perhaps there is another initialization script that zsh loads instead of this one.
Another thing to consider, is are you using oh-my-zsh or not. I believe oh-my-zsh already comes with these autoload
commands.
Finally - instead of using eval
to add the completion script to the system, there are alternative ways - like putting the completions script in the completions directory. See if your system has any of these directories, and you can put the script there:
/usr/share/bash-completion/completions
/usr/local/etc/bash_completion.d
from completely.
Hi @DannyBen. Thanks for the quick reply!
Yes I meant ~/.zshrc
and I don't source when opening a new terminal, as like you said opening a new terminal sources it on it's own. It does get loaded properly as I have some exports already working there for example.
I am using oh-my-zsh
yes, and so are my colleagues but unfortunately I can't get it to work on my system.
I have the the first directory you mentioned:
/usr/share/bash-completion/completions
and it's quite populated. Should I create a symlink here to the scripts that are generated by bashly i.e. to send_completions.sh
?
And in this case what should I have in ~/.zshrc
if anything?
Once again thanks a lot for all the help
from completely.
Hmm. Ok - since you have oh-my-zsh
- I would try these actions:
- From your
~/.zshrc
- comment out the twoautoload
functions - I know that if these are called more than once they may cause a problem. What we are trying to test here, is perhapsoh-my-zsh
loads these functions elsewhere. - Leave the
eval
in there for the time being. - Start a fresh new terminal, see if it works.
If you gat any error now about complete: function not found
than we need to bring the two autoload
calls back.
If you get no error, but the completions are not working, try typing the eval
in the command line:
eval "$(my_script completions)"
If after this, you DO have completions, then it is definitely something fishy in your zsh init, and probably beyond the scope of my understanding.
Finally, if we are still not operational at this point, I would also remove the eval
from the ~/.zshrc
and instead, put the completions script in the directory we mentioned earlier.
Take a look at some of the other scripts that exist there, to get an idea of how they should look.
To get a similar script to put there, you can run bashly add comp script my-completions.bash
.
And - just to make sure I got it correctly - you are saying that it works ok on other zsh systems? Are they using the same content in their ~/.zshrc
? If you have a working system, it would be interesting to compare the two.
from completely.
Hmm. Ok - since you have
oh-my-zsh
- I would try these actions:
- From your
~/.zshrc
- comment out the twoautoload
functions - I know that if these are called more than once they may cause a problem. What we are trying to test here, is perhapsoh-my-zsh
loads these functions elsewhere.- Leave the
eval
in there for the time being.- Start a fresh new terminal, see if it works.
If you gat any error now about
complete: function not found
than we need to bring the twoautoload
calls back.
Just did this, no errors on new terminal, but the same happens. I change ~/.zshrc
, open a new terminal it works, open another terminal it doesn't work. (It keeps working in the previous terminal however).
If you get no error, but the completions are not working, try typing the
eval
in the command line:eval "$(my_script completions)"
If I do this in the terminal where it doesn't work, nothing happens, and it still doesn't work. If I do it on the terminal where it works, nothing happens and it still works.
If after this, you DO have completions, then it is definitely something fishy in your zsh init, and probably beyond the scope of my understanding.
Finally, if we are still not operational at this point, I would also remove the
eval
from the~/.zshrc
and instead, put the completions script in the directory we mentioned earlier.Take a look at some of the other scripts that exist there, to get an idea of how they should look. To get a similar script to put there, you can run
bashly add comp script my-completions.bash
.
Ideally I would still be able to do this off the send_completions.sh
, just because we have this in a repo and it is updated quite often.
And - just to make sure I got it correctly - you are saying that it works ok on other zsh systems? Are they using the same content in their
~/.zshrc
? If you have a working system, it would be interesting to compare the two.
Yes, in a laptop from a colleague of mine he has eval "$(sfl completions)"
in his ~/.zshrc
and it worked. He did try the autoload commands and eventually it started working and it never stopped. He also just installed zsh and oh-my-zsh recently so everything is rather clean.
Re installing my zsh will be my final resort but I wanted to avoid that just for all the work it entails.
from completely.
I am closing this. If new facts come to light we can reopen.
from completely.
FYI I solved this today.
I had source zsh-snap
line on my .zshrc
which I removed. I suspect this sourced a zsh-autocomplete
package, and that was probably messing it up.
So now I just have the eval "$(script comp)"
and everything is fine. No need for autoload
or compinit
stuff.
from completely.
Excellent, thanks for reporting.
No problem. And thank you for the information and help.
No need for autoload or compinit stuff.
I suspect something loads it for you. If you have OhMyZsh, I think it does this.
Correct. I was just restating this. Indeed it is expected that OhMyZsh does this according to the documentation so it is not necessary.
from completely.
Related Issues (20)
- Allow saving the tester script
- completion breaks on spaces in paths HOT 7
- Docker support HOT 7
- Are there other expressions than wildcard *? HOT 1
- Option to only complete flags when `-` has been typed HOT 16
- Wildcards after the first word are not working
- Running `completely test` should also show a warning when the file is invalid
- Completion for command --option=value HOT 4
- Add JSON schema for config HOT 2
- Add test for JSON schema
- handle positional arguments HOT 3
- Create an `Installer` model to allow installing from Ruby code
- Could we use another program completion ? HOT 3
- Question: how to define completion rule for a `--option FILE` option? HOT 1
- Support generating Zsh specific completion files HOT 7
- Update the Zsh instructions on how to correctly use the Bash completions HOT 10
- Question: is it possible to not match unknown patterns? HOT 5
- QUESTION: complete a term with a colon / : HOT 13
- ZSH compatibility test fails silently HOT 2
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 completely.