1
0
Fork 0

zsh: check before sourcing files

This commit is contained in:
Pratham Patel 2022-12-21 08:48:40 +05:30
parent 60ba823be1
commit 7f3d6cb14f
2 changed files with 9 additions and 4 deletions

View File

@ -226,4 +226,5 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
fi
# source functions
source $HOME/.config/zsh_confs/21_alias_funcs
ALIAS_FUNC_CONF=$HOME/.config/zsh_confs/21_alias_funcs
[ -f $ALIAS_FUNC_CONF ] && source $ALIAS_FUNC_CONF

10
.zshrc
View File

@ -6,6 +6,10 @@ case $- in
*) return;;
esac
HISTORY_CONF=$ZSH_CONFS_DIRECTORY/10_history
ALIASES_CONF=$ZSH_CONFS_DIRECTORY/20_aliases
SYNTAX_HIGHLIGHT_CONF=$ZSH_CONFS_DIRECTORY/90_syntax_highlight
# for using comments in interactive shell
setopt INTERACTIVECOMMENTS
@ -13,7 +17,7 @@ setopt INTERACTIVECOMMENTS
ZSH_CONFS_DIRECTORY="$HOME/.config/zsh_confs"
# load options related to history
source $ZSH_CONFS_DIRECTORY/10_history
[ -f $HISTORY_CONF ] && source $HISTORY_CONF
# keep the space after tab completion
ZLE_REMOVE_SUFFIX_CHARS=""
@ -56,7 +60,7 @@ else if [[ "$MACHINE_HOSTNAME" == "bluefeds" || "$MACHINE_HOSTNAME" == "sentinel
fi
# source aliases
source $ZSH_CONFS_DIRECTORY/20_aliases
[ -f $ALIASES_CONF ] && source $ALIASES_CONF
# source zsh syntax highlighting
source $ZSH_CONFS_DIRECTORY/90_syntax_highlight
[ -f $SYNTAX_HIGHLIGHT_CONF ] && source $SYNTAX_HIGHLIGHT_CONF