bashrc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. case $- in
  2. *i*) ;;
  3. *) return;;
  4. esac
  5. HISTCONTROL=ignoreboth
  6. HISTSIZE=1000
  7. HISTFILESIZE=2000
  8. shopt -s histappend
  9. shopt -s checkwinsize
  10. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  11. case "$TERM" in
  12. xterm-color) color_prompt=yes;;
  13. esac
  14. if [ -n "$force_color_prompt" ]; then
  15. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  16. color_prompt=yes
  17. else
  18. color_prompt=
  19. fi
  20. fi
  21. if [ "$color_prompt" = yes ]; then
  22. PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  23. else
  24. PS1='[\u@\h \W]\$ '
  25. fi
  26. unset color_prompt force_color_prompt
  27. if [ -x /usr/bin/dircolors ]; then
  28. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  29. alias ls='ls --color=auto'
  30. alias grep='grep --color=auto'
  31. alias fgrep='fgrep --color=auto'
  32. alias egrep='egrep --color=auto'
  33. fi
  34. alias ll='ls -alF'
  35. alias la='ls -A'
  36. alias l='ls -CF'
  37. eval "$(hub alias -s)"
  38. if [ -f ~/.bash_aliases ]; then
  39. . ~/.bash_aliases
  40. fi
  41. if ! shopt -oq posix; then
  42. if [ -f /usr/share/bash-completion/bash_completion ]; then
  43. . /usr/share/bash-completion/bash_completion
  44. elif [ -f /etc/bash_completion ]; then
  45. . /etc/bash_completion
  46. fi
  47. fi
  48. # allow ctrl+S in vim to save files, ie pass the command to vim when vim is open.
  49. export EDITOR="vim"
  50. vim() {
  51. local STTYOPTS="$(stty --save)"
  52. stty stop '' -ixoff
  53. command vim --servername vim "$@"
  54. stty "$STTYOPTS"
  55. }
  56. dot_sync() {
  57. current_branch=$(git branch | grep '\*.*' | cut -d '*' -f 2 | tr -d ' ')
  58. if [ -z "$1" ]; then
  59. 1=$current_branch
  60. fi
  61. for branch in $(git branch | grep '^[^*].*$'); do
  62. git ch $branch
  63. git cherry-pick $1 || { echo 'Problems.. manually cherry-pick'; return 0 }
  64. done
  65. git ch $current_branch
  66. }
  67. rmorig() {
  68. if [ "$1" = "-f" ]; then
  69. find . -name "*.orig" -print -delete
  70. else
  71. find . -name "*.orig" -print
  72. fi
  73. }
  74. export PAGER=less
  75. export DOTFILES=$HOME/Documents/dotfiles
  76. export PATH=$DOTFILES/bin:$PATH
  77. export PATH=$PATH:$HOME/.rvm/bin
  78. export PATH=$PATH:/opt/android-sdk/tools:/opt/android-sdk/platform-tools
  79. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
  80. if [ -x /usr/bin/ssh-agent -a -z "$SSH_AUTH_SOCK" ]; then
  81. eval "$(keychain --eval -Q -q --agents ssh `find $HOME/.ssh/* ! -name '*.pub' ! -name 'config' ! -name 'known_hosts'`)"
  82. fi