Silence compinit when it finds shared Homebrew stuff

This commit is contained in:
Sami Samhuri 2020-05-14 16:39:55 -07:00
parent 6f4227376c
commit 0b9c6abef6

13
zshrc
View file

@ -290,8 +290,21 @@ bindkey -e # emacs style key bindings
# 10. Completion
# =============
autoload -Uz compinit
# Sharing Homebrew in /usr/local with multiple users on the same machine means
# that group writable files in /usr/local are deemed insecure. But I'm the only
# actual user so tell compinit not to bother me about compaudit's complaints.
is_group_writable() {
local ls=$(ls -ld "$1")
[[ "${ls:5:1}" = "w" ]]
}
if mac && is_group_writable /usr/local/share; then
compinit -u
else
compinit
fi
# 11. SSH Keychain
# ================