refactor(zsh): simplify .zshrc
This commit is contained in:
parent
6c6b428883
commit
0b92af8398
1 changed files with 19 additions and 33 deletions
|
@ -1,37 +1,23 @@
|
||||||
# Enable extended globbing for use in _load_settings()
|
sources=(
|
||||||
setopt extendedglob
|
'aliases'
|
||||||
|
'colour'
|
||||||
|
'functions'
|
||||||
|
'fzf'
|
||||||
|
'general'
|
||||||
|
'git'
|
||||||
|
'history'
|
||||||
|
'navigation'
|
||||||
|
'nvm'
|
||||||
|
'options'
|
||||||
|
'path'
|
||||||
|
'platformsh'
|
||||||
|
'plugins'
|
||||||
|
'post/completion'
|
||||||
|
)
|
||||||
|
|
||||||
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
|
for s in "${sources[@]}"; do
|
||||||
# these are loaded first, second, and third, respectively.
|
source $HOME/.zsh/configs/${s}.zsh
|
||||||
_load_settings() {
|
|
||||||
_dir="$1"
|
|
||||||
if [ -d "$_dir" ]; then
|
|
||||||
if [ -d "$_dir/pre" ]; then
|
|
||||||
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
|
|
||||||
. $config
|
|
||||||
done
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
for config in "$_dir"/**/*(N-.); do
|
|
||||||
case "$config" in
|
|
||||||
"$_dir"/(pre|post)/*|*.zwc)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
. $config
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -d "$_dir/post" ]; then
|
|
||||||
for config in "$_dir"/post/**/*~*.zwc(N-.); do
|
|
||||||
. $config
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_load_settings "$HOME/.zsh/configs"
|
|
||||||
|
|
||||||
# Local config
|
# Local config
|
||||||
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
|
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue