Skip to content

Instantly share code, notes, and snippets.

@dcai
Last active April 25, 2020 13:35
Show Gist options
  • Save dcai/3847582 to your computer and use it in GitHub Desktop.
Save dcai/3847582 to your computer and use it in GitHub Desktop.
minimal .bashrc
#!/bin/bash
# https://gist.github.com/dcai/3847582/
[[ -r /etc/bash_completion ]] && source /etc/bash_completion
# TERM COLOR
export WHITE="\033[1;37m"
export YELLOW="\033[1;33m"
export GREEN="\033[1;32m"
export BLUE="\033[1;34m"
export CYAN="\033[1;36m"
export RED="\033[1;31m"
export MAGENTA="\033[1;35m"
export BLACK="\033[1;30m"
export DARKWHITE="\033[0;37m"
export DARKYELLOW="\033[0;33m"
export DARKGREEN="\033[0;32m"
export DARKBLUE="\033[0;34m"
export DARKCYAN="\033[0;36m"
export DARKRED="\033[0;31m"
export DARKMAGENTA="\033[0;35m"
export DARKBLACK="\033[0;30m"
export CLROFF="\033[0;0m"
export NORMAL=$CLROFF
# TERM COLOR
export OSNAME=$(uname)
#if [ -d /usr/local/etc/bash_completion.d ]; then
# for component in /usr/local/etc/bash_completion.d/*; do
# [ -r $component ] && . $component
# done
# unset component
#fi
# non-printable charactors must in side \[ \]
SIGN=">"
HOSTNAMETEMP=$(hostname)
BCOLOR=${DARKRED}
HCOLOR=${GREEN}
PROMPT="\[${GREEN}\]${SIGN}\[${CLROFF}\]"
USERHOSTNAME="\[${BCOLOR}\](\[${HCOLOR}\]\u@\h\[${BCOLOR}\])\[${CLROFF}\]"
PS1DIRNAME="\w"
export PROMPT_DIRTRIM=3
export PS1="${PS1DIRNAME} ${PROMPT} "
export TIME_STYLE=long-iso
export HISTCONTROL=ignoreboth
export HISTFILESIZE=5000
export HISTSIZE=5000
export HISTIGNORE="ls:ll:cd"
export MAILCHECK=0
export PAGER=less
export LESS='-RainMw'
export VISUAL=vim
export EDITOR="$VISUAL"
export GOPATH="$HOME/go"
# system path
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
# snap
PATH="/snap/bin:$PATH"
# local
PATH="$HOME/.local/bin:$PATH"
PATH="$HOME/.bin:$PATH"
# node
PATH="$HOME/.npm-packages/bin:$PATH"
# python
PATH="$HOME/Library/Python/3.6/bin:$HOME/Library/Python/2.7/bin:$PATH"
# dropbox
PATH="$HOME/Dropbox/bin:$PATH"
# php composer
PATH="$HOME/.composer/vendor/bin:$PATH"
# ruby
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"
fi
# go
PATH="$GOPATH/bin:$PATH"
ZPATH="$HOME/.linuxbrew/etc/profile.d/z.sh"
[ -f $ZPATH ] && source "$ZPATH"
dots_cmd='..'
dots_path='./../'
# shellcheck disable=SC2034
for dots_counter in {1..5}; do
eval "alias ${dots_cmd}='cd ${dots_path}'"
dots_path="${dots_path}../"
dots_cmd="${dots_cmd}."
done
if [ -d ~/.bash.d ]; then
# component
for component in ~/.bash.d/*.bash; do
#[ -x $component ] && . $component
[ -r $component ] && . $component
done
unset component
# completions
for completion in ~/.bash.d/completions/*.bash; do
[ -r $completion ] && . $completion
done
unset completion
fi
[[ -f ~/.fzf.bash ]] && source ~/.fzf.bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment