bashrc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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="nvim"
  50. alias vim="nvim"
  51. dot_sync() {
  52. current_branch=$(git branch | grep '\*.*' | cut -d '*' -f 2 | tr -d ' ')
  53. if [ -z "$1" ]; then
  54. 1=$current_branch
  55. fi
  56. for branch in $(git branch | grep '^[^*].*$'); do
  57. git ch $branch
  58. git cherry-pick $1 || { echo 'Problems.. manually cherry-pick'; return 0 }
  59. done
  60. git ch $current_branch
  61. }
  62. rmorig() {
  63. if [ "$1" = "-f" ]; then
  64. find . -name "*.orig" -print -delete
  65. else
  66. find . -name "*.orig" -print
  67. fi
  68. }
  69. export PAGER=less
  70. export DOTFILES=$HOME/Documents/dotfiles
  71. export GOPATH=$HOME/Documents/go
  72. export PATH=$DOTFILES/bin:$PATH
  73. export PATH=$PATH:$HOME/.rvm/bin
  74. export PATH=$PATH:/opt/android-sdk/tools:/opt/android-sdk/platform-tools
  75. export PATH=$PATH:$GOPATH/bin
  76. [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
  77. if [ -x /usr/bin/ssh-agent -a -z "$SSH_AUTH_SOCK" ]; then
  78. eval "$(keychain --eval -Q -q --agents ssh `find $HOME/.ssh/* ! -name '*.pub' ! -name 'config' ! -name 'known_hosts'`)"
  79. fi