-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.completions
More file actions
49 lines (43 loc) · 1.87 KB
/
.completions
File metadata and controls
49 lines (43 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Add custom FPATH directory.
# This can be used to add any extra completions from packages that are not managed by brew.
# It must be defined before compinit
FPATH=~/.zfunc:$FPATH
#
# To make Homebrew’s completions available in zsh,
# you must get the Homebrew-managed zsh site-functions on your FPATH
# before initialising zsh’s completion facility.
# Add the following to your ~/.zshrc file:
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
fi
# This must be done before compinit is called.
# Note that if you are using Oh My Zsh, it will call compinit for you,
# so this must be done before you call oh-my-zsh.sh.
#
# Checkout brew completion instructions here for alternatives:
# https://docs.brew.sh/Shell-Completion
# The next line enables shell command completion for gcloud.
if [ -f "$HOME/workspace/tools/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/workspace/tools/google-cloud-sdk/completion.zsh.inc"; fi
# Initialize completion
autoload -Uz compinit compaudit
# Check for insecure directories.
# Insecure directories are directories that are not owned by the current user or by root.
# But on work computers `workbrew` is also a user with permissions to install packages and we want to allow that.
insecure=$(compaudit 2>&1 | grep '^/')
if [[ -n "$insecure" ]]; then
owners=$(echo "$insecure" | xargs -I{} stat -f '%Su' {} | sort -u)
# Are all insecure files owned by `workbrew`?
if [[ "$owners" == "workbrew" ]]; then
compinit -u
else
echo "Insecure files owned by unexpected users:"
echo "$insecure" | while read -r file; do
owner=$(stat -f '%Su' "$file")
[[ "$owner" != "workbrew" ]] && echo " $file ($owner)"
done
compinit
fi
else
compinit
fi
[ -f "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"