-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break up Zsh configuration files #265
Open
dysfungi
wants to merge
10
commits into
holman:master
Choose a base branch
from
dysfungi:pr/zsh-config-files
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9066533
fix(zsh): Change project directory environment variable
aede5ea
feat(zsh): Break up Zsh configuration files
6c3365c
feat(zsh): Find Zsh config files using suffixes
03dca6c
fix(zsh): Completion files variable typo
b6568f0
fix(zsh): Source alias files as interactive files
0011734
docs(readme): Update for Zsh configuration file break up
b00f261
Merge branch 'upstream/master' into pr/zsh-config-files
051b85c
fix(zsh): Disable wildcard prefix of special ZSH rc files
16f310d
Merge remote-tracking branch 'upstream/master' into pr/zsh-config-files
d190735
fix(zsh-prompt): Update variable of dotfile path
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# | ||
# Sets macOS defaults by running $ZSH/macos/set-defaults.sh. | ||
# Sets macOS defaults by running $DOTFILES/macos/set-defaults.sh. | ||
|
||
exec $ZSH/macos/set-defaults.sh | ||
exec $DOTFILES/macos/set-defaults.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export PATH="./bin:/usr/local/bin:/usr/local/sbin:$ZSH/bin:$PATH" | ||
export PATH="./bin:/usr/local/bin:/usr/local/sbin:$DOTFILES/bin:$PATH" | ||
export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#add each topic folder to fpath so that they can add functions and completion scripts | ||
for topic_folder ($ZSH/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; | ||
for topic_folder ($DOTFILES/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# NOTE: Not intended to be used with zprofile, but can be. | ||
|
||
# Login configs. | ||
setopt nullglob | ||
|
||
# all of our login zsh files | ||
typeset -U login_files | ||
login_files=($DOTFILES/**/*login.zsh) | ||
|
||
# run all login files | ||
for file in ${login_files}; do | ||
source "$file" | ||
done | ||
|
||
unset login_files | ||
unsetopt nullglob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Logout configs. | ||
setopt nullglob | ||
|
||
# all of our logout zsh files | ||
typeset -U logout_files | ||
logout_files=($DOTFILES/**/*logout.zsh) | ||
|
||
# run all logout files | ||
for file in ${logout_files}; do | ||
source "$file" | ||
done | ||
|
||
unset logout_files | ||
unsetopt nullglob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# NOTE: Not intended to be used with zlogin, but can be. | ||
|
||
# Login profile configs. | ||
setopt nullglob | ||
|
||
# all of our profile zsh files | ||
typeset -U profile_files | ||
profile_files=($DOTFILES/**/*profile.zsh) | ||
|
||
# run all profile files | ||
for file in ${profile_files}; do | ||
source "$file" | ||
done | ||
|
||
unset profile_files | ||
unsetopt nullglob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Environment configs. | ||
setopt nullglob extendedglob | ||
|
||
# shortcut to this dotfiles path is $DOTFILES | ||
export DOTFILES="$HOME/.dotfiles" | ||
|
||
# your project folder that we can `c [tab]` to | ||
export PROJECTS="$HOME/Code" | ||
|
||
# path and env zsh files | ||
typeset -U path_files env_files | ||
path_files=($DOTFILES/**/*path.zsh~**/*fpath.zsh) | ||
env_files=($DOTFILES/**/*env.zsh) | ||
|
||
# load the path files | ||
for file in ${path_files}; do | ||
source "$file" | ||
done | ||
|
||
# load the env files | ||
for file in ${env_files}; do | ||
source "$file" | ||
done | ||
|
||
unset path_files env_files | ||
unsetopt nullglob extendedglob |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
# shortcut to this dotfiles path is $ZSH | ||
export ZSH=$HOME/.dotfiles | ||
|
||
# your project folder that we can `c [tab]` to | ||
export PROJECTS=~/Code | ||
# Interactive environment configs. | ||
setopt nullglob extendedglob | ||
|
||
# Stash your environment variables in ~/.localrc. This means they'll stay out | ||
# of your main dotfiles repository (which may be public, like this one), but | ||
|
@@ -12,30 +9,31 @@ then | |
source ~/.localrc | ||
fi | ||
|
||
# all of our zsh files | ||
typeset -U config_files | ||
config_files=($ZSH/**/*.zsh) | ||
# all of our non-path/env/profile/login/logout zsh files | ||
typeset -U fpath_files interactive_files completion_files | ||
fpath_files=($DOTFILES/**/*fpath.zsh) | ||
interactive_files=($DOTFILES/**/*.zsh~**/*completion.zsh~**/*path.zsh~**/*env.zsh~**/*alias.zsh~**/*aliases.zsh~**/*profile.zsh~**/*login.zsh~**/*logout.zsh) | ||
completion_file=($DOTFILES/**/*completion.zsh) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thank you |
||
|
||
# load the path files | ||
for file in ${(M)config_files:#*/path.zsh} | ||
do | ||
source $file | ||
# load fpath config files | ||
for file in ${fpath_files}; do | ||
source "$file" | ||
done | ||
|
||
# load everything but the path and completion files | ||
for file in ${${config_files:#*/path.zsh}:#*/completion.zsh} | ||
do | ||
source $file | ||
# load interactive files (everything but the completion, path, env, | ||
# profile, login, and logout files) | ||
for file in ${interactive_files}; do | ||
source "$file" | ||
done | ||
|
||
# initialize autocomplete here, otherwise functions won't be loaded | ||
autoload -U compinit | ||
compinit | ||
|
||
# load every completion after autocomplete loads | ||
for file in ${(M)config_files:#*/completion.zsh} | ||
do | ||
source $file | ||
for file in ${completion_files}; do | ||
source "$file" | ||
done | ||
|
||
unset config_files | ||
unset fpath_files interactive_files completion_files | ||
unsetopt nullglob extendedglob |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe
~**/*aliases.zsh
doesn't belong here. Otherwise aliases defined in zsh/aliases.zsh won't be sourced...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good catch. Remnants of considering to source alias files in zshenv. Decided it was best to consider aliases as interactive only.