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.

113 lines
3.1 KiB

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=(archlinux systemd common-aliases history screen tmux wd git git-extras mercurial)
  18. # Let's update and do other goodness
  19. source $ZSH/oh-my-zsh.sh
  20. # Make sure we're in en_us UTF8
  21. export LANG=en_US.UTF-8
  22. # All Hail EMACS
  23. export EDITOR='emacsclient -a vim'
  24. # Make sure ~/bin is on the path
  25. export PATH="$HOME/bin:$PATH"
  26. # Add something to something else
  27. # $1 is the original value being appended to
  28. # $2 is the seperator
  29. # $3 is what we should add as long as it has some value
  30. function append_if_exists() {
  31. result="$1"
  32. if [ ! -z "$1" ] && [ ! -z "$2" ] && [ ! -z "$3" ]; then
  33. result="${result}${2}${3}"
  34. fi
  35. echo $result
  36. }
  37. # Alias to emacsclient
  38. # fall back on vim if emacs isn't started
  39. alias ec="emacsclient -a vim"
  40. # Don't use the embedded shell time. Use GNU time.
  41. alias time="/usr/bin/time"
  42. # Alias for GNU Time with pretty output.
  43. 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'"
  44. if [ -d "$HOME/.linuxbrew" ]; then
  45. export PATH="$HOME/.linuxbrew/bin:$PATH"
  46. export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
  47. export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
  48. fi
  49. # Go Setup
  50. export GOPATH="$HOME/go"
  51. export PATH="$PATH:$HOME/go/bin"
  52. # CL Setup
  53. # if SBCL is installed point to that path
  54. sbcl_bin="$(which sbcl 2> /dev/null | head -n 1)"
  55. if [[ ${sbcl_bin:0:4} != "sbcl" ]]; then
  56. # Handle a case where sbcl is not installed
  57. CL_BIN=$sbcl_bin
  58. fi
  59. if [ -f "$HOME/.update_dotfiles.sh" ]; then
  60. /usr/bin/env sh $HOME/.update_dotfiles.sh
  61. fi
  62. # rbenv setup
  63. # # doesn't work under msys
  64. if [ -d "$HOME/.rbenv" ] && [ -z "$MSYSTEM" ]; then
  65. export PATH="$HOME/.rbenv/bin:$PATH"
  66. eval "$(rbenv init -)"
  67. fi
  68. # A function that does the automatic path translation for a windows emacs
  69. cygwin_emacsclient(){
  70. # Loop over all the input variables and convert their paths
  71. declare -a args=()
  72. for arg in $@
  73. do
  74. win_path="$(cygpath -p -w $arg)"
  75. args=("${args[@]}" "${win_path}")
  76. done
  77. # Execute emacsclient with the correct paths
  78. emacsclient -a vim $args[@]
  79. }
  80. # Cygwin Specific Configuration
  81. if [ -n "${CSYSTEM}" ] && [[ "${CSYSTEM}" == "CSYS" ]]; then
  82. # Configure emacsclient to get the correct paths
  83. emacs_path="$(which emacs)"
  84. if [[ $emacs_path == /cygdrive* ]]; then
  85. alias ec=cygwin_emacsclient
  86. fi
  87. fi
  88. # MSYS Specific Configuration
  89. if [ -n "$MSYSTEM" ] && [[ "$MSYSTEM" == "MSYS" ]]; then
  90. # Make sure msys has our CL on the path
  91. export PATH=$(append_if_exists $PATH ":" $(dirname "$CL_BIN"))
  92. fi