From 71c5944bf851e90a30ecbf558e9ba702721c0362 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sun, 24 Feb 2019 12:34:40 +0100 Subject: [PATCH] Simplify zsh config file structure --- ...nt => 0-dotfiles-version-control-commands} | 0 .config/zsh/{01-history => 0-history} | 0 ...glob-expansion => 0-inline-glob-expansion} | 0 ...ion-dialog => 0-screen-information-dialog} | 0 ...ale-to-us-utf8 => 0-set-locale-to-us-utf8} | 0 ...n => 1-enable-command-spelling-correction} | 0 ... 1-report-time-for-long-running-processes} | 0 ...rlevel9k => 1-set-up-powerlevel9k-theming} | 0 ...guration => 1-ssh-agent-autoconfiguration} | 0 ...ocompletion => 3-configure-autocompletion} | 0 ...dot => 3-disable-enhancd-dot-dot-behavior} | 0 ...-manager => 5-install-tmux-plugin-manager} | 0 .config/zsh/{32-aliases-base => 6-base} | 0 .config/zsh/{35-alias-k-to-l => 6-l-calls-k} | 0 .config/zsh/{33-alias-mkcd => 6-mkcd} | 0 ...alias-show-newest-files => 6-newest-files} | 0 ...h-tmux-attaching => 6-ssht-tmux-attaching} | 0 ...h-variable => 9-deduplicate-path-variable} | 0 .zshrc | 52 +++++++++++-------- 19 files changed, 31 insertions(+), 21 deletions(-) rename .config/zsh/{04-set-up-dotfiles-repo-management => 0-dotfiles-version-control-commands} (100%) rename .config/zsh/{01-history => 0-history} (100%) rename .config/zsh/{02-inline-glob-expansion => 0-inline-glob-expansion} (100%) rename .config/zsh/{03-screen-information-dialog => 0-screen-information-dialog} (100%) rename .config/zsh/{05-set-locale-to-us-utf8 => 0-set-locale-to-us-utf8} (100%) rename .config/zsh/{13-command-spelling-correction => 1-enable-command-spelling-correction} (100%) rename .config/zsh/{10-report-time-for-long-running-processes => 1-report-time-for-long-running-processes} (100%) rename .config/zsh/{15-theme-powerlevel9k => 1-set-up-powerlevel9k-theming} (100%) rename .config/zsh/{12-ssh-agent-autoconfiguration => 1-ssh-agent-autoconfiguration} (100%) rename .config/zsh/{30-configure-autocompletion => 3-configure-autocompletion} (100%) rename .config/zsh/{36-disable-enhancd-double-dot => 3-disable-enhancd-dot-dot-behavior} (100%) rename .config/zsh/{16-install-tmux-plugin-manager => 5-install-tmux-plugin-manager} (100%) rename .config/zsh/{32-aliases-base => 6-base} (100%) rename .config/zsh/{35-alias-k-to-l => 6-l-calls-k} (100%) rename .config/zsh/{33-alias-mkcd => 6-mkcd} (100%) rename .config/zsh/{34-alias-show-newest-files => 6-newest-files} (100%) rename .config/zsh/{37-alias-ssh-tmux-attaching => 6-ssht-tmux-attaching} (100%) rename .config/zsh/{31-deduplicate-path-variable => 9-deduplicate-path-variable} (100%) diff --git a/.config/zsh/04-set-up-dotfiles-repo-management b/.config/zsh/0-dotfiles-version-control-commands similarity index 100% rename from .config/zsh/04-set-up-dotfiles-repo-management rename to .config/zsh/0-dotfiles-version-control-commands diff --git a/.config/zsh/01-history b/.config/zsh/0-history similarity index 100% rename from .config/zsh/01-history rename to .config/zsh/0-history diff --git a/.config/zsh/02-inline-glob-expansion b/.config/zsh/0-inline-glob-expansion similarity index 100% rename from .config/zsh/02-inline-glob-expansion rename to .config/zsh/0-inline-glob-expansion diff --git a/.config/zsh/03-screen-information-dialog b/.config/zsh/0-screen-information-dialog similarity index 100% rename from .config/zsh/03-screen-information-dialog rename to .config/zsh/0-screen-information-dialog diff --git a/.config/zsh/05-set-locale-to-us-utf8 b/.config/zsh/0-set-locale-to-us-utf8 similarity index 100% rename from .config/zsh/05-set-locale-to-us-utf8 rename to .config/zsh/0-set-locale-to-us-utf8 diff --git a/.config/zsh/13-command-spelling-correction b/.config/zsh/1-enable-command-spelling-correction similarity index 100% rename from .config/zsh/13-command-spelling-correction rename to .config/zsh/1-enable-command-spelling-correction diff --git a/.config/zsh/10-report-time-for-long-running-processes b/.config/zsh/1-report-time-for-long-running-processes similarity index 100% rename from .config/zsh/10-report-time-for-long-running-processes rename to .config/zsh/1-report-time-for-long-running-processes diff --git a/.config/zsh/15-theme-powerlevel9k b/.config/zsh/1-set-up-powerlevel9k-theming similarity index 100% rename from .config/zsh/15-theme-powerlevel9k rename to .config/zsh/1-set-up-powerlevel9k-theming diff --git a/.config/zsh/12-ssh-agent-autoconfiguration b/.config/zsh/1-ssh-agent-autoconfiguration similarity index 100% rename from .config/zsh/12-ssh-agent-autoconfiguration rename to .config/zsh/1-ssh-agent-autoconfiguration diff --git a/.config/zsh/30-configure-autocompletion b/.config/zsh/3-configure-autocompletion similarity index 100% rename from .config/zsh/30-configure-autocompletion rename to .config/zsh/3-configure-autocompletion diff --git a/.config/zsh/36-disable-enhancd-double-dot b/.config/zsh/3-disable-enhancd-dot-dot-behavior similarity index 100% rename from .config/zsh/36-disable-enhancd-double-dot rename to .config/zsh/3-disable-enhancd-dot-dot-behavior diff --git a/.config/zsh/16-install-tmux-plugin-manager b/.config/zsh/5-install-tmux-plugin-manager similarity index 100% rename from .config/zsh/16-install-tmux-plugin-manager rename to .config/zsh/5-install-tmux-plugin-manager diff --git a/.config/zsh/32-aliases-base b/.config/zsh/6-base similarity index 100% rename from .config/zsh/32-aliases-base rename to .config/zsh/6-base diff --git a/.config/zsh/35-alias-k-to-l b/.config/zsh/6-l-calls-k similarity index 100% rename from .config/zsh/35-alias-k-to-l rename to .config/zsh/6-l-calls-k diff --git a/.config/zsh/33-alias-mkcd b/.config/zsh/6-mkcd similarity index 100% rename from .config/zsh/33-alias-mkcd rename to .config/zsh/6-mkcd diff --git a/.config/zsh/34-alias-show-newest-files b/.config/zsh/6-newest-files similarity index 100% rename from .config/zsh/34-alias-show-newest-files rename to .config/zsh/6-newest-files diff --git a/.config/zsh/37-alias-ssh-tmux-attaching b/.config/zsh/6-ssht-tmux-attaching similarity index 100% rename from .config/zsh/37-alias-ssh-tmux-attaching rename to .config/zsh/6-ssht-tmux-attaching diff --git a/.config/zsh/31-deduplicate-path-variable b/.config/zsh/9-deduplicate-path-variable similarity index 100% rename from .config/zsh/31-deduplicate-path-variable rename to .config/zsh/9-deduplicate-path-variable diff --git a/.zshrc b/.zshrc index fe20e97..5390abc 100644 --- a/.zshrc +++ b/.zshrc @@ -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