summaryrefslogtreecommitdiffstats
path: root/bashrc/common/bashcomp.sh
blob: fbf93878592d10df6c22082393a427bde0a70853 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# bash completion

if [[ -f /etc/profile.d/bash-completion.sh ]]; then
	 . /etc/profile.d/bash-completion.sh
else
	bmajor=${BASH_VERSION%%.*}
	bminor=${BASH_VERSION#*.}
	bminor=${bminor//[^0-9]*}

	if [[ ${bmajor} -eq 2 && ${bminor} -gt 4 ]] || [[ ${bmajor} -gt 2 ]]; then
		[[ -f /etc/bash_completion ]] && source /etc/bash_completion

		if [[ -d ~/.bash_completion.d ]]; then
			for i in ~/.bash_completion.d/*; do
				[[ -f ${i} ]] && source ${i}
			done
		fi
	fi

	unset bmajor bminor
fi

export COMP_WORDBREAKS=${COMP_WORDBREAKS/:/}
export FIGNORE=".o:~"