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.

116 lines
3.1 KiB

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