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.

156 lines
4.0 KiB

9 years ago
9 years ago
9 years ago
  1. #
  2. # Using Oh My ZSH
  3. # https://github.com/robbyrussell/oh-my-zsh
  4. #
  5. export ZSH=$HOME/.oh-my-zsh
  6. # Detect if we're running in cygwin
  7. local cygwin="$(env | grep cygdrive &>/dev/null && echo $?)"
  8. if [ -n "${cygwin}" ] && [[ "${cygwin}" == "0" ]]; then
  9. export CSYSTEM="CSYS"
  10. fi
  11. # Best theme ever!
  12. ZSH_THEME="ys"
  13. # System variables for tmux configuration
  14. export ZSH_TMUX_AUTOSTART=false
  15. export ZSH_TMUX_AUTOSTART_ONCE=true
  16. # Used zsh plugins
  17. plugins=(
  18. fedora
  19. systemd
  20. common-aliases
  21. history
  22. per-directory-history
  23. screen
  24. tmux
  25. docker
  26. docker-compose
  27. wd
  28. git
  29. git-extras
  30. mercurial
  31. zsh-completions
  32. )
  33. # Let's update and do other goodness
  34. source $ZSH/oh-my-zsh.sh
  35. # Make sure we're in en_us UTF8
  36. export LANG=en_US.UTF-8
  37. # All Hail EMACS
  38. export EDITOR='emacsclient -a vim'
  39. # Make sure ~/,local/bin and ~/bin are on the path
  40. export PATH="$$HOME/.local/bin:$HOME/bin:$PATH"
  41. # Add something to something else
  42. # $1 is the original value being appended to
  43. # $2 is the seperator
  44. # $3 is what we should add as long as it has some value
  45. function append_if_exists() {
  46. result="$1"
  47. if [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ]; then
  48. result="${result}${2}${3}"
  49. fi
  50. echo $result
  51. }
  52. alias fprobe="ffprobe -v quiet -print_format json -show_format -show_streams"
  53. # Alias to emacsclient
  54. # fall back on vim if emacs isn't started
  55. alias ec="emacsclient -a vim"
  56. # Don't use the embedded shell time. Use GNU time.
  57. alias time="/usr/bin/time"
  58. # Alias for GNU Time with pretty output.
  59. alias ti="/usr/bin/time --format='Command:%C \nElapsed Time: %E\nUser Time: %U\nSystem Time: %S\nCPU: %P\nMax Memory: %MKb\nAverage Memory: %KKb\nAverage Unshared Memory: %DKb\nNumber of Swaps: %W\nNumber of Waits: %w\nExit Status: %x'"
  60. if [ -d "$HOME/.linuxbrew" ]; then
  61. export PATH="$HOME/.linuxbrew/bin:$PATH"
  62. export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
  63. export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
  64. fi
  65. # Go Setup
  66. export GOPATH="$HOME/go"
  67. export PATH="$PATH:$HOME/go/bin"
  68. # Rust Setup
  69. export CARGO_HOME="$HOME/.cargo"
  70. export PATH="$PATH:$CARGO_HOME/bin"
  71. # CL Setup
  72. # if SBCL is installed point to that path
  73. sbcl_bin="$(which sbcl 2> /dev/null | head -n 1)"
  74. if [[ ${sbcl_bin:0:4} != "sbcl" ]]; then
  75. # Handle a case where sbcl is not installed
  76. CL_BIN=$sbcl_bin
  77. fi
  78. if [ -f "$HOME/.update_dotfiles.sh" ]; then
  79. /usr/bin/env sh $HOME/.update_dotfiles.sh
  80. fi
  81. if [ -d "$HOME/.ansible" ]; then
  82. export ANSIBLE_CONFIG="$HOME/.ansible/ansible.cfg"
  83. fi
  84. # rbenv setup
  85. # # doesn't work under msys
  86. if [ -d "$HOME/.rbenv" ] && [ -z "$MSYSTEM" ]; then
  87. export PATH="$HOME/.rbenv/bin:$PATH"
  88. eval "$(rbenv init -)"
  89. fi
  90. # rust setup
  91. if [ -d "$HOME/.cargo" ]; then
  92. export PATH="$HOME/.cargo/bin:$PATH"
  93. fi
  94. if [ -d "$HOME/.ansible" ]; then
  95. export ANSIBLE_CONFIG="$HOME/.ansible/ansible.cfg"
  96. fi
  97. # A function that does the automatic path translation for a windows emacs
  98. cygwin_emacsclient(){
  99. # Loop over all the input variables and convert their paths
  100. declare -a args=()
  101. for arg in $@
  102. do
  103. win_path="$(cygpath -p -w $arg)"
  104. args=("${args[@]}" "${win_path}")
  105. done
  106. # Execute emacsclient with the correct paths
  107. emacsclient -a vim $args[@]
  108. }
  109. # Cygwin Specific Configuration
  110. if [ -n "${CSYSTEM}" ] && [[ "${CSYSTEM}" == "CSYS" ]]; then
  111. # Configure emacsclient to get the correct paths
  112. emacs_path="$(which emacs)"
  113. if [[ $emacs_path == /cygdrive* ]]; then
  114. alias ec=cygwin_emacsclient
  115. fi
  116. fi
  117. # MSYS Specific Configuration
  118. if [ -n "$MSYSTEM" ] && [[ "$MSYSTEM" == "MSYS" ]]; then
  119. # Make sure msys has our CL on the path
  120. export PATH=$(append_if_exists $PATH ":" $(dirname "$CL_BIN"))
  121. fi
  122. export PATH="/usr/share/haxe/lib:$PATH"
  123. # opam configuration
  124. test -r /home/sothr/.opam/opam-init/init.zsh && . /home/sothr/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
  125. #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
  126. export SDKMAN_DIR="/home/sothr/.sdkman"
  127. [[ -s "/home/sothr/.sdkman/bin/sdkman-init.sh" ]] && source "/home/sothr/.sdkman/bin/sdkman-init.sh"