Last active
September 29, 2016 12:21
-
-
Save jrolfs/7f47259ec6ad753fced36c8cf646ec97 to your computer and use it in GitHub Desktop.
My Frankenstein Zsh Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # A theme based on theme based on Steve Losh's Extravagant Prompt with vcs_info integration. | |
| # | |
| # Authors: | |
| # Steve Losh <[email protected]> | |
| # Bart Trojanowski <[email protected]> | |
| # Brian Carper <[email protected]> | |
| # steeef <[email protected]> | |
| # Sorin Ionescu <[email protected]> | |
| # | |
| # Screenshots: | |
| # http://i.imgur.com/HyRvv.png | |
| # | |
| function prompt_jamie_precmd { | |
| if (( $+functions[git-info] )); then | |
| git-info | |
| fi | |
| if (( $+functions[python-info] )); then | |
| python-info | |
| fi | |
| if (( $+functions[ruby-info] )); then | |
| ruby-info | |
| fi | |
| } | |
| function prompt_jamie_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 vcs_info before each command. | |
| add-zsh-hook precmd prompt_jamie_precmd | |
| # Use extended color pallete if available. | |
| if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then | |
| _prompt_jamie_colors=( | |
| "%F{14}" | |
| "%F{16}" | |
| "%F{05}" | |
| "%F{13}" | |
| "%F{02}" | |
| ) | |
| else | |
| _prompt_jamie_colors=( | |
| "%F{cyan}" | |
| "%F{yellow}" | |
| "%F{magenta}" | |
| "%F{red}" | |
| "%F{green}" | |
| ) | |
| fi | |
| # Set editor-info parameters. | |
| zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' | |
| zstyle ':prezto:module:editor:info:keymap:primary' format "⤳" | |
| zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{red}♺%f' | |
| zstyle ':prezto:module:editor:info:keymap:alternate' format "⥄" | |
| # Set git-info parameters. | |
| zstyle ':prezto:module:git:info' verbose 'yes' | |
| zstyle ':prezto:module:git:info:action' format " :%%B${_prompt_jamie_colors[2]}%s%f%%b" | |
| zstyle ':prezto:module:git:info:added' format " %%B%${_prompt_jamie_colors[5]}✚%f%%b" | |
| zstyle ':prezto:module:git:info:ahead' format " %%B${_prompt_jamie_colors[2]}⬆%f%%b" | |
| zstyle ':prezto:module:git:info:behind' format " %%B${_prompt_jamie_colors[2]}⬇%f%%b" | |
| zstyle ':prezto:module:git:info:branch' format "(${_prompt_jamie_colors[1]}%b%f)" | |
| zstyle ':prezto:module:git:info:commit' format ":%${_prompt_jamie_colors[5]}%.7c%f" | |
| zstyle ':prezto:module:git:info:deleted' format " %%B${_prompt_jamie_colors[4]}✖%f%%b" | |
| zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}✱%f%%b' | |
| zstyle ':prezto:module:git:info:position' format ":${_prompt_jamie_colors[4]}%p%f" | |
| zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b' | |
| zstyle ':prezto:module:git:info:stashed' format " %%B${_prompt_jamie_colors[1]}✭%f%%b" | |
| zstyle ':prezto:module:git:info:unmerged' format " %%B${_prompt_jamie_colors[2]}═%f%%b" | |
| zstyle ':prezto:module:git:info:untracked' format ' %%B%F{white}◼%f%%b' | |
| zstyle ':prezto:module:git:info:keys' format 'prompt' '%b' 'rprompt' '%A%B%S%a%d%m%r%U%u' | |
| # Set python-info parameters. | |
| zstyle ':prezto:module:python:info:virtualenv' format '(%v)' | |
| # Set ruby-info parameters. | |
| zstyle ':prezto:module:ruby:info:version' format '%F{red}(%v)%f' | |
| # if [ ${#branch} -ge 30 ]; then | |
| # branch="${branch:0:27}...)" | |
| # fi | |
| # Define prompts. | |
| PROMPT=" | |
| ${_prompt_jamie_colors[3]}%n%f at \ | |
| ${_prompt_jamie_colors[2]}%m%f in \ | |
| ${_prompt_jamie_colors[5]}%~%f \ | |
| "'$git_info[prompt]'" | |
| "'$editor_info[keymap]'" " | |
| RPROMPT='$git_info[rprompt] $ruby_info[version]%(?:: %F{red}⏎%f)' | |
| } | |
| prompt_jamie_setup "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment