Skip to content

Commit cee5f4a

Browse files
committed
feat: ✨ add optional loading of .bash_functions and .bash_aliases
- New zqs commands to enable/disable loading of bash files - zqs enable-bash-functions and zqs disable-bash-functions - zqs enable-bash-aliases and zqs disable-bash-aliases - New .zshrc.d/002-load-bash-files to handle the actual loading - Updated help documentation for the new commands Implements: unixorn#291 Signed-off-by: jfmcdowell <[email protected]>
1 parent a65274b commit cee5f4a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

zsh/.zshrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,12 @@ function zqs-help() {
815815
echo "zqs disable-1password-agent - New sessions will not use 1Password's ssh agent"
816816
echo "zqs enable-1password-agent - New sessions will use 1Password's ssh agent if present."
817817

818+
echo "zqs disable-bash-aliases - Don't load .bash_aliases file in new sessions"
819+
echo "zqs enable-bash-aliases - Load .bash_aliases file in new sessions if it exists"
820+
821+
echo "zqs disable-bash-functions - Don't load .bash_functions file in new sessions"
822+
echo "zqs enable-bash-functions - Load .bash_functions file in new sessions if it exists"
823+
818824
echo "zqs disable-bindkey-handling - Set the quickstart to not touch any bindkey settings. Useful if you're using another plugin to handle it."
819825
echo "zqs enable-bindkey-handling - Set the quickstart to configure your bindkey settings. This is the default behavior."
820826

@@ -894,6 +900,24 @@ function zqs() {
894900
_zqs-set-setting use-1password-ssh-agent true
895901
;;
896902

903+
'disable-bash-aliases')
904+
echo "Disabling loading of .bash_aliases. New ZSH sessions will no longer load this file."
905+
_zqs-set-setting load-bash-aliases false
906+
;;
907+
'enable-bash-aliases')
908+
echo "Enabling loading of .bash_aliases. New ZSH sessions will load this file if it exists."
909+
_zqs-set-setting load-bash-aliases true
910+
;;
911+
912+
'disable-bash-functions')
913+
echo "Disabling loading of .bash_functions. New ZSH sessions will no longer load this file."
914+
_zqs-set-setting load-bash-functions false
915+
;;
916+
'enable-bash-functions')
917+
echo "Enabling loading of .bash_functions. New ZSH sessions will load this file if it exists."
918+
_zqs-set-setting load-bash-functions true
919+
;;
920+
897921
'disable-bindkey-handling')
898922
zsh-quickstart-disable-bindkey-handling
899923
;;

zsh/.zshrc.d/002-load-bash-files

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Load bash files if enabled
2+
# Implementation of Issue 291: Add optional loading of .bash_functions and .bash_aliases
3+
4+
# Load .bash_functions if enabled
5+
if [[ $(_zqs-get-setting load-bash-functions false) == 'true' ]]; then
6+
if [ -r ~/.bash_functions ]; then
7+
source ~/.bash_functions
8+
echo "Loaded .bash_functions"
9+
fi
10+
fi
11+
12+
# Load .bash_aliases if enabled
13+
if [[ $(_zqs-get-setting load-bash-aliases false) == 'true' ]]; then
14+
if [ -r ~/.bash_aliases ]; then
15+
source ~/.bash_aliases
16+
echo "Loaded .bash_aliases"
17+
fi
18+
fi

0 commit comments

Comments
 (0)