Advertisement
Guest User

my .bashrc

a guest
Jan 11th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.85 KB | None | 0 0
  1. #
  2. # ~/.bashrc
  3. # ⇎⇰┌ ┐└ ┌ ─
  4.  
  5. # If not running interactively, don't do anything
  6. [[ $- != *i* ]] && return
  7.  
  8.  
  9. _isxrunning=false
  10. [[ -n "$DISPLAY" ]] && _isxrunning=true
  11.  
  12.  
  13. # PS1 CONFIG {{{
  14.  
  15. function __prompt_command() {
  16.     local EXIT="$?"
  17.  
  18.     local RCol='\[\e[0m\]'  # Text Reset
  19.  
  20.     # Regular                   Bold                        Underline                   High Intensity              BoldHigh Intensity          Background              High Intensity Backgrounds
  21.     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\]';
  22.     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\]';
  23.     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\]';
  24.     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\]';
  25.     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\]';
  26.     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\]';
  27.     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\]';
  28.     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\]';
  29.     ### End Color Vars ### }}}
  30.  
  31.     # Useful Definition
  32.     HOST="\h"                   #   The hostname, up to the first ‘.’.
  33.     USER="\u"                   #   The username of the current user.
  34.     DIR="\w"                    #   The current working directory, with $HOME abbreviated with a tilde
  35.     NEWLINE="\n"                #   A newline.
  36.     DATE="\d"                   #   The date, in "Weekday Month Date" format
  37.     TIME_ALL="\t"               #   The time, in 24-hour HH:MM:SS format.
  38.     TIME_SH="\@"                #   The time, in 12-hour am/pm format.
  39.     HIST_NUM="\!"               #   The history number of this command.
  40.     CUR_USER="\$"               #   If the effective uid is 0, #, otherwise $.
  41.     ### END Useful Definition ### }}}
  42.  
  43.     if [ "${EXIT}" -eq 0 ]
  44.     then
  45.         PS1="\n┌─${BICya}[${USER}]${RCol} ${IBlu}(${TIME_SH})${RCol} ${IPur}{${DATE}}${RCol} ${IGre}|${DIR}|${RCol}\n└─╼ ${CUR_USER} "
  46.     else
  47.         PS1="${BIRed}\n┌─[${USER}] (${TIME_SH}) {${DATE}} !${HIST_NUM}! |${DIR}|\n└─╼ ${CUR_USER}${RCol} "
  48.     fi
  49. }
  50.  
  51. [[ -f $HOME/.dircolors ]] && eval $(dircolors -b $HOME/.dircolors)
  52. if $_isxrunning; then
  53.  
  54.     [[ -f $HOME/.dircolors_256 ]] && eval $(dircolors -b $HOME/.dircolors_256)
  55.  
  56.     case $TERM in
  57.         xterm*|*rxvt*)
  58.             PROMPT_COMMAND='echo -ne "\033]0;Terminal\007"'     # Set Terminal name "Terminal"
  59.             PROMPT_COMMAND=__prompt_command                     # Set Per-line Prompt
  60.             ;;
  61.     esac
  62. fi
  63. #}}}
  64.  
  65.  
  66.  
  67. # BASH OPTIONS {{{
  68. shopt -s cdspell                 # Correct cd typos
  69. shopt -s checkwinsize            # Update windows size on command
  70. shopt -s histappend              # Append History instead of overwriting file
  71. shopt -s cmdhist                 # Bash attempts to save all lines of a multiple-line command in the same history entry
  72. shopt -s extglob                 # Extended pattern
  73. shopt -s no_empty_cmd_completion # No empty completion
  74. #}}}
  75.  
  76.  
  77. # BASH HISTORY {{{
  78. # make multiple shells share the same history file
  79. HISTSIZE=            # bash history will save N commands
  80. HISTFILESIZE= # bash will remember N commands
  81. HISTCONTROL=ignoreboth   # ingore duplicates and spaces
  82. HISTTIMEFORMAT="%h/%d - %H:%M:%S "
  83. HISTIGNORE='exit:clear:history'
  84. #}}}
  85.  
  86. # COLORED MANUAL PAGES {{{
  87. if $_isxrunning; then
  88.     export PAGER=less
  89.     export LESS_TERMCAP_mb=$'\E[01;31m'       # begin blinking
  90.     export LESS_TERMCAP_md=$'\E[01;38;5;74m'  # begin bold
  91.     export LESS_TERMCAP_me=$'\E[0m'           # end mode
  92.     export LESS_TERMCAP_se=$'\E[0m'           # end standout-mode
  93.     export LESS_TERMCAP_so=$'\E[38;5;246m'    # begin standout-mode - info box
  94.     export LESS_TERMCAP_ue=$'\E[0m'           # end underline
  95.     export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
  96. fi
  97. #}}}
  98.  
  99.  
  100. # make less more friendly for non-text input files, see lesspipe(1)
  101. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  102.  
  103.  
  104. # set a fancy prompt (non-color, unless we know we "want" color)
  105. case "$TERM" in
  106.     xterm-color|*-256color) color_prompt=yes;;
  107. esac
  108.  
  109. # Load All alliases Used by me
  110. if [ -f ~/.sh_aliases ]; then
  111.     . ~/.sh_aliases
  112. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement