A while back I posted about Amuse my prompt theme for ZSH targeting oh-my-zsh
. Since this was a much appreciated theme, I would like to share another theme, Pristine, that I have created.
However, I recently switched to using Prezto. This is because it felt like a more minimalistic configuration framework for ZSH. I also wanted to get faster load times. I must say my experience has been quite good and I really like it. Obviously there are pros and cons but I digress.
Needless to say Pristine targets Prezto. It is influenced by and has a lot of similarities with Amuse. However, there are subtle changes that I feel make it more cleaner and simpler. These are the highlights of Pristine :
- It tells you which branch you are on if the current working directory is a git repository.
- It indicates the git status of the repository to highlight whether there are any changes by using a green tick (✔) for no changes or a red cross (✗) for uncommitted changes.
- It keeps the prompt where you type on a new line with a preceding $ sign, to make more space for typing commands.
- It displays both ruby & node versions in use currently on the right. I find this very useful since I often work with both.
- It also modifies the spell correction prompt offered by ZSH to highlight the spelling error more prominently.
Here is Pristine :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | # vim: ft=conf function prompt_pristine_precmd { git-info node-info ruby-info } function prompt_pristine_setup { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS prompt_opts=(cr percent subst) # Load required functions. autoload -Uz add-zsh-hook # Add hook for calling git-info before each command. add-zsh-hook precmd prompt_pristine_precmd # Set git-info parameters. zstyle ':prezto:module:git:info' verbose 'yes' zstyle ':prezto:module:git:info:action' format ' +%s' zstyle ':prezto:module:git:info:branch' format '%F{magenta}%b%f' zstyle ':prezto:module:git:info:commit' format ' %F{white}%.7c%f' zstyle ':prezto:module:git:info:indexed' format ' ' zstyle ':prezto:module:git:info:unindexed' format ' ' zstyle ':prezto:module:git:info:untracked' format ' ' zstyle ':prezto:module:git:info:clean' format ' %F{green}✔%f' zstyle ':prezto:module:git:info:dirty' format ' %F{red}✗%f' zstyle ':prezto:module:git:info:keys' format \ 'prompt' ' on $(coalesce "%b" "%p" "%c")${git_info[rprompt]}%s' \ 'rprompt' '%C%D' # Set ruby-info parameters. zstyle ':prezto:module:ruby:info:version' format ' %F{red}ruby-%v%f' # Set node-info parameters. zstyle ':prezto:module:node:info:version' format ' %F{red}node-%v%f' # Define prompts. PROMPT='%F{green}%~%f${(e)git_info[prompt]} $ ' RPROMPT='${node_info[version]},${ruby_info[version]}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } function prompt_pristine_preview { local +h PROMPT='%# ' local +h RPROMPT='' local +h SPROMPT='' prompt_preview_theme 'pristine' "$@" } prompt_pristine_setup "$@" |
And this is what it looks like :
Installation: In order to use Pristine you need to add git
, ruby
and node
modules to be loaded and set your theme
to pristine in your ~/.zpreztorc
.
I really like it, and I hope you guys do too!