added tests to most of the sourcing to make sure files/commands exist

before we use them.
This commit is contained in:
Gabe Venberg 2021-04-03 01:53:27 -05:00
parent e0247b6ff1
commit 6b59129a6a

View file

@ -13,9 +13,12 @@
#set important shell variables #set important shell variables
export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin" #fancy way of testing if a command exists
export PATH="$PATH:$HOME/.local/bin" (($+command[ruby])) && export PATH="$PATH:$(ruby -e 'puts Gem.user_dir' 2> /dev/null)/bin"
export PATH="$PATH:$HOME/scripts" testPath="$HOME/.local/bin"
[ -f $testPath ] && export PATH="$PATH:$testPath"
testPath="$HOME/scripts"
[ -f $testPath ] && export PATH="$PATH:$testPath"
#set default editor and pager. #set default editor and pager.
export EDITOR=nvim export EDITOR=nvim
export VISUAL=nvim export VISUAL=nvim
@ -194,10 +197,8 @@ PROMPT='%F{cyan}[%n@%m]%f%F{red}├────┤%f${vcs_info_msg_0_}
#fzf stuff #fzf stuff
#zsh key bindings (different distros put these in different places.) #zsh key bindings (different distros put these in different places.)
source $(find /usr/share -path '*fzf/*key-bindings.zsh' -print -quit 2> /dev/null) testPath=$(find /usr/share -path '*fzf/*key-bindings.zsh' -print -quit 2> /dev/null)
[ -f $testPath ] && source $testPath
#zsh completions, if it exists. #zsh completions, if it exists.
testPath=$(find /usr/share -path '*fzf/*completion.zsh' -print -quit 2> /dev/null) testPath=$(find /usr/share -path '*fzf/*completion.zsh' -print -quit 2> /dev/null)
if test $(echo $testPath | wc -c) -ne 0 [ -f $testPath ] && source $testPath
then
source $testPath
fi