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.

102 lines
2.7 KiB

4 years ago
4 years ago
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. shopt -s extglob
  5. HISTSIZE=
  6. HISTFILESIZE=
  7. export EDITOR='nvim'
  8. export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers"
  9. export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz"
  10. export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers"
  11. export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz"
  12. export LESS='-R'
  13. export LESSOPEN='|~/.lessfilter %s'
  14. if [[ $(uname) != "Linux" ]]; then
  15. test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true
  16. export HOMEBREW_NO_INSTALL_CLEANUP=1
  17. export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com"
  18. export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com"
  19. mount-hdd() {
  20. if [ -z $1 ]; then
  21. sudo umount /dev/disk2s1 && sudo /usr/local/bin/ntfs-3g /dev/disk2s1 /Volumes/NTFS -olocal -oallow_other
  22. else
  23. sudo umount /dev/$1 && sudo /usr/local/bin/ntfs-3g /dev/$1 /Volumes/NTFS -olocal -oallow_other
  24. fi
  25. }
  26. fi
  27. # set PATH so it includes user's private bin if it exists
  28. if [ -d "$HOME/.local/bin" ] ; then
  29. PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')$HOME/.composer/vendor/bin"
  30. fi
  31. source ~/.config/aliasrc
  32. parse_git_branch() {
  33. git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
  34. }
  35. export PS1=" \[\033[0;36m\]\t \[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] "
  36. mkcd() {
  37. if [ ! -d "$1" ]; then
  38. mkdir -p "$1" && cd "$1"
  39. elif [ -d "$1" ]; then
  40. cd "$1"
  41. else
  42. echo "Error"
  43. fi
  44. }
  45. # Go up directory structures
  46. up() {
  47. cd $(printf "%0.0s../" $(seq 1 $1));
  48. }
  49. git() {
  50. if [[ $@ == "mergetool" ]]; then
  51. command git mergetool --no-gui
  52. else
  53. command git $@
  54. fi
  55. }
  56. # git branch -vv | grep 'gone\]' | awk ' { print $1 }' | xargs -p git branch -d
  57. git-prune() {
  58. if [[ $@ == "--apply" ]]; then
  59. command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d
  60. else
  61. echo "Run \"git prune --apply\" to delete the following branches:"
  62. command git branch --merged develop | grep -vEw "develop$|master$"
  63. fi
  64. }
  65. color-diff() {
  66. if [ -z ${1+x} ] || [ -z ${2+x} ]; then
  67. echo "Usage: color-diff dir1/ dir2/"
  68. return
  69. fi
  70. diff -bur $1 $2 | colordiff | less
  71. }
  72. export NVM_DIR="$HOME/.nvm"
  73. [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
  74. [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
  75. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  76. [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
  77. eval "$(thefuck --alias)"