-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcompletion
74 lines (63 loc) · 2.3 KB
/
completion
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# bash/completion
# ---
# github.com/rafi/.config
# shellcheck disable=1091,1090
# Archlinux loads bash completions from /etc automatically
# https://wiki.archlinux.org/index.php/Bash#Configuration_files
# Deal with other operating-systems...
# macOS / Darwin
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS Homebrew bash completions
if [[ -f "/opt/homebrew/etc/profile.d/bash_completion.sh" ]]; then
# Load entire Homebrew installed software's bash completion
# export BASH_COMPLETION_DEBUG=1
source "/opt/homebrew/etc/profile.d/bash_completion.sh"
else
for COMPLETION in "/opt/homebrew/etc/bash_completion.d/"*; do
[[ -r "${COMPLETION}" ]] && source "${COMPLETION}"
done
fi
# Add tab completion for `defaults read|write NSGlobalDomain`
# You could just use `-g` instead, but I like being explicit
complete -W "NSGlobalDomain" defaults
# Add `killall` tab completion for common apps
complete -o "nospace" -W "Contacts Calendar Dock Finder Mail Safari iTunes SystemUIServer Terminal Twitter" killall
elif [ -f /etc/lsb-release ]; then
# Ubuntu/Debian manual bash completions loading
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# # Load git bash prompt helper, if not loaded already
# # https://github.com/git/git/blob/master/contrib/completion
# if [ -z "$(LC_ALL=C type -t __git_ps1)" ]; then
# for dir in \
# etc/bash_completion.d \
# share/git/contrib/completion \
# share/git/completion \
# share/git-core/contrib/completion
# do
# if [ -f "$PREFIX/$dir/git-prompt.sh" ]; then
# . "$PREFIX/$dir/git-prompt.sh" && break
# fi
# done
# unset dir
# fi
# Complete-alias is used to auto-complete bash aliases.
# https://github.com/cykerway/complete-alias
if [ -f "$PREFIX/etc/profile.d/complete_alias" ]; then
source "$PREFIX/etc/profile.d/complete_alias"
fi
# Event pre/post bash hooks implementation.
# https://github.com/rcaloras/bash-preexec
if [ -f "$PREFIX/etc/profile.d/bash-preexec.sh" ]; then
source "$PREFIX/etc/profile.d/bash-preexec.sh"
fi
# Google Cloud SDK
if [ -f "$XDG_DATA_HOME/google-cloud-sdk/completion.bash.inc" ]; then
source "$XDG_DATA_HOME/google-cloud-sdk/completion.bash.inc"
fi
# vim: set ft=sh ts=2 sw=2 tw=80 noet :