Skip to content

Commit

Permalink
🔨 ZSH prompt refactor (carloscuesta#16)
Browse files Browse the repository at this point in the history
* 🔨 Refactor into a single materialshell.zsh-theme

By removing the specified numeric colors and using [colorName] there's no need to have to separate files.

* 📝 Update instructions
  • Loading branch information
carloscuesta authored Apr 9, 2017
1 parent 388e3ae commit 4165e8b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 219 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Before starting, you will need to **download materialshell**:

### Zsh

To setup the prompt, you will need to have [```materialshell.zsh-theme```](https://github.com/carloscuesta/materialshell/blob/master/zsh/materialshell-dark.zsh-theme) and [Oh-My-Zsh](http://ohmyz.sh/) installed. Then follow the next steps:
To setup the prompt, you will need to have [```materialshell.zsh-theme```](https://github.com/carloscuesta/materialshell/blob/master/zsh/materialshell.zsh-theme) and [Oh-My-Zsh](http://ohmyz.sh/) installed. Then follow the next steps:

#### [Oh-My-Zsh](http://ohmyz.sh/)

1. Copy ```zsh/materialshell.zsh-theme``` _(dark, oceanic or light)_ to ```~/.oh-my-zsh/themes/``` folder.
2. Modify ```.zshrc``` to enable the theme with ```ZSH_THEME="materialshell-dark"``` or ```ZSH_THEME="materialshell-oceanic"``` depending on the version you want.
1. Copy ```zsh/materialshell.zsh-theme``` to ```~/.oh-my-zsh/themes/``` folder.
2. Modify ```.zshrc``` to enable the theme with ```ZSH_THEME="materialshell"```.
3. Save and restart your terminal.

## Shell Colors
Expand Down
108 changes: 0 additions & 108 deletions zsh/materialshell-dark.zsh-theme

This file was deleted.

108 changes: 0 additions & 108 deletions zsh/materialshell-oceanic.zsh-theme

This file was deleted.

55 changes: 55 additions & 0 deletions zsh/materialshell.zsh-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
eval red=$fg[red]
eval green=$fg[green]
eval yellow=$fg[yellow]
eval blue=$fg[blue]
eval magenta=$fg[magenta]
eval cyan=$fg[cyan]
eval white=$fg[white]
eval grey=$fg[grey]

PROMPT='$(_user_host)${_current_dir}$(git_prompt_info)
%{$white%}>%{$reset_color%} '
PROMPT2='%{$grey%}◀%{$reset_color%} '
RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(git_prompt_short_sha) ${_return_status} %{$white%}%T%{$(echotc DO 1)%}%{$reset_color%}'

local _current_dir="%{$green%}%0~%{$reset_color%} "
local _return_status="%{$red%}%(?..×)%{$reset_color%}"

function _user_host() {
echo "%{$red%}%n%{$reset_color%}%{$white%} at %{$yellow%}%m%{$reset_color%} %{$white%}in "
}

function _vi_status() {
if {echo $fpath | grep -q "plugins/vi-mode"}; then
echo "$(vi_mode_prompt_info)"
fi
}

if [[ $USER == "root" ]]; then
CARETCOLOR="$red"
else
CARETCOLOR="$white"
fi

MODE_INDICATOR="%{_bold$yellow%}❮%{$reset_color%}%{$yellow%}❮❮%{$reset_color%}"

ZSH_THEME_GIT_PROMPT_PREFIX="%{$white%}on %{$blue%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "

ZSH_THEME_GIT_PROMPT_DIRTY=" %{$red%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$green%}✔%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_ADDED=" %{$green%}✚{$reset_color%}"
ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$yellow%}⚑{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DELETED=" %{$red%}✖{$reset_color%} "
ZSH_THEME_GIT_PROMPT_RENAMED=" %{$blue%}▴{$reset_color%} "
ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$cyan%}§{$reset_color%} "
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$grey%}◒{$reset_color%} "

# Format for git_prompt_long_sha() and git_prompt_short_sha()
ZSH_THEME_GIT_PROMPT_SHA_BEFORE="%{$reset_color%}[%{$yellow%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}]"

# LS colors, made with http://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxegedabagacad"
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:'
export GREP_COLOR='1;33'

0 comments on commit 4165e8b

Please sign in to comment.