Simplify zsh config file structure

This commit is contained in:
Marty Oehme 2019-02-24 12:34:40 +01:00
parent 7bdf7ab1cd
commit 71c5944bf8
19 changed files with 31 additions and 21 deletions

52
.zshrc
View file

@ -44,32 +44,42 @@ check_zgen_installation() {
unset ZGEN_PARENT_DIR
}
## //FIXME: Not working yet, globbing not working
#load_config_files() {
# if [ -n "$(/bin/ls $1)" ]; then
# #GLOB=(${1}/[0-1][0-9]-*)
# for dotfile in $(eval "echo {$1/$2}"); do
# print_dbg "TESTING: $dotfile\n" #//DEBUG
# if [ -r "${dotfile}" ]; then
# source "${dotfile}"
# fi
# done
# unset GLOB
# fi
#}
load_config_files() {
if [ -n "$(/bin/ls $1)" ]; then
# load the files in number range provided
GLOB=(${1}/[${2}][0123456789-]*)
for dotfile in $GLOB; do
if [ -r "${dotfile}" ]; then
print_dbg "Loading $dotfile\n"
source "${dotfile}"
fi
done
unset GLOB
fi
}
#### ZSHrc - Setting up the Shell
##
## Almost all actual setup is being done with the help of individual files
## in the .zsh.d/ directory. This file just loads them. They follow a specific order:
## in the .config/zsh directory. This file just loads them. They follow this order:
##
## 00-09 are bootstrapping the zsh environment, setting aliases and sane
## shell defaults which should need no changes (though you can of course).
## 10-19 allow custom bootstrapping of things that need to be set before any
## zsh plugins are loaded (in my case, theme environment vars, etc)
## 20-29 are run *during* zgen setup and can include plugins to be loaded
## 30-99 are run after plugins are loaded and can be configured
## in whatever way you wish
## 0 are bootstrapping the zsh environment, setting aliases and sane
## shell defaults which should need no further changes.
## 1 allow custom bootstrapping of things that need to be set before any
## zsh plugins are loaded (e.g., theme environment vars, etc)
## 2 are run *during* zgen setup and can include plugins to be loaded
## 3 script & plugin configurations without *external* dependencies (i.e. can run with
## only what the dotfiles supply) They are run after plugins are loaded and can be configured
## in whatever way you wish. If you change the plugin setup, you may need to reconfigure here.
## 5 commands *with* external script dependencies (e.g. python, mpv, etc.). Scripts should
## check for their dependencies before enabling their commands. It makes scripts more readable
## to begin with their depency in the name, i.e. '5-python-mpv-spawn-unique-player-with-umpv'
## 6 Aliasing.
## 7,8 No default behavior, use however you like.
## 9 anything which has to run at the very end
##
## The running order can further be specified by having a second number, which will then run through
## them in the numbered order.
##
## Most of them are documented, and they try to have sensible naming.
## If you want to supply your own directory of zsh config files you can do so