.bashrc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #
  2. # ~/.bashrc
  3. #
  4. # prompt
  5. FMT_BOLD="\[\e[1m\]"
  6. FMT_DIM="\[\e[2m\]"
  7. FMT_RESET="\[\e[0m\]"
  8. FMT_UNBOLD="\[\e[22m\]"
  9. FMT_UNDIM="\[\e[22m\]"
  10. FG_BLACK="\[\e[30m\]"
  11. FG_BLUE="\[\e[34m\]"
  12. FG_CYAN="\[\e[36m\]"
  13. FG_GREEN="\[\e[32m\]"
  14. FG_GREY="\[\e[37m\]"
  15. FG_MAGENTA="\[\e[35m\]"
  16. FG_RED="\[\e[31m\]"
  17. FG_WHITE="\[\e[97m\]"
  18. BG_BLACK="\[\e[40m\]"
  19. BG_BLUE="\[\e[44m\]"
  20. BG_CYAN="\[\e[46m\]"
  21. BG_GREEN="\[\e[42m\]"
  22. BG_MAGENTA="\[\e[45m\]"
  23. # PS1+=" \$(find . -mindepth 1 -maxdepth 1 -type d | wc -l) " # print number of folders
  24. # PS1+=" \$(find . -mindepth 1 -maxdepth 1 -type f | wc -l) " # print number of files
  25. # PS1+=" \$(find . -mindepth 1 -maxdepth 1 -type l | wc -l) " # print number of symlinks
  26. # export PS1
  27. # export PROMPT_COMMAND='export H1="`history 1|sed -e "s/^[\ 0-9]*//; s/[\d0\d31\d34\d39\d96\d127]*//g; s/\(.\{1,50\}\).*$/\1/g"`";history -a;echo -e "sgr0\ncnorm\nrmso"|tput -S'
  28. # export PS1='[\j:\!]\e[0;36m \e[1;30m[\e[1;34m\u@\H\e[1;30m:\e[0;37m`tty 2>/dev/null` \e[0;32m+${SHLVL}\e[1;30m] \e[1;37m\w\e[0;37m\[\033]0;[ ${H1}... ] \w - \u@\H +$SHLVL @`tty 2>/dev/null` - [ `uptime` ]\007\]\n\[\]\$ '
  29. BRANCH="\$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
  30. export PS1="${FMT_BOLD}${FG_RED}[${FG_CYAN}\u${FG_WHITE}@${FG_BLUE}\H${FG_WHITE}:${FG_MAGENTA}\w${FG_WHITE}${FG_RED}]${FG_GREEN} ${BRANCH}\n\$ ${FG_WHITE}${FMT_UNBOLD}"
  31. export PS0="\e[2 q\2"
  32. # If not running interactively, don't do anything
  33. [[ $- != *i* ]] && return
  34. # Set the history file location and enable history sharing
  35. shopt -s histappend
  36. shopt -s histverify
  37. HISTCONTROL=ignorecase:ignorespace:ignoredups
  38. PROMPT_COMMAND="history -a; history -c; history -r; ${PROMPT_COMMAND}"
  39. [[ -f ~/.bash_profile ]] && source ~/.bash_profile
  40. shopt -s globstar
  41. # install bash-completion package first!
  42. source /usr/share/bash-completion/bash_completion
  43. # keybind modes
  44. # set -o vi # uncomment stuff in ~/.inputrc for more vim features
  45. set -o emacs
  46. # zsh-like autocompletion
  47. bind 'set completion-ignore-case on'
  48. bind 'set show-all-if-ambiguous on'
  49. bind 'TAB:menu-complete'
  50. loopforme(){
  51. while :; do
  52. ${READLINE_LINE}
  53. done
  54. }
  55. # bind -x '"\C-e": loopforme' # CTRL + e as in Example
  56. # for opensuse
  57. test -s .alias && . .alias
  58. source <(cd "$RC_DIRECTORY" && cat -- *)