From 0a7df3a77b11eaf28a33c1dacd4507124b1a8420 Mon Sep 17 00:00:00 2001 From: pztrn Date: Sun, 1 Mar 2015 10:09:06 +0500 Subject: [PATCH] * Exports reworked. Now every export type have own file. --- zsh/10-exports.zsh | 14 +++----------- zsh/exports/01-path.zsh | 5 +++++ zsh/exports/10-editor.zsh | 2 ++ zsh/exports/70-java-options.zsh | 4 ++++ zsh/exports/95-pyenv.zsh | 9 +++++++++ zshrc | 7 ++++++- 6 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 zsh/exports/01-path.zsh create mode 100644 zsh/exports/10-editor.zsh create mode 100644 zsh/exports/70-java-options.zsh create mode 100644 zsh/exports/95-pyenv.zsh diff --git a/zsh/10-exports.zsh b/zsh/10-exports.zsh index bca1857..62b61c8 100644 --- a/zsh/10-exports.zsh +++ b/zsh/10-exports.zsh @@ -1,11 +1,3 @@ -export PATH="/home/pztrn/bin:/usr/lib:/usr/lib/colorgcc/bin:/usr/sbin:/sbin:/usr/local/heroku/bin:/data/Programs/hyde:$PATH" -export EDITOR=nano - -# More or less pretty fonts in Java programs. -export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' -export JAVA_FONTS=/usr/share/fonts/TTF - -# PyENV. -export PYENV_ROOT="/data/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(pyenv init -)" +for config_file in `ls ${CONFIG_PATH}/zsh/exports | sort | grep zsh`; do + source ${CONFIG_PATH}/zsh/exports/${config_file} +done \ No newline at end of file diff --git a/zsh/exports/01-path.zsh b/zsh/exports/01-path.zsh new file mode 100644 index 0000000..03dc3a5 --- /dev/null +++ b/zsh/exports/01-path.zsh @@ -0,0 +1,5 @@ +# This is default PATHs. +export PATH="/usr/lib:/usr/lib/colorgcc/bin:/usr/sbin:/sbin:$PATH" + +# Add here your own. +export PATH="$PATH:/usr/local/heroku/bin:/data/Programs/hyde:/home/pztrn/bin" \ No newline at end of file diff --git a/zsh/exports/10-editor.zsh b/zsh/exports/10-editor.zsh new file mode 100644 index 0000000..7edb340 --- /dev/null +++ b/zsh/exports/10-editor.zsh @@ -0,0 +1,2 @@ +# This file is used to override EDITOR variable. +EDITOR="nano" \ No newline at end of file diff --git a/zsh/exports/70-java-options.zsh b/zsh/exports/70-java-options.zsh new file mode 100644 index 0000000..bfdd264 --- /dev/null +++ b/zsh/exports/70-java-options.zsh @@ -0,0 +1,4 @@ +# Java-specific exports. +# More or less pretty fonts in Java programs. +export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' +export JAVA_FONTS=/usr/share/fonts/TTF \ No newline at end of file diff --git a/zsh/exports/95-pyenv.zsh b/zsh/exports/95-pyenv.zsh new file mode 100644 index 0000000..f578aa6 --- /dev/null +++ b/zsh/exports/95-pyenv.zsh @@ -0,0 +1,9 @@ +# PyENV exports. + +# This exports should work only if config states this. +if [ "${USE_PYENV}" -eq 0 ]; then + return +fi + +export PATH="${PYENV_PATH}/bin:$PATH" +eval "$(pyenv init -)" \ No newline at end of file diff --git a/zshrc b/zshrc index 778f08c..192b44e 100644 --- a/zshrc +++ b/zshrc @@ -18,6 +18,11 @@ PROMPT_THEME="pztrn" # nVidia users with proprietary drivers - sorry, you can't use it. USE_FBTERM=0 +# PyENV in use? +USE_PYENV=0 +# Path to PyENV. +PYENV_PATH="/data/.pyenv" + ##################################################################### # INITIALIZATION # -------------- @@ -46,7 +51,7 @@ if [ $CONFIG_FOUND -eq 1 ]; then source ${CONFIG_PATH}/zsh/${config_file} done else - echo "Failed to load configuration." + error "Failed to load configuration." fi set -B