Skip to content

Commit e93a8ea

Browse files
deepu105rubiin
authored andcommitted
Make OMZ optional (#912)
* feat: make OMZ optional so that other options like zinit can be used * fix: remove global alias for -h, fix #910 * chore: polish * fix: use existing variable * fix: use the correct var
1 parent 3957685 commit e93a8ea

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

β€ŽConfigs/.config/zsh/conf.d/hyde/env.zshβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#! β•šβ•β•β•β•β•β•β–‘β–‘β•šβ•β•β•β•β•β–‘β€ƒβ€ƒβ•šβ•β•β–‘β–‘β•šβ•β•β•β–‘β•šβ•β•β•β•β•β–‘β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β€ƒβ€ƒβ•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘
99

1010
# Hyde's Shell Environment Initialization Script
11-
# If users used UWSM, uwsm will override any variables set anywhere in you shell configurations
11+
# If users used UWSM, uwsm will override any variables set anywhere in your shell configurations
1212

1313
# Basic PATH prepending (user local bin)
1414
PATH="$HOME/.local/bin:$PATH"

β€ŽConfigs/.config/zsh/conf.d/hyde/terminal.zshβ€Ž

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
# And ensures that we have an obstruction-free .zshrc file
1313
# This also ensures that the proper HyDE $ENVs are loaded
1414

15-
function _load_common() {
16-
15+
function _load_functions() {
1716
# Load all custom function files // Directories are ignored
1817
for file in "${ZDOTDIR:-$HOME/.config/zsh}/functions/"*.zsh; do
1918
[ -r "$file" ] && source "$file"
2019
done
20+
}
2121

22+
function _load_completions() {
2223
for file in "${ZDOTDIR:-$HOME/.config/zsh}/completions/"*.zsh; do
2324
[ -r "$file" ] && source "$file"
2425
done
25-
2626
}
2727

2828
function _dedup_zsh_plugins {
@@ -53,8 +53,8 @@ function _defer_omz_after_prompt_before_input() {
5353
fpath=($ZDOTDIR/completions "${fpath[@]}")
5454

5555
_load_compinit
56-
57-
_load_common
56+
_load_functions
57+
_load_completions
5858

5959
# zsh-autosuggestions won't work on first prompt when deferred
6060
if typeset -f _zsh_autosuggest_start >/dev/null; then
@@ -152,19 +152,18 @@ function _load_compinit() {
152152

153153
function _load_prompt() {
154154
# Try to load prompts immediately
155-
if ! source ${ZDOTDIR}/prompt.zsh >/dev/null 2>&1; then
155+
if ! source ${ZDOTDIR}/prompt.zsh > /dev/null 2>&1; then
156156
[[ -f $ZDOTDIR/conf.d/hyde/prompt.zsh ]] && source $ZDOTDIR/conf.d/hyde/prompt.zsh
157157
fi
158-
159158
}
160159

161-
#? Override this environment variable in ~/.zshrc
160+
# Override this environment variable in ~/.zshrc
162161
# cleaning up home folder
163162
# ZSH Plugin Configuration
164163

165164
HYDE_ZSH_DEFER="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's deferred Zsh loading.
166165
HYDE_ZSH_PROMPT="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's prompt customization.
167-
HYDE_ZSH_NO_PLUGINS="1" #Unset this variable in $ZDOTDIR/user.zsh to disable HyDE's deferred Zsh loading.
166+
HYDE_ZSH_NO_PLUGINS="0" #Set this variable to "1" in $ZDOTDIR/user.zsh to disable HyDE's Zsh plugin loading.
168167

169168
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
170169

@@ -191,7 +190,8 @@ fi
191190

192191
_load_compinit
193192

194-
if [[ ${HYDE_ZSH_NO_PLUGINS} == "1" ]]; then
193+
194+
if [[ ${HYDE_ZSH_NO_PLUGINS} != "1" ]]; then
195195
# Deduplicate omz plugins()
196196
_dedup_zsh_plugins
197197

@@ -201,9 +201,16 @@ if [[ ${HYDE_ZSH_NO_PLUGINS} == "1" ]]; then
201201
else
202202
[[ -r $ZSH/oh-my-zsh.sh ]] && source $ZSH/oh-my-zsh.sh
203203
_load_prompt
204-
_load_common
205-
204+
_load_functions
205+
_load_completions
206206
fi
207+
else
208+
_load_prompt
209+
_load_functions
210+
_load_completions
211+
212+
chmod +r $ZDOTDIR/.zshrc # Make sure .zshrc is readable
213+
[[ -r $ZDOTDIR/.zshrc ]] && source $ZDOTDIR/.zshrc
207214
fi
208215

209216
alias c='clear' \

β€ŽConfigs/.config/zsh/user.zshβ€Ž

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ if [[ $- == *i* ]]; then
1414
fi
1515
fi
1616

17-
# ο‘„ Plugins ο‘„
18-
# manually add your oh-my-zsh plugins here
19-
plugins=(
20-
"sudo"
21-
)
22-
2317
# ο‘„ Overrides ο‘„
24-
# unset HYDE_ZSH_NO_PLUGINS # Set to 1 to disable loading of oh-my-zsh plugins, useful if you want to use your zsh plugins system
18+
# HYDE_ZSH_NO_PLUGINS=1 # Set to 1 to disable loading of oh-my-zsh plugins, useful if you want to use your zsh plugins system
2519
# unset HYDE_ZSH_PROMPT # Uncomment to unset/disable loading of prompts from HyDE and let you load your own prompts
2620
# HYDE_ZSH_COMPINIT_CHECK=1 # Set 24 (hours) per compinit security check // lessens startup time
2721
# HYDE_ZSH_OMZ_DEFER=1 # Set to 1 to defer loading of oh-my-zsh plugins ONLY if prompt is already loaded
22+
23+
if [[ ${HYDE_ZSH_NO_PLUGINS} != "1" ]]; then
24+
# ο‘„ OMZ Plugins ο‘„
25+
# manually add your oh-my-zsh plugins here
26+
plugins=(
27+
"sudo"
28+
)
29+
fi

0 commit comments

Comments
Β (0)