-
Notifications
You must be signed in to change notification settings - Fork 2
/
dotfiles.sh
75 lines (64 loc) · 1.47 KB
/
dotfiles.sh
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
75
# shellcheck shell=bash
# This is the core script for loading all of the dotfiles in this directory.
configure() {
if [ -z "$2" ] || [ "$(basename "$1")" != "completion.$2" ]; then
if [ "$(dirname "$1")" != "${DOTFILES}/installers" ]; then
if [ -e "$1" ] && ! [ -x "$1" ]; then
# shellcheck disable=SC1090
source "$1"
fi
fi
fi
}
# use .localrc for SUPER SECRET CRAP that you don't
# want in your public, versioned repo.
if [ -r "${HOME}/.localrc" ];
then
configure "${HOME}/.localrc"
fi
# First, grab the path manipulation functions, etc.
for filename in "$DOTFILES"/core/*.sh
do
configure "$filename" "sh"
done
# Now grab base shell files.
for filename in "$DOTFILES"/*/*.sh
do
configure "$filename" "sh"
done
# Shell files specific to a shell
if [ -n "$BASH" ]; then
for filename in "$DOTFILES"/*/*.bash
do
configure "$filename" "bash"
done
fi
if [ -n "$ZSH_NAME" ]; then
for filename in "$DOTFILES"/*/*.zsh
do
configure "$filename" "zsh"
done
fi
# Load completion scripts
for filename in "$DOTFILES"/*/completion.sh
do
# shellcheck disable=SC1090
source "$filename"
done
if [ -n "$BASH" ]; then
for filename in "$DOTFILES"/*/completion.bash
do
# shellcheck disable=SC1090
source "$filename"
done
fi
if [ -n "$ZSH_NAME" ]; then
for filename in "$DOTFILES"/*/completion.zsh
do
# shellcheck disable=SC1090
source "$filename"
done
# initialize autocomplete here, otherwise functions won't be loaded
autoload -U compinit
compinit
fi