summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpks <pks@pks.rocks>2021-07-24 15:32:09 +0200
committerpks <pks@pks.rocks>2021-07-24 15:32:09 +0200
commitd774743aa51e8dc48724f37ccc71bea23b0f0311 (patch)
tree8267c0c60823593704c0359e12054ee06005e8f2
parentae76755ed7fd3e12a50123bc99b725e0b3225764 (diff)
zsh: maybe_add_dir_to_path
-rw-r--r--zsh/.zshrc32
1 files changed, 15 insertions, 17 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 14926af..0214765 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -175,27 +175,25 @@ export MANPATH=$MANPATH:$HOME/.local/share/man
export GOPATH=$HOME/.local
-# local_bin
-if [[ -d ~/local_bin ]]; then
- export PATH=~/local_bin:$PATH
-elif [[ -d ~/.sync/local_bin ]]; then
- export PATH=~/.sync/local_bin:$PATH
-fi
-
-# nlp_scripts
-if [[ -d ~/nlp_scripts ]]; then
- export PATH=~/nlp_scripts:$PATH
-elif [[ -d ~/.sync/nlp_scripts ]]; then
- export PATH=~/.sync/nlp_scripts:$PATH
-fi
+function maybe_add_dir_to_path {
+ if [[ -d $1 ]]; then
+ export PATH=$1:$PATH;
+ fi
+}
-if [[ -d /usr/lib/colorgcc/bin ]]; then
- PATH=/usr/lib/colorgcc/bin:$PATH
-fi
+maybe_add_dir_to_path ~/local_bin:$PATH
+maybe_add_dir_to_path /home/pks/local_bin:$PATH
+maybe_add_dir_to_path ~/.sync/local_bin:$PATH
+maybe_add_dir_to_path /home/pks/.sync/local_bin:$PATH
+maybe_add_dir_to_path ~/nlp_scripts
+maybe_add_dir_to_path /home/pks/nlp_scripts
+maybe_add_dir_to_path ~/.sync/nlp_scripts
+maybe_add_dir_to_path /home/pks/.sync/nlp_scripts
+maybe_add_dir_to_path /usr/lib/colorgcc/bin
which R &>/dev/null
if [[ $? == 0 ]]; then
- export R_LIBS_USER=$HOME/.R
+ maybe_add_dir_to_path $HOME/.R
fi
if [[ -x $(which nvim &>/dev/null) ]]; then