Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. #
  2. # ~/.bashrc
  3. #
  4.  
  5. [[ $- != *i* ]] && return
  6.  
  7. colors() {
  8. local fgc bgc vals seq0
  9.  
  10. printf "Color escapes are %s\n" '\e[${value};...;${value}m'
  11. printf "Values 30..37 are \e[33mforeground colors\e[m\n"
  12. printf "Values 40..47 are \e[43mbackground colors\e[m\n"
  13. printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
  14.  
  15. # foreground colors
  16. for fgc in {30..37}; do
  17. # background colors
  18. for bgc in {40..47}; do
  19. fgc=${fgc#37} # white
  20. bgc=${bgc#40} # black
  21.  
  22. vals="${fgc:+$fgc;}${bgc}"
  23. vals=${vals%%;}
  24.  
  25. seq0="${vals:+\e[${vals}m}"
  26. printf " %-9s" "${seq0:-(default)}"
  27. printf " ${seq0}TEXT\e[m"
  28. printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
  29. done
  30. echo; echo
  31. done
  32. }
  33.  
  34. [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
  35.  
  36. # Change the window title of X terminals
  37. case ${TERM} in
  38. xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
  39. PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
  40. ;;
  41. screen*)
  42. PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
  43. ;;
  44. esac
  45.  
  46. use_color=true
  47.  
  48. # Set colorful PS1 only on colorful terminals.
  49. # dircolors --print-database uses its own built-in database
  50. # instead of using /etc/DIR_COLORS. Try to use the external file
  51. # first to take advantage of user additions. Use internal bash
  52. # globbing instead of external grep binary.
  53. safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
  54. match_lhs=""
  55. [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
  56. [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
  57. [[ -z ${match_lhs} ]] \
  58. && type -P dircolors >/dev/null \
  59. && match_lhs=$(dircolors --print-database)
  60. [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
  61.  
  62. if ${use_color} ; then
  63. # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
  64. if type -P dircolors >/dev/null ; then
  65. if [[ -f ~/.dir_colors ]] ; then
  66. eval $(dircolors -b ~/.dir_colors)
  67. elif [[ -f /etc/DIR_COLORS ]] ; then
  68. eval $(dircolors -b /etc/DIR_COLORS)
  69. fi
  70. fi
  71.  
  72. if [[ ${EUID} == 0 ]] ; then
  73. PS1='\[\033[01;31m\][\h\[\033[01;36m\] \w\[\033[01;31m\]]\$\[\033[00m\] '
  74. else
  75. PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \w\[\033[01;32m\]]\$\[\033[00m\] '
  76. fi
  77.  
  78. alias ls='ls --color=auto'
  79. alias grep='grep --colour=auto'
  80. alias egrep='egrep --colour=auto'
  81. alias fgrep='fgrep --colour=auto'
  82. else
  83. if [[ ${EUID} == 0 ]] ; then
  84. # show root@ when we don't have colors
  85. PS1='\u@\h \W \$ '
  86. else
  87. PS1='\u@\h \w \$ '
  88. fi
  89. fi
  90.  
  91. unset use_color safe_term match_lhs sh
  92.  
  93. alias cp="cp -i" # confirm before overwriting something
  94. alias df='df -h' # human-readable sizes
  95. alias free='free -m' # show sizes in MB
  96. alias np='nano -w PKGBUILD'
  97. alias more=less
  98. alias free='free -h'
  99. alias tb='taskbook'
  100.  
  101. xhost +local:root > /dev/null 2>&1
  102.  
  103. complete -cf sudo
  104.  
  105. # Bash won't get SIGWINCH if another process is in the foreground.
  106. # Enable checkwinsize so that bash will check the terminal size when
  107. # it regains control. #65623
  108. # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
  109. shopt -s checkwinsize
  110.  
  111. shopt -s expand_aliases
  112.  
  113. # export QT_SELECT=4
  114.  
  115. # Enable history appending instead of overwriting. #139609
  116. shopt -s histappend
  117.  
  118. #
  119. # # ex - archive extractor
  120. # # usage: ex <file>
  121. ex ()
  122. {
  123. if [ -f $1 ] ; then
  124. case $1 in
  125. *.tar.bz2) tar xjf $1 ;;
  126. *.tar.gz) tar xzf $1 ;;
  127. *.bz2) bunzip2 $1 ;;
  128. *.rar) unrar x $1 ;;
  129. *.gz) gunzip $1 ;;
  130. *.tar) tar xf $1 ;;
  131. *.tbz2) tar xjf $1 ;;
  132. *.tgz) tar xzf $1 ;;
  133. *.zip) unzip $1 ;;
  134. *.Z) uncompress $1;;
  135. *.7z) 7z x $1 ;;
  136. *) echo "'$1' cannot be extracted via ex()" ;;
  137. esac
  138. else
  139. echo "'$1' is not a valid file"
  140. fi
  141. }
  142.  
  143. # better yaourt colors
  144. export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
  145.  
  146. # export some locals
  147. export LANG="es_ES.UTF-8"
  148. export LC_TIME="es_ES.UTF-8"
  149.  
  150. # call neofetch
  151. neofetch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement