mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Changes to the way oh-my-zsh sources config scripts. First off, custom folder plugins now go directly into $ZSH/custom directory instead of $ZSH/plugin. I see no reason to have this folder in custom. Secondly, oh-my-zsh will now first look what scripts have been specified in custom. If they happen to have the same name $ZSH/lib, then they are sourced instead (i.e. custom files now properly override oh-my-zsh settings). I decided to do this so that I can have direct control over what oh-my-zsh does to my shell without modifying the upstream script files.
This commit is contained in:
parent
fce68bbba0
commit
e03bd77148
1 changed files with 18 additions and 13 deletions
31
oh-my-zsh.sh
31
oh-my-zsh.sh
|
|
@ -9,18 +9,25 @@ fi
|
|||
# add a function path
|
||||
fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ($ZSH/lib/*.zsh); do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||
ZSH_CUSTOM="$ZSH/custom"
|
||||
fi
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh/lib that end in .zsh
|
||||
# If file of the same is present in ~/oh-my-zsh/custom, source this one instead
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ($ZSH/lib/*.zsh); do
|
||||
filename=$(basename "$config_file")
|
||||
if [ -f $ZSH_CUSTOM/$filename ]; then
|
||||
#echo "source $ZSH_CUSTOM/$filename"
|
||||
source $ZSH_CUSTOM/$filename
|
||||
elif [ -f $config_file ]; then
|
||||
#echo "source $config_file"
|
||||
source $config_file
|
||||
fi
|
||||
done
|
||||
|
||||
is_plugin() {
|
||||
local base_dir=$1
|
||||
|
|
@ -32,7 +39,7 @@ is_plugin() {
|
|||
# before running compinit.
|
||||
for plugin ($plugins); do
|
||||
if is_plugin $ZSH_CUSTOM $plugin; then
|
||||
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
|
||||
fpath=($ZSH_CUSTOM/$plugin $fpath)
|
||||
elif is_plugin $ZSH $plugin; then
|
||||
fpath=($ZSH/plugins/$plugin $fpath)
|
||||
fi
|
||||
|
|
@ -45,18 +52,16 @@ compinit -i
|
|||
|
||||
# Load all of the plugins that were defined in ~/.zshrc
|
||||
for plugin ($plugins); do
|
||||
if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then
|
||||
source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh
|
||||
if [ -f $ZSH_CUSTOM/$plugin/$plugin.plugin.zsh ]; then
|
||||
source $ZSH_CUSTOM/$plugin/$plugin.plugin.zsh
|
||||
elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then
|
||||
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
|
||||
fi
|
||||
done
|
||||
|
||||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
# Unser variables
|
||||
unset config_file
|
||||
unset plugin
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue