├── screenshot.png ├── README.md ├── LICENSE └── gndx.zsh-theme /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gndx/gndx-zsh-theme/HEAD/screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gndx-zsh-theme 2 | An oh-my-zsh theme. 3 | 4 | ## Introducion 5 | ![gndx zsh theme](https://raw.githubusercontent.com/gndx/gndx-zsh-theme/master/screenshot.png) 6 | 7 | ## Installation 8 | 1. Write in your terminal `git clone https://github.com/gndx/gndx-zsh-theme/ $ZSH_CUSTOM/themes/gndx-zsh-theme` 9 | 2. Open your `.zshrc` 10 | 3. Change your `ZSH_THEME` to *`gndx-zsh-theme/gndx`* 11 | 12 | REF: [Oh-My-Zsh External themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) 13 | 14 | ### Extras 15 | Add to the plugins zsh-autosuggestions and zsh-syntax-highlighting 16 | 17 | ### Contributing 18 | If someone wants to add or improve something, I invite you to collaborate directly in this repository: [gndx-zsh-theme](https://github.com/gndx/gndx-zsh-theme) 19 | 20 | ### Contributors 21 | 22 | - Oscar Barajas : [https://github.com/gndx](https://github.com/gndx) 23 | 24 | ### License 25 | gndx-zsh-theme is released under the [MIT License](https://opensource.org/licenses/MIT). 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Oscar Barajas Tavares 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 | -------------------------------------------------------------------------------- /gndx.zsh-theme: -------------------------------------------------------------------------------- 1 | function real_time() { 2 | local color="%{$fg_no_bold[cyan]%}"; 3 | local color2="%{$fg_no_bold[yellow]%}"; 4 | local time="[$(date +%H:%M)]"; 5 | local color_reset="%{$reset_color%}"; 6 | echo "${color}🧔🏻$(host_name)${color_reset} 🤖 ${color}${time}${color_reset}"; 7 | } 8 | 9 | function host_name() { 10 | local color="%{$fg_no_bold[cyan]%}"; # color in PROMPT need format in %{XXX%} which is not same with echo 11 | local ip 12 | if [[ "$OSTYPE" == "linux-gnu" ]]; then 13 | ip="$(hostname)"; 14 | elif [[ "$OSTYPE" == "darwin"* ]]; then 15 | ip="$(hostname)"; 16 | else 17 | fi 18 | local color_reset="%{$reset_color%}"; 19 | echo "${color}[%n@${ip}]${color_reset}"; 20 | } 21 | 22 | function directory() { 23 | local color="%{$fg_no_bold[white]%}"; 24 | local directory="${PWD/#$HOME/~}"; 25 | local color_reset="%{$reset_color%}"; 26 | echo "📁${color}${directory}${color_reset}"; 27 | } 28 | 29 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[red]%}[%{$fg_no_bold[yellow]%}"; 30 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "; 31 | ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_no_bold[red]%}] 🔥"; 32 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_no_bold[red]%}] 💚"; 33 | 34 | function update_git_status() { 35 | GIT_STATUS=$(git_prompt_info); 36 | } 37 | 38 | function git_status() { 39 | echo "${GIT_STATUS}" 40 | } 41 | 42 | function update_command_status() { 43 | local arrow=""; 44 | local color_reset="%{$reset_color%}"; 45 | local reset_font="%{$fg_no_bold[white]%}"; 46 | if $1; 47 | then 48 | arrow="%{$fg_bold[yellow]%}❱%{$fg_bold[blue]%}❱%{$fg_bold[red]%}❱"; 49 | else 50 | arrow="%{$fg_bold[red]%}❱❱❱"; 51 | fi 52 | COMMAND_STATUS="${arrow}${reset_font}${color_reset}"; 53 | } 54 | 55 | update_command_status true; 56 | 57 | function command_status() { 58 | echo "${COMMAND_STATUS}" 59 | } 60 | 61 | output_command_execute_after() { 62 | if [ "$COMMAND_TIME_BEIGIN" = "-20200325" ] || [ "$COMMAND_TIME_BEIGIN" = "" ]; 63 | then 64 | return 1; 65 | fi 66 | 67 | local cmd="${$(fc -l | tail -1)#* }"; 68 | local color_cmd=""; 69 | if $1; 70 | then 71 | color_cmd="$fg_no_bold[green]"; 72 | else 73 | color_cmd="$fg_bold[red]"; 74 | fi 75 | local color_reset="$reset_color"; 76 | cmd="${color_cmd}${cmd}${color_reset}" 77 | 78 | local time="[$(date +%H:%M:%S)]" 79 | local color_time="$fg_no_bold[cyan]"; 80 | time="${color_time}${time}${color_reset}"; 81 | } 82 | 83 | 84 | precmd() { 85 | local last_cmd_return_code=$?; 86 | local last_cmd_result=true; 87 | if [ "$last_cmd_return_code" = "0" ]; 88 | then 89 | last_cmd_result=true; 90 | else 91 | last_cmd_result=false; 92 | fi 93 | 94 | update_git_status; 95 | 96 | update_command_status $last_cmd_result; 97 | 98 | output_command_execute_after $last_cmd_result; 99 | } 100 | 101 | setopt PROMPT_SUBST; 102 | 103 | TMOUT=1; 104 | TRAPALRM() { 105 | if [ "$WIDGET" = "" ] || [ "$WIDGET" = "accept-line" ] ; then 106 | zle reset-prompt; 107 | fi 108 | } 109 | 110 | PROMPT='$(real_time) $(directory) $(git_status)$(command_status) '; 111 | --------------------------------------------------------------------------------