Problem
When you use zsh in cygwin, and you run cygwin as another user as you installed cygwin, autocomplete in zsh may not work.When calling
$ compinit
you may recive the following message:
Ignore insecure directories and files and continue [y] or abort compinit [n]?
Pressing y will continue, but autocomplete will still not work.
$ compaudit
will show you the insecure directories.
There are some solutions in the internet, they didn't worked for me:
$compaudit | xargs chmod g-w
or
$compaudit | xargs chmod 550
It does not matter, if you use chmod manually on the specific directories, of if you even use chmod 0 (for testing).
This problem occurs only, when running cygwin as another user as you installed cygwin. And it may only occur, when this running user is an administrator (not tested with unprivileged user). The problem may be: As Administrator, you can "always" modify files, even if chmod disallows this. compinit does not know about this situation (its a unix app), but it finds out, that you have write acess to it - that's the problem.
Solution
The solution is simple: copy all insecure directores (call compaudit to show them) to your local profile and rewrite the $fpath variable.Copy the zsh files to your local profile
cp -r /usr/share/zsh ~/.zsh
To change the $fpath variable, add in ~/.zshrc
fpath=(~/zsh/site-functions ~/.zsh/5.0.2/functions) # note: replace zsh-version with the needed one
Warning: if $fpath will accidently will be non valid (for example, changing $fpath befor copy the files), your zsh will stop working! To be sure, you should have bash as default shell, while modifying this.
When you are using prezto, you need to add it to ~/.zpreztorc !
After that, you need to delete ~/.zcompdump and ~/.zcompdump.zwc and restart zsh.
This solution seems not to be very clean, but it's the only working solution i found out. If you have an better suggestion, please let me know.
Happy autocompleting!
Thanks, this saved me a headache.
ReplyDeleteThank you thank you thank you
ReplyDeleteThanks a ton ! saved me the effort to reinstall zsh
ReplyDeletebons casino - Injapan
ReplyDeletebons casino is one of the best online casinos that we ボンズ カジノ have in 메리트카지노 mind for 2021. You can get it to an amazing, world-class gaming environment and you