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.

.zshrc 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # Initial Oh My Zsh setup
  2. #
  3. export ZSH="${HOME}/.oh-my-zsh"
  4. export ZSH_THEME="avit"
  5. export DISABLE_UPDATE_PROMPT="true"
  6. export UPDATE_ZSH_DAYS=13
  7. export COMPLETION_WAITING_DOTS="true"
  8. export ENABLE_CORRECTION="false"
  9. plugins=(git z)
  10. source "${ZSH}/oh-my-zsh.sh"
  11. # Define custom environment variables
  12. #
  13. export NIX_CONFIG="${HOME}/.nix-profile/etc/profile.d/nix.sh"
  14. export ZSH_PROFILE="${HOME}/.zshrc"
  15. export DOTNET_CLI_TELEMETRY_OPTOUT=1
  16. # Tool related environment variables
  17. #
  18. export AWS_PAGER='less -RFX'
  19. export ERL_AFLAGS="-kernel shell_history enabled"
  20. # Toolings
  21. #
  22. # shellcheck source=/dev/null
  23. if [ -e "${NIX_CONFIG}" ]; then . "${NIX_CONFIG}"; fi
  24. eval "$(thefuck --alias)"
  25. source "$(dirname $(readlink "${ZSH_PROFILE}"))/.docker_shims.zsh"
  26. . <(helm completion zsh)
  27. # Aliases and functions
  28. #
  29. alias f='\fuck'
  30. alias k='\kubectl'
  31. if type gls > /dev/null; then
  32. alias l='\gls -lhA --color=auto --group-directories-first'
  33. alias ls='\gls -lhA --color=auto --group-directories-first'
  34. else
  35. alias l='\ls -lhA'
  36. alias ls='\ls -lhA'
  37. fi
  38. alias d='\dirs -v'
  39. alias p='\pushd'
  40. alias pp='\popd'
  41. alias tf='\terraform'
  42. alias mkdir='\mkdir -vp'
  43. alias ipglobal='\dig +short myip.opendns.com @resolver1.opendns.com'
  44. alias sudo='sudo ' # This allows for using aliases under sudo
  45. alias nsenter='\docker run -it --rm --privileged --pid=host justincormack/nsenter1'
  46. alias dockerdive='\docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive'
  47. alias dockerclean='\docker rmi --force $(docker images -q)'
  48. function git {
  49. if [[ $# -gt 0 ]]; then
  50. /usr/bin/env git $@
  51. else
  52. /usr/bin/env git status --short --branch
  53. fi
  54. }
  55. alias g='git'
  56. function hub {
  57. if [[ $# -gt 0 ]]; then
  58. /usr/bin/env hub $@
  59. else
  60. /usr/bin/env hub status --short --branch
  61. fi
  62. }
  63. alias gh='hub'
  64. alias github='hub'
  65. function npm {
  66. if [[ $# -gt 0 ]]; then
  67. /usr/bin/env npm $@
  68. else
  69. /usr/bin/env npm install
  70. fi
  71. }
  72. alias n='npm'
  73. function vagrant {
  74. if [[ $# -gt 0 ]]; then
  75. /usr/bin/env vagrant $@
  76. else
  77. /usr/bin/env vagrant up
  78. fi
  79. }
  80. alias v='vagrant'
  81. function kubetail {
  82. selectors="${1}"; shift
  83. container="${1}"; shift
  84. kubectl logs -l "${selectors}" -c ${container} $@
  85. }
  86. alias ktail='kubetail'
  87. function kubereleasevolumes {
  88. released_pvs="$(kubectl get pv -n clickhouse -o json | jq '[.items[]|select(.status.phase=="Released")|.metadata.name]|join(" ")' -r)"
  89. kubectl delete pv -n clickhouse ${released_pvs[@]}
  90. }
  91. alias kreleasevolumes=kubereleasevolumes
  92. function local-forward {
  93. local_connection=${1}; shift
  94. remote_connection=${1}; shift
  95. ssh -L "${local_connection}:${remote_connection}" $@
  96. }
  97. # Options
  98. #
  99. # More sane `pushd` settings
  100. unsetopt auto_pushd
  101. setopt pushd_ignore_dups
  102. autoload -U +X bashcompinit && bashcompinit
  103. complete -o nospace -C /usr/local/bin/terraform terraform