~xdavidwu/dotfiles

1580d2f70acce1fca686bc4adfbb2653a27051d4 — xdavidwu 2 years ago cf50dfc
bash: move static exports to profile
2 files changed, 50 insertions(+), 46 deletions(-)

M .bash_profile
M .bashrc
M .bash_profile => .bash_profile +50 -0
@@ 2,4 2,54 @@
# ~/.bash_profile
#

# sanitize
# alpine exports PS1
export -n PS1
# arch set PROMPT_COMMAND for terminal title
unset PROMPT_COMMAND

export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"

# be careful that composer does not uses XDG when no XDG_* defined
PATH="$HOME/.local/bin:$XDG_DATA_HOME/npm/bin/:$XDG_CONFIG_HOME/composer/vendor/bin/:$PATH"

# XDG workarounds
[ ! -d "$XDG_CACHE_HOME" ] && mkdir "$XDG_CACHE_HOME"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export VIMINIT=":source $XDG_CONFIG_HOME/vim/vimrc"
export VIMPAGER_RC="$XDG_CONFIG_HOME/vim/vimrc"
export SCREENRC="$XDG_CONFIG_HOME/screen/screenrc"
export GRADLE_USER_HOME="$XDG_CACHE_HOME/gradle"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CACHE_HOME/java
	$_JAVA_OPTIONS"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export PARALLEL_HOME="$XDG_CACHE_HOME/parallel"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export NPM_CONFIG_GLOBALCONFIG="$XDG_CONFIG_HOME/sensitive/npm/npmrc"
export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority"
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
export SQLITE_HISTORY="$XDG_CACHE_HOME/sqlite_history"
export MYSQL_HISTFILE="$XDG_CACHE_HOME/mysql_history"
export NODE_REPL_HISTORY="$XDG_CACHE_HOME/node_repl_history"
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass

# application envs
[ -f /usr/bin/vimpager ] && export PAGER=vimpager
export LESS='-S -R'
export LESSHISTFILE=-
export EDITOR=vim
export DVTM_PAGER=less
export GDK_BACKEND=wayland
export QT_QPA_PLATFORM=wayland-egl
export SDL_VIDEODRIVER=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export GTK_IM_MODULE=wayland
export QT_IM_MODULE=fcitx

[ ! -d "$ANDROID_HOME" ] && [ ! -d "$ANDROID_SDK_ROOT" ] && [ -d ~/android-sdk ] && export ANDROID_SDK_ROOT=~/android-sdk

[[ -f ~/.bashrc ]] && . ~/.bashrc

M .bashrc => .bashrc +0 -46
@@ 9,19 9,8 @@ shopt -s histappend
set +H

# sanitize
# alpine exports PS1
export -n PS1
# arch set PROMPT_COMMAND for terminal title
unset PROMPT_COMMAND
unset _GCOMPAT_PRELOAD

export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"

# be careful that composer does not uses XDG when no XDG_* defined
PATH="$HOME/.local/bin:$XDG_DATA_HOME/npm/bin/:$XDG_CONFIG_HOME/composer/vendor/bin/:$PATH"

if [ "$OSTYPE" = msys ]; then
	export LC_ALL=zh_TW.UTF-8
	PATH="/usr/bin:/bin:/mingw64/bin:$PATH"


@@ 29,29 18,7 @@ elif [ "$OSTYPE" = "linux-musl" ]; then
	_GCOMPAT_PRELOAD="LD_PRELOAD=/lib/libgcompat.so.0"
fi

# XDG workarounds
# policy: (!customized) => ((PMs) => data, (!PMs && !important) => cache)
[ ! -d "$XDG_CACHE_HOME" ] && mkdir "$XDG_CACHE_HOME"
HISTFILE="$XDG_CACHE_HOME/bash_history"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export VIMINIT=":source $XDG_CONFIG_HOME/vim/vimrc"
export VIMPAGER_RC="$XDG_CONFIG_HOME/vim/vimrc"
export SCREENRC="$XDG_CONFIG_HOME/screen/screenrc"
export GRADLE_USER_HOME="$XDG_CACHE_HOME/gradle"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_CACHE_HOME/java
	$_JAVA_OPTIONS"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export PARALLEL_HOME="$XDG_CACHE_HOME/parallel"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export NPM_CONFIG_GLOBALCONFIG="$XDG_CONFIG_HOME/sensitive/npm/npmrc"
export ICEAUTHORITY="$XDG_CACHE_HOME/ICEauthority"
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
export SQLITE_HISTORY="$XDG_CACHE_HOME/sqlite_history"
export MYSQL_HISTFILE="$XDG_CACHE_HOME/mysql_history"
export NODE_REPL_HISTORY="$XDG_CACHE_HOME/node_repl_history"
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass

# shell options
HISTCONTROL=ignoreboth


@@ 163,19 130,6 @@ st() {

# application envs
export GPG_TTY=$(tty 2>/dev/null)
[ -f /usr/bin/vimpager ] && export PAGER=vimpager
export LESS='-S -R'
export LESSHISTFILE=-
export EDITOR=vim
export DVTM_PAGER=less
export GDK_BACKEND=wayland
export QT_QPA_PLATFORM=wayland-egl
export SDL_VIDEODRIVER=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export GTK_IM_MODULE=wayland
export QT_IM_MODULE=fcitx

[ ! -d "$ANDROID_HOME" ] && [ ! -d "$ANDROID_SDK_ROOT" ] && [ -d ~/android-sdk ] && export ANDROID_SDK_ROOT=~/android-sdk

# shell level prompt
# PTERM: poisoned TERM, $TERM/$LVLSTR, ssh pass TERM by default