My Unix config files and shell scripts, optimized for Fedora, Debian, macOS and Windows (in that order).
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.
 
 
 
 
 
 

114 lines
3.1 KiB

  1. ###
  2. # .zshrc
  3. #
  4. # Kirsle's Global ZSH Configuration
  5. # Updated: 2015-07-07
  6. ###
  7. export LANG=en_US.UTF-8 # Unicode
  8. setopt prompt_subst # Allow for dynamic prompts
  9. autoload -U colors && colors # Get color aliases
  10. # 256 colors
  11. [[ "$TERM" == "xterm" ]] && export TERM=xterm-256color
  12. # Load color aliases
  13. setopt prompt_subst
  14. autoload -U colors && colors
  15. # Normalize the PATH
  16. export PATH="/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:${HOME}/bin:${HOME}/go/bin:${HOME}/android/sdk/platform-tools"
  17. export EDITOR="/usr/bin/vim"
  18. # Virtualenv
  19. export WORKON_HOME=~/.virtualenv
  20. # Reload zshrc
  21. alias rezsh="source ${HOME}/.zshrc"
  22. # Allow overriding hostname in the prompt from a local config
  23. export PROMPT_HOSTNAME="%m"
  24. # Source local (system specific) configurations
  25. if [[ -f "${HOME}/.zshrc-local" ]]; then
  26. source "${HOME}/.zshrc-local"
  27. fi
  28. ###
  29. # Base shell prompt.
  30. ###
  31. # I slowly build the prompt up over multiple places and store it in
  32. # in $base_prompt, so I can modify it before exporting it (for example,
  33. # so the git branch appears before the % at the end of the prompt).
  34. # For the color palette, see: http://www.pixelbeat.org/docs/terminal_colours/
  35. # Use light shades of blue and pink.
  36. local blue="%F{39}"
  37. local pink="%F{213}"
  38. local orange="%F{208}"
  39. local lime="%F{46}"
  40. local cyan="%F{51}"
  41. local base_prompt="%{$blue%}[%{$pink%}%n%{$blue%}@%{$pink%}${PROMPT_HOSTNAME} %{$lime%}%1~"
  42. ###
  43. # Include git branch in the prompt
  44. ###
  45. git_branch() {
  46. local res=`git branch 2>/dev/null | grep -v '^[^*]' | perl -pe 's/^\*\s+//g'`
  47. if [[ "$res" != "" ]]; then
  48. local res=" ($res)"
  49. fi
  50. echo $res
  51. return $res
  52. }
  53. local git_prompt='%{$cyan%}$(git_branch)%{$reset_color%}'
  54. local base_prompt="${base_prompt}${git_prompt}"
  55. # End the base prompt
  56. local base_prompt="${base_prompt}%{$blue%}]%# %{%f%}"
  57. ###############################################################################
  58. # zsh plugins #
  59. ###############################################################################
  60. # Load zgen (plugin manager)
  61. source "${HOME}/.dotfiles/zsh/zgen/zgen.zsh"
  62. # Initialize zgen plugins
  63. if ! zgen saved; then
  64. echo "Creating a zgen save"
  65. # Load plugins
  66. zgen oh-my-zsh plugins/virtualenv
  67. zgen oh-my-zsh plugins/virtualenvwrapper
  68. zgen load jimmijj/zsh-syntax-highlighting
  69. zgen load tarruda/zsh-autosuggestions # depends on syntax-highlighting
  70. # Save all to the init script
  71. zgen save
  72. fi
  73. ###
  74. # Configure plugin: virtualenvwrapper
  75. ###
  76. # Virtualenv prompt. The dynamic part (name of the virtualenv) needs to
  77. # recompute each time so we separate it out into a single-quoted variable.
  78. # See: http://stackoverflow.com/questions/11877551/zsh-not-re-computing-my-shell-prompt
  79. export ZSH_THEME_VIRTUALENV_PREFIX="("
  80. export ZSH_THEME_VIRTUALENV_SUFFIX=")"
  81. local virtualenv_prompt='%{$orange%}$(virtualenv_prompt_info)%{$reset_color%}'
  82. local base_prompt="${virtualenv_prompt}${base_prompt}"
  83. ###
  84. # Configure plugin: zsh-autosuggestions
  85. ###
  86. export AUTOSUGGESTION_HIGHLIGHT_COLOR="fg=2"
  87. export AUTOSUGGESTION_ACCEPT_RIGHT_ARROW=1
  88. # Finalize and export the prompt
  89. export PROMPT=$base_prompt