Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # ~/.bashrc
- # ⇎⇰┌ ┐└ ┌ ─
- # If not running interactively, don't do anything
- [[ $- != *i* ]] && return
- _isxrunning=false
- [[ -n "$DISPLAY" ]] && _isxrunning=true
- # PS1 CONFIG {{{
- function __prompt_command() {
- local EXIT="$?"
- local RCol='\[\e[0m\]' # Text Reset
- # Regular Bold Underline High Intensity BoldHigh Intensity Background High Intensity Backgrounds
- local Bla='\[\e[0;30m\]'; local BBla='\[\e[1;30m\]'; local UBla='\[\e[4;30m\]'; local IBla='\[\e[0;90m\]'; local BIBla='\[\e[1;90m\]'; local On_Bla='\e[40m'; local On_IBla='\[\e[0;100m\]';
- local Red='\[\e[0;31m\]'; local BRed='\[\e[1;31m\]'; local URed='\[\e[4;31m\]'; local IRed='\[\e[0;91m\]'; local BIRed='\[\e[1;91m\]'; local On_Red='\e[41m'; local On_IRed='\[\e[0;101m\]';
- local Gre='\[\e[0;32m\]'; local BGre='\[\e[1;32m\]'; local UGre='\[\e[4;32m\]'; local IGre='\[\e[0;92m\]'; local BIGre='\[\e[1;92m\]'; local On_Gre='\e[42m'; local On_IGre='\[\e[0;102m\]';
- local Yel='\[\e[0;33m\]'; local BYel='\[\e[1;33m\]'; local UYel='\[\e[4;33m\]'; local IYel='\[\e[0;93m\]'; local BIYel='\[\e[1;93m\]'; local On_Yel='\e[43m'; local On_IYel='\[\e[0;103m\]';
- local Blu='\[\e[0;34m\]'; local BBlu='\[\e[1;34m\]'; local UBlu='\[\e[4;34m\]'; local IBlu='\[\e[0;94m\]'; local BIBlu='\[\e[1;94m\]'; local On_Blu='\e[44m'; local On_IBlu='\[\e[0;104m\]';
- local Pur='\[\e[0;35m\]'; local BPur='\[\e[1;35m\]'; local UPur='\[\e[4;35m\]'; local IPur='\[\e[0;95m\]'; local BIPur='\[\e[1;95m\]'; local On_Pur='\e[45m'; local On_IPur='\[\e[0;105m\]';
- local Cya='\[\e[0;36m\]'; local BCya='\[\e[1;36m\]'; local UCya='\[\e[4;36m\]'; local ICya='\[\e[0;96m\]'; local BICya='\[\e[1;96m\]'; local On_Cya='\e[46m'; local On_ICya='\[\e[0;106m\]';
- local Whi='\[\e[0;37m\]'; local BWhi='\[\e[1;37m\]'; local UWhi='\[\e[4;37m\]'; local IWhi='\[\e[0;97m\]'; local BIWhi='\[\e[1;97m\]'; local On_Whi='\e[47m'; local On_IWhi='\[\e[0;107m\]';
- ### End Color Vars ### }}}
- # Useful Definition
- HOST="\h" # The hostname, up to the first ‘.’.
- USER="\u" # The username of the current user.
- DIR="\w" # The current working directory, with $HOME abbreviated with a tilde
- NEWLINE="\n" # A newline.
- DATE="\d" # The date, in "Weekday Month Date" format
- TIME_ALL="\t" # The time, in 24-hour HH:MM:SS format.
- TIME_SH="\@" # The time, in 12-hour am/pm format.
- HIST_NUM="\!" # The history number of this command.
- CUR_USER="\$" # If the effective uid is 0, #, otherwise $.
- ### END Useful Definition ### }}}
- if [ "${EXIT}" -eq 0 ]
- then
- PS1="\n┌─${BICya}[${USER}]${RCol} ${IBlu}(${TIME_SH})${RCol} ${IPur}{${DATE}}${RCol} ${IGre}|${DIR}|${RCol}\n└─╼ ${CUR_USER} "
- else
- PS1="${BIRed}\n┌─[${USER}] (${TIME_SH}) {${DATE}} !${HIST_NUM}! |${DIR}|\n└─╼ ${CUR_USER}${RCol} "
- fi
- }
- [[ -f $HOME/.dircolors ]] && eval $(dircolors -b $HOME/.dircolors)
- if $_isxrunning; then
- [[ -f $HOME/.dircolors_256 ]] && eval $(dircolors -b $HOME/.dircolors_256)
- case $TERM in
- xterm*|*rxvt*)
- PROMPT_COMMAND='echo -ne "\033]0;Terminal\007"' # Set Terminal name "Terminal"
- PROMPT_COMMAND=__prompt_command # Set Per-line Prompt
- ;;
- esac
- fi
- #}}}
- # BASH OPTIONS {{{
- shopt -s cdspell # Correct cd typos
- shopt -s checkwinsize # Update windows size on command
- shopt -s histappend # Append History instead of overwriting file
- shopt -s cmdhist # Bash attempts to save all lines of a multiple-line command in the same history entry
- shopt -s extglob # Extended pattern
- shopt -s no_empty_cmd_completion # No empty completion
- #}}}
- # BASH HISTORY {{{
- # make multiple shells share the same history file
- HISTSIZE= # bash history will save N commands
- HISTFILESIZE= # bash will remember N commands
- HISTCONTROL=ignoreboth # ingore duplicates and spaces
- HISTTIMEFORMAT="%h/%d - %H:%M:%S "
- HISTIGNORE='exit:clear:history'
- #}}}
- # COLORED MANUAL PAGES {{{
- if $_isxrunning; then
- export PAGER=less
- export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
- export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
- export LESS_TERMCAP_me=$'\E[0m' # end mode
- export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
- export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
- export LESS_TERMCAP_ue=$'\E[0m' # end underline
- export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
- fi
- #}}}
- # make less more friendly for non-text input files, see lesspipe(1)
- [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
- # set a fancy prompt (non-color, unless we know we "want" color)
- case "$TERM" in
- xterm-color|*-256color) color_prompt=yes;;
- esac
- # Load All alliases Used by me
- if [ -f ~/.sh_aliases ]; then
- . ~/.sh_aliases
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement