├── screenshot.png ├── ln.sh ├── LICENSE ├── README.md └── guri.zsh-theme /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/victorfsf/guri/HEAD/screenshot.png -------------------------------------------------------------------------------- /ln.sh: -------------------------------------------------------------------------------- 1 | rm -rf ~/.oh-my-zsh/custom/themes/guri.zsh-theme 2 | ln guri.zsh-theme ~/.oh-my-zsh/custom/themes/guri.zsh-theme 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Victor Ferraz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Guri 2 | 3 | A Simple and fast Oh-My-Zsh theme, based on [Pure](https://github.com/sindresorhus/pure)'s design. 4 | 5 | ![Guri Screenshot](https://github.com/victorfsf/guri/raw/master/screenshot.png) 6 | 7 | ## Installing 8 | 9 | #### This theme requires [Oh-My-Zsh](https://github.com/robbyrussell/oh-my-zsh) with Zsh version 5.1.1 or higher. 10 | 11 | Download the file and save it to `$ZSH_CUSTOM/themes/` (by default `~/.oh-my-zsh/custom/themes/`): 12 | ``` 13 | curl -o $ZSH_CUSTOM/themes/guri.zsh-theme https://raw.githubusercontent.com/victorfsf/guri/master/guri.zsh-theme 14 | ``` 15 | 16 | Then, update the `ZSH_THEME` variable in your `~/.zshrc`: 17 | ``` 18 | ZSH_THEME="guri" 19 | ``` 20 | 21 | And reload your shell: 22 | ``` 23 | . ~/.zshrc 24 | ``` 25 | 26 | ## Font & Colors 27 | 28 | To get the same font and colors used on the screenshot, use the configurations described bellow. 29 | 30 | *PS: This theme also looks pretty good with the [Nord](https://github.com/arcticicestudio/nord) palette!* 31 | 32 | #### Font: 33 | 34 | Install the [Fira Mono for Powerline](https://github.com/powerline/fonts/) and set it with `style: Medium`. 35 | 36 | #### Colors: 37 | 38 | Download the [ZSH Syntax Highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) plugin for... Syntax highlighting your shell. 39 | 40 | ###### Background: #282a36 ![#282a36](https://placehold.it/15/282a36/000000?text=+) 41 | ###### Foreground: #eff0eb ![#eff0eb](https://placehold.it/15/eff0eb/000000?text=+) 42 | ###### Black: #282a36 ![#282a36](https://placehold.it/15/282a36/000000?text=+) 43 | ###### Red: #ff5c57 ![#ff5c57](https://placehold.it/15/ff5c57/000000?text=+) 44 | ###### Green: #5af78e ![#5af78e](https://placehold.it/15/5af78e/000000?text=+) 45 | ###### Yellow: #f3f99d ![#f3f99d](https://placehold.it/15/f3f99d/000000?text=+) 46 | ###### Blue: #57c7ff ![#57c7ff](https://placehold.it/15/57c7ff/000000?text=+) 47 | ###### Magenta: #ff6ac1 ![#ff6ac1](https://placehold.it/15/ff6ac1/000000?text=+) 48 | ###### Cyan: #9aedfe ![#9aedfe](https://placehold.it/15/9aedfe/000000?text=+) 49 | ###### White: #f1f1f0 ![#f1f1f0](https://placehold.it/15/f1f1f0/000000?text=+) 50 | ###### Dark Gray: #686868 ![#686868](https://placehold.it/15/686868/000000?text=+) 51 | ###### Dark Red: #ff5c57 ![#ff5c57](https://placehold.it/15/ff5c57/000000?text=+) 52 | ###### Dark Green: #5af78e ![#5af78e](https://placehold.it/15/5af78e/000000?text=+) 53 | ###### Dark Yellow: #f3f99d ![#f3f99d](https://placehold.it/15/f3f99d/000000?text=+) 54 | ###### Dark Blue: #57c7ff ![#57c7ff](https://placehold.it/15/57c7ff/000000?text=+) 55 | ###### Dark Magenta: #ff6ac1 ![#ff6ac1](https://placehold.it/15/ff6ac1/000000?text=+) 56 | ###### Dark Cyan: #9aedfe ![#9aedfe](https://placehold.it/15/9aedfe/000000?text=+) 57 | ###### Light Gray: #eff0eb ![#eff0eb](https://placehold.it/15/eff0eb/000000?text=+) 58 | -------------------------------------------------------------------------------- /guri.zsh-theme: -------------------------------------------------------------------------------- 1 | GURI_DOT_FILE=".gurirc" 2 | GURI_EXEC_DOT_FILE=false 3 | GURI_SHOW_GIT_STASH=true 4 | GURI_SHOW_EXEC_TIME=true 5 | GURI_MIN_EXEC_TIME=1 6 | GURI_PROMPT_SYMBOL="➜" 7 | 8 | GURI_GIT_PROMPT_PREFIX="$fg[white]" 9 | GURI_GIT_PROMPT_SUFFIX="" 10 | GURI_GIT_PROMPT_DIRTY=" $fg_bold[red]" 11 | GURI_GIT_PROMPT_CLEAN=" $fg_bold[white]" 12 | GURI_GIT_PROMPT_AHEAD="$fg[green]⇡" 13 | GURI_GIT_PROMPT_BEHIND="$fg[magenta]⇣" 14 | GURI_GIT_PROMPT_DIVERGED="$GURI_GIT_PROMPT_AHEAD$GURI_GIT_PROMPT_BEHIND" 15 | 16 | GURI_PIPENV_VENV_NAME="venv" 17 | GURI_ALWAYS_SHOW_PYTHON_VERSION=true 18 | GURI_PYTHON_VERSION_VENV_COLOR="$FG[122]" 19 | GURI_PYTHON_VERSION_COLOR="$FG[153]" 20 | GURI_VENV_INDICATOR_COLOR="$FG[195]" 21 | 22 | ZSH_THEME_GIT_PROMPT_PREFIX="$GURI_GIT_PROMPT_PREFIX" 23 | ZSH_THEME_GIT_PROMPT_SUFFIX="$GURI_GIT_PROMPT_SUFFIX" 24 | ZSH_THEME_GIT_PROMPT_DIRTY="$GURI_GIT_PROMPT_DIRTY" 25 | ZSH_THEME_GIT_PROMPT_CLEAN="$GURI_GIT_PROMPT_CLEAN" 26 | ZSH_THEME_GIT_PROMPT_AHEAD="$GURI_GIT_PROMPT_AHEAD" 27 | ZSH_THEME_GIT_PROMPT_BEHIND="$GURI_GIT_PROMPT_BEHIND" 28 | ZSH_THEME_GIT_PROMPT_DIVERGED="$GURI_GIT_PROMPT_DIVERGED" 29 | 30 | VIRTUAL_ENV_DISABLE_PROMPT="yes" 31 | 32 | guri-pwd() { 33 | if [[ "$PWD" == "$HOME" ]]; then 34 | echo "~" 35 | else 36 | echo "$(basename $PWD)" 37 | fi 38 | } 39 | 40 | guri-folder-level() { 41 | echo "$(expr $(grep -o '/' <<< "$PWD" | grep -c .) - 1)" 42 | } 43 | 44 | guri-ssh-prompt() { 45 | if [[ -n "$SSH_CONNECTION" ]]; then 46 | echo "$fg[magenta]%n@%m » " 47 | elif [[ "$USER" == "root" ]]; then 48 | echo "$fg[red]%n » " 49 | fi 50 | } 51 | 52 | guri-level-prompt() { 53 | printf "$fg_bold[cyan]$(guri-folder-level)»" 54 | printf "$reset_color $(guri-ssh-prompt)$fg[blue]$(guri-pwd)" 55 | } 56 | 57 | guri-git-prompt() { 58 | ref=$(git symbolic-ref HEAD 2> /dev/null) || return 0 59 | command git -c gc.auto=0 fetch &>/dev/null 2>&1 &| 60 | local index=$(command git status --porcelain -b 2> /dev/null) 61 | 62 | local git_status 63 | if $(echo "$index" | grep '^## .*ahead* .*behind' &> /dev/null); then 64 | git_status=" $ZSH_THEME_GIT_PROMPT_DIVERGED" 65 | elif $(echo "$index" | grep '^## .*ahead' &> /dev/null); then 66 | git_status=" $ZSH_THEME_GIT_PROMPT_AHEAD" 67 | elif $(echo "$index" | grep '^## .*behind' &> /dev/null); then 68 | git_status=" $ZSH_THEME_GIT_PROMPT_BEHIND" 69 | fi 70 | 71 | local git_stash 72 | if [[ "$GURI_SHOW_GIT_STASH" == true ]]; then 73 | git_stash="$(command git stash list | wc -l)" 74 | if [[ "$git_stash" > 0 ]]; then 75 | git_stash="$reset_color$fg[magenta]+$git_stash $fg_bold[white]" 76 | else 77 | git_stash=" " 78 | fi 79 | else 80 | git_stash=" " 81 | fi 82 | 83 | printf "$(parse_git_dirty)$git_stash" 84 | printf "$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)" 85 | printf "$ZSH_THEME_GIT_PROMPT_SUFFIX$git_status$reset_color" 86 | } 87 | 88 | guri-zenv-prompt() { 89 | if [[ -n "$Z_ENV_NAME" ]]; then 90 | echo "$fg[green] $Z_UNICODE_SYMBOL" 91 | fi 92 | } 93 | 94 | guri-exec-time-prompt() { 95 | [[ "$GURI_SHOW_EXEC_TIME" == false ]] && return 0 96 | if [[ "$GURI_EXEC_TIME" -ge "$GURI_MIN_EXEC_TIME" ]]; then 97 | local human_time time_color 98 | local days=$(( $GURI_EXEC_TIME / 60 / 60 / 24 )) 99 | local hours=$(( $GURI_EXEC_TIME / 60 / 60 % 24 )) 100 | local minutes=$(( $GURI_EXEC_TIME / 60 % 60 )) 101 | local seconds=$(( $GURI_EXEC_TIME % 60 )) 102 | (( days > 0 )) && human_time+="${days}d " 103 | (( hours > 0 )) && human_time+="${hours}h " 104 | (( minutes > 0 )) && human_time+="${minutes}m " 105 | human_time+="${seconds}s" 106 | if (( hours > 0 || days > 0 )); then 107 | time_color="$fg_bold[red]" 108 | elif (( minutes > 0 )); then 109 | time_color="$fg_bold[magenta]" 110 | else 111 | time_color="$fg_bold[cyan]" 112 | fi 113 | echo " $time_color$human_time$reset_color" 114 | fi 115 | } 116 | 117 | guri-run-dotfile() { 118 | if [[ "$GURI_EXEC_DOT_FILE" == true ]] && [[ -f "$GURI_DOT_FILE" ]]; then 119 | source "$GURI_DOT_FILE" 120 | fi 121 | } 122 | 123 | guri-venv-indicator() { 124 | if [[ -n "$Z_ENV_NAME" ]]; then 125 | psvar[1]="${Z_ENV_NAME} " 126 | elif [[ -n "$VIRTUAL_ENV" ]]; then 127 | if [[ "$PIPENV_ACTIVE" -eq 1 ]]; then 128 | psvar[1]="$GURI_PIPENV_VENV_NAME " 129 | else 130 | psvar[1]="${VIRTUAL_ENV##*/} " 131 | fi 132 | else 133 | psvar[1]="" 134 | fi 135 | if [[ "$GURI_ALWAYS_SHOW_PYTHON_VERSION" == true ]] || \ 136 | [[ -n "$VIRTUAL_ENV" ]]; then 137 | psvar[2]=" v$(python --version 2>&1 | sed -e "s/Python //")" 138 | fi 139 | } 140 | 141 | guri-py-color() { 142 | [[ -n "$VIRTUAL_ENV" ]] && echo "$GURI_PYTHON_VERSION_VENV_COLOR" || \ 143 | echo "$GURI_PYTHON_VERSION_COLOR" 144 | } 145 | 146 | guri-exec-time-start() { 147 | [[ "$GURI_SHOW_EXEC_TIME" == false ]] && return 148 | GURI_EXEC_TIME_START="$(date +%s)" 149 | } 150 | 151 | guri-exec-time-stop() { 152 | [[ "$GURI_SHOW_EXEC_TIME" == false ]] && return 153 | [[ -n "$GURI_EXEC_TIME" ]] && unset GURI_EXEC_TIME 154 | [[ -z "$GURI_EXEC_TIME_START" ]] && return 155 | GURI_EXEC_TIME="$(expr $(date +%s) - $GURI_EXEC_TIME_START )" 156 | unset GURI_EXEC_TIME_START 157 | } 158 | 159 | guri-ret-status() { 160 | echo "%(?:%{$fg_bold[green]%}$GURI_PROMPT_SYMBOL:%{$fg_bold[red]%}$GURI_PROMPT_SYMBOL) " 161 | } 162 | 163 | autoload -Uz add-zsh-hook 164 | 165 | add-zsh-hook chpwd guri-run-dotfile 166 | add-zsh-hook precmd guri-venv-indicator 167 | 168 | add-zsh-hook preexec guri-exec-time-start 169 | add-zsh-hook precmd guri-exec-time-stop 170 | 171 | PROMPT=' 172 | $(guri-level-prompt)$(guri-git-prompt)$(guri-py-color)%2v$(guri-zenv-prompt)$(guri-exec-time-prompt) 173 | %{$GURI_VENV_INDICATOR_COLOR%}%1v$(guri-ret-status)%{$fg_no_bold[white]%}' 174 | --------------------------------------------------------------------------------