You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/bash
  2. #set -o vi
  3. #bind -m vi-insert "\C-l":clear-screen
  4. HISTSIZE=
  5. HISTFILESIZE=
  6. # set PATH so it includes user's private bin if it exists
  7. if [ -d "$HOME/.local/bin" ] ; then
  8. PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')"
  9. fi
  10. source ~/.config/aliasrc
  11. parse_git_branch() {
  12. git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
  13. }
  14. export PS1="\[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] "
  15. mkcd() {
  16. if [ ! -d "$1" ]; then
  17. mkdir -p "$1" && cd "$1"
  18. elif [ -d "$1" ]; then
  19. cd "$1"
  20. else
  21. echo "Error"
  22. fi
  23. }
  24. # Go up directory structures
  25. up() {
  26. cd $(printf "%0.0s../" $(seq 1 $1));
  27. }
  28. git() {
  29. if [[ $@ == "mergetool" ]]; then
  30. command git mergetool --no-gui
  31. else
  32. command git $@
  33. fi
  34. }
  35. git-prune() {
  36. if [[ $@ == "prune" ]]; then
  37. command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d
  38. else
  39. command git branch --merged develop | grep -vEw "develop$|master$"
  40. fi
  41. }
  42. color-diff() {
  43. if [ -z ${1+x} ] || [ -z ${2+x} ]; then
  44. echo "Usage: color-diff dir1/ dir2/"
  45. return
  46. fi
  47. diff -bur $1 $2 | colordiff | less
  48. }
  49. export EDITOR='nvim'
  50. shopt -s extglob
  51. export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers"
  52. export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com"
  53. export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers"
  54. export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com"
  55. export NVM_DIR="$HOME/.nvm"
  56. [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
  57. [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
  58. eval $(thefuck --alias)
  59. test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true
  60. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  61. [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
  62. export LESS='-R'
  63. export LESSOPEN='|~/.lessfilter %s'
  64. export TMPDIR=/tmp