From 27508e363c1f792077dcbcc30c58dd9b14d3786e Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Sat, 19 Jan 2019 19:43:37 -0500 Subject: [PATCH] Stop supporting themes that require prompinit Only 5% (18/342) of the themes listed under [unixorn/awesome-zsh-plugins] are actually compatible with prompinit. Of these, [clean] also allows being sourced directly. On the other hand, 3 others are prezto themes. promptinit would be useful for who wants to try many themes without the need to restart their shell session. And must be many many, so "brute-force" starting a new shell to experiment each new theme would be a burden! Even the cleanup feature of promptinit is still incomplete, so you eventually get a messy prompt after trying many with it. And that's not even a everyday use case of the average Zsh user. So prompinit it not widely supported out there, and also not very useful for the everyday let-me-use-my-beloved-and-carefully-customized-prompt-during-the-whole-shell-session-pleasee scenario. It's also faster and simpler to directly just source the prompt theme to be used, not even having to autoload promptinit and let it scan all the others themes in fpath that won't be used. And the Zim "philosophy" is to use fast and simple solutions. So here we go. Fixes #325 [unixorn/awesome-zsh-plugins]: https://github.com/unixorn/awesome-zsh-plugins/blob/e226f3de041a707acbdc361356bb0eb6ff20bd57/README.md#themes [clean]: https://github.com/BrandonRoehl/zsh-clean --- README.md | 15 --------------- init.zsh | 10 ++++------ templates/zimrc | 14 ++++---------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index d0082ca..f042651 100644 --- a/README.md +++ b/README.md @@ -89,21 +89,6 @@ configured as a module called `async`: because it has an async.zsh initialization file. Then to be enabled, `async` must be added to the modules style. -### Prompt theme - -Prompt themes are enabled in one of two different ways, depending on how the -specific theme you want works: - - 1. If it has a prompt_module_setup file: it is enabled with Zim's - `prompt` module. See [the instructions - here](https://github.com/zimfw/prompt/blob/master/README.md#settings). All - [Zim themes](https://github.com/zimfw/zimfw/wiki/Themes) work this way. - The advantage of these themes is that you can customize them with - additional parameters. - 2. If it has one of the initialization files listed above: it is enabled when - it's sourced, not with Zim's `prompt` module. The last sourced prompt - overrides any previous ones. - Updating -------- diff --git a/init.zsh b/init.zsh index 43583ce..0b924dd 100644 --- a/init.zsh +++ b/init.zsh @@ -1,5 +1,5 @@ autoload -Uz is-at-least && if ! is-at-least 5.2; then - print "init: error starting Zim: You're using Zsh version ${ZSH_VERSION} and versions < 5.2 are not supported. Update your Zsh." >&2 + print -u2 "init: error starting Zim: You're using Zsh version ${ZSH_VERSION} and versions < 5.2 are not supported. Update your Zsh." return 1 fi @@ -38,11 +38,9 @@ fi for zmodule in ${zmodules}; do zdir=${ZIM_HOME}/modules/${zmodule} if [[ ! -d ${zdir} ]]; then - print "init: module ${zmodule} not installed" >&2 - elif [[ -f ${zdir}/prompt_${zmodule}_setup ]]; then - fpath=(${zdir} ${fpath}) # Will be loaded by promptinit + print -u2 "init: module ${zmodule} not installed" else - for zfile in ${zdir}/init.zsh ${zdir}/${zmodule}.{zsh,plugin.zsh,zsh-theme,sh}; do + for zfile in ${zdir}/{init.zsh,${zmodule}.{zsh,plugin.zsh,zsh-theme,sh}}; do if [[ -f ${zfile} ]]; then source ${zfile} break @@ -74,7 +72,7 @@ _zimfw_compile() { done # Compile enabled modules' scripts - for zfile in ${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#{*.zsh{,-theme},prompt_*_setup}(.NLk+1); do + for zfile in ${ZIM_HOME}/modules/${^zmodules}/(^*test*/)#*.zsh{,-theme}(.NLk+1); do zrecompile -p ${1} ${zfile} done diff --git a/templates/zimrc b/templates/zimrc index b86ec39..a0cb805 100644 --- a/templates/zimrc +++ b/templates/zimrc @@ -8,11 +8,12 @@ # Select what modules you would like enabled. Modules are sourced in the order given. zstyle ':zim' modules \ directory environment git git-info history input utility \ - eriner gitster magicmace s1ck94 steeef prompt \ - zsh-completions completion zsh-autosuggestions zsh-syntax-highlighting history-substring-search + steeef \ + zsh-completions completion \ + zsh-autosuggestions zsh-syntax-highlighting history-substring-search # Modules setup configuration. -# See ... +# See https://github.com/zimfw/zimfw/blob/develop/README.md#module-customization zstyle ':zim:module' zsh-completions 'url' 'zsh-users/zsh-completions' zstyle ':zim:module' zsh-autosuggestions 'url' 'zsh-users/zsh-autosuggestions' zstyle ':zim:module' zsh-syntax-highlighting 'url' 'zsh-users/zsh-syntax-highlighting' @@ -66,13 +67,6 @@ zstyle ':zim:module' zsh-syntax-highlighting 'url' 'zsh-users/zsh-syntax-highlig # Load any helper scripts as defined here. #zstyle ':zim:pacman' helpers 'aur' -# -# prompt -# - -# Set your desired prompt theme. -zstyle ':zim:prompt' theme 'steeef' - # # ssh #