├── arrow.png ├── dots.png ├── README.md └── avit-da2k.zsh-theme /arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdaciuk/avit-da2k/HEAD/arrow.png -------------------------------------------------------------------------------- /dots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdaciuk/avit-da2k/HEAD/dots.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # avit-da2k 2 | 3 | > oh-my-zsh theme based on avit theme 4 | 5 | ## Dependencies 6 | 7 | Just [ZSH](http://www.zsh.org/) and [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) =) 8 | 9 | ## Installation 10 | 11 | - Copy [`avit-da2k.zsh-theme`](https://raw.githubusercontent.com/fdaciuk/avit-da2k/master/avit-da2k.zsh-theme) to `~/.oh-my-zsh/themes/` 12 | - Add `ZSH_THEME="avit-da2k"` on `~/.zshrc` 13 | - Run `source ~/.zshrc` 14 | 15 | Enjoy ;) 16 | 17 | ## Differences from avit 18 | 19 | **Right arrow:** 20 | 21 | ![](arrow.png) 22 | 23 | **Dots instead left arrow:** 24 | 25 | ![](dots.png) 26 | 27 | ## License 28 | 29 | [MIT](https://github.com/fdaciuk/licenses/blob/master/MIT-LICENSE.md) © Fernando Daciuk 30 | -------------------------------------------------------------------------------- /avit-da2k.zsh-theme: -------------------------------------------------------------------------------- 1 | # AVIT Da2k ZSH Theme 2 | 3 | PROMPT=' 4 | $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) 5 | %{$fg[$CARETCOLOR]%}➤%{$resetcolor%} ' 6 | 7 | PROMPT2='%{$fg[$CARETCOLOR]%}...%{$reset_color%} ' 8 | 9 | RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' 10 | 11 | local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " 12 | local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" 13 | local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" 14 | 15 | function _current_dir() { 16 | local _max_pwd_length="65" 17 | if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then 18 | echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " 19 | else 20 | echo "%{$fg_bold[blue]%}%~%{$reset_color%} " 21 | fi 22 | } 23 | 24 | function _user_host() { 25 | if [[ -n $SSH_CONNECTION ]]; then 26 | me="%n@%m" 27 | elif [[ $LOGNAME != $USER ]]; then 28 | me="%n" 29 | fi 30 | if [[ -n $me ]]; then 31 | echo "%{$fg[cyan]%}$me%{$reset_color%}:" 32 | fi 33 | } 34 | 35 | function _vi_status() { 36 | if {echo $fpath | grep -q "plugins/vi-mode"}; then 37 | echo "$(vi_mode_prompt_info)" 38 | fi 39 | } 40 | 41 | function _ruby_version() { 42 | if {echo $fpath | grep -q "plugins/rvm"}; then 43 | echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" 44 | elif {echo $fpath | grep -q "plugins/rbenv"}; then 45 | echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}" 46 | fi 47 | } 48 | 49 | # Determine the time since last commit. If branch is clean, 50 | # use a neutral color, otherwise colors will vary according to time. 51 | function _git_time_since_commit() { 52 | # Only proceed if there is actually a commit. 53 | if git log -1 > /dev/null 2>&1; then 54 | # Get the last commit. 55 | last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) 56 | now=$(date +%s) 57 | seconds_since_last_commit=$((now-last_commit)) 58 | 59 | # Totals 60 | minutes=$((seconds_since_last_commit / 60)) 61 | hours=$((seconds_since_last_commit/3600)) 62 | 63 | # Sub-hours and sub-minutes 64 | days=$((seconds_since_last_commit / 86400)) 65 | sub_hours=$((hours % 24)) 66 | sub_minutes=$((minutes % 60)) 67 | 68 | if [ $hours -gt 24 ]; then 69 | commit_age="${days}d" 70 | elif [ $minutes -gt 60 ]; then 71 | commit_age="${sub_hours}h${sub_minutes}m" 72 | else 73 | commit_age="${minutes}m" 74 | fi 75 | 76 | color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL 77 | echo "$color$commit_age%{$reset_color%}" 78 | fi 79 | } 80 | 81 | if [[ $USER == "root" ]]; then 82 | CARETCOLOR="red" 83 | else 84 | CARETCOLOR="white" 85 | fi 86 | 87 | MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" 88 | 89 | ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" 90 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" 91 | 92 | ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" 93 | ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" 94 | ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " 95 | ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " 96 | ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " 97 | ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " 98 | ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " 99 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " 100 | 101 | # Colors vary depending on time lapsed. 102 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" 103 | ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" 104 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" 105 | ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" 106 | 107 | # LS colors, made with http://geoff.greer.fm/lscolors/ 108 | export LSCOLORS="exfxcxdxbxegedabagacad" 109 | export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' 110 | export GREP_COLOR='1;33' 111 | --------------------------------------------------------------------------------