Created
April 6, 2022 02:51
-
-
Save aynik/8a95377a874edcfe117d67b320979e79 to your computer and use it in GitHub Desktop.
Bashrc lite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path | |
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | |
# Return if non-interactive | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
shopt -s histappend | |
shopt -s checkwinsize | |
shopt -s globstar | |
shopt -s autocd | |
shopt -s cdspell | |
# Terminal | |
export TERM=xterm-256color | |
# Language | |
export LANG="en_US.UTF-8" | |
export LC_COLLATE="en_US.UTF-8" | |
export LC_CTYPE="en_US.UTF-8" | |
export LC_MESSAGES="en_US.UTF-8" | |
export LC_MONETARY="en_US.UTF-8" | |
export LC_NUMERIC="en_US.UTF-8" | |
export LC_TIME="en_US.UTF-8" | |
export LC_ALL="en_US.UTF-8" | |
# History | |
export HISTFILESIZE= | |
export HISTSIZE= | |
export HISTTIMEFORMAT= | |
eternal_history() { | |
echo "$(history 1 | cut -d' ' -f4-)" >> ~/.bash_history | |
} | |
PROMPT_COMMAND=eternal_history | |
# Git prompt | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1 /' | |
} | |
git_color() { | |
[[ -n $(git status --porcelain=v2 2>/dev/null) ]] && printf '\033[0;31m' || printf '\033[0;32m' | |
} | |
# Prompt | |
export PS1="\[\e[0m\](\j) \[\e[0m\]\h \w \[\$(git_color)\]\$(git_branch)\[\e[0m\]" | |
# Brew | |
if [ "$(uname)" == "Darwin" ]; then | |
eval $(/opt/homebrew/bin/brew shellenv) | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
fi | |
# Aliases | |
alias ls='ls -G' | |
alias grep="grep --color=always" | |
alias diff="diff --color" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment