Skip to content

Instantly share code, notes, and snippets.

@mieky
Created January 8, 2017 08:41
Show Gist options
  • Save mieky/f1408d395b018c5fd5106de569e84082 to your computer and use it in GitHub Desktop.
Save mieky/f1408d395b018c5fd5106de569e84082 to your computer and use it in GitHub Desktop.
Mike's terminal

Some of my terminal preferences to make it look roughly like here: https://twitter.com/mieky/status/817453249632632833

Some other things I can heartily recommend:

Cheers, @mieky

#
# A fork of one of prezto's default themes, originally by Sorin Ionescu.
#
# To install, put this in ~/.zprezto/modules/prompt/functions
# and set the theme in ~/.zpreztorc:
# zstyle ':prezto:module:prompt' theme 'mike'
#
# 16 Terminal Colors
# -- ---------------
# 0 black
# 1 red
# 2 green
# 3 yellow
# 4 blue
# 5 magenta
# 6 cyan
# 7 white
# 8 bright black
# 9 bright red
# 10 bright green
# 11 bright yellow
# 12 bright blue
# 13 bright magenta
# 14 bright cyan
# 15 bright white
#
# Load dependencies.
pmodload 'helper'
function prompt_sorin_pwd {
_prompt_sorin_pwd="${PWD/#$HOME/~}"
}
function prompt_sorin_git_info {
if (( _prompt_sorin_precmd_async_pid > 0 )); then
# Append Git status.
if [[ -s "$_prompt_sorin_precmd_async_data" ]]; then
alias typeset='typeset -g'
source "$_prompt_sorin_precmd_async_data"
RPROMPT+='${git_info:+${(e)git_info[status]}}'
unalias typeset
fi
# Reset PID.
_prompt_sorin_precmd_async_pid=0
# Redisplay prompt.
zle && zle reset-prompt
fi
}
function prompt_sorin_precmd_async {
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
typeset -p git_info >! "$_prompt_sorin_precmd_async_data"
fi
# Signal completion to parent process.
kill -WINCH $$
}
function prompt_sorin_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_sorin_pwd
# Define prompts.
RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}'
# Kill the old process of slow commands if it is still running.
if (( _prompt_sorin_precmd_async_pid > 0 )); then
kill -KILL "$_prompt_sorin_precmd_async_pid" &>/dev/null
fi
# Compute slow commands in the background.
trap prompt_sorin_git_info WINCH
prompt_sorin_precmd_async &!
_prompt_sorin_precmd_async_pid=$!
}
function prompt_sorin_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
_prompt_sorin_precmd_async_pid=0
_prompt_sorin_precmd_async_data="${TMPPREFIX}-prompt_sorin_data"
# Load required functions.
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_sorin_precmd
# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b'
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{3}♺%f'
zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{2}❮%F{3}❮%F{1}❮%f%b'
# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:action' format '%F{7}:%f%%B%F{9}%s%f%%b'
zstyle ':prezto:module:git:info:added' format ' %%B%F{2}✚%f%%b'
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{13}⬆%f%%b'
zstyle ':prezto:module:git:info:behind' format ' %%B%F{13}⬇%f%%b'
zstyle ':prezto:module:git:info:branch' format ' %%B%F{2}%b%f%%b'
zstyle ':prezto:module:git:info:commit' format ' %%B%F{3}%.7c%f%%b'
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{1}✖%f%%b'
zstyle ':prezto:module:git:info:modified' format ' %%B%F{4}✱%f%%b'
zstyle ':prezto:module:git:info:position' format ' %%B%F{13}%p%f%%b'
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{5}➜%f%%b'
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{6}✭%f%%b'
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{3}═%f%%b'
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{7}◼%f%%b'
zstyle ':prezto:module:git:info:keys' format \
'status' '$(coalesce "%b" "%p" "%c")%s%A%B%S%a%d%m%r%U%u'
# Define prompts.
PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} '
RPROMPT=''
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? '
}
function prompt_sorin_preview {
local +h PROMPT=''
local +h RPROMPT=''
local +h SPROMPT=''
editor-info 2>/dev/null
prompt_preview_theme 'sorin'
}
prompt_sorin_setup "$@"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.11764705926179886</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.11372549086809158</real>
<key>Red Component</key>
<real>0.10588235408067703</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.44705882668495178</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.14901961386203766</real>
<key>Red Component</key>
<real>0.97647058963775635</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.32941177487373352</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.89019608497619629</real>
<key>Red Component</key>
<real>0.7137255072593689</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.42352941632270813</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.92941176891326904</real>
<key>Red Component</key>
<real>0.99607843160629272</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.92941176891326904</real>
<key>Red Component</key>
<real>0.54901963472366333</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.99607843160629272</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.43529412150382996</real>
<key>Red Component</key>
<real>0.61960786581039429</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.63137257099151611</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.61176472902297974</real>
<key>Red Component</key>
<real>0.5372549295425415</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.94901961088180542</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.97254902124404907</real>
<key>Red Component</key>
<real>0.97254902124404907</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.078431375324726105</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.70588237047195435</real>
<key>Red Component</key>
<real>0.50980395078659058</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.12156862765550613</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.59215688705444336</real>
<key>Red Component</key>
<real>0.99215686321258545</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.83921569585800171</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.7607843279838562</real>
<key>Red Component</key>
<real>0.33725491166114807</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.99607843160629272</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.32941177487373352</real>
<key>Red Component</key>
<real>0.54901963472366333</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.34117648005485535</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.32941177487373352</real>
<key>Red Component</key>
<real>0.27450981736183167</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.7764706015586853</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.80000001192092896</real>
<key>Red Component</key>
<real>0.80000001192092896</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.32941177487373352</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.32549020648002625</real>
<key>Red Component</key>
<real>0.31372550129890442</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.58431375026702881</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.3490196168422699</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Background Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.090000003576278687</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.090000003576278687</real>
<key>Red Component</key>
<real>0.090000003576278687</real>
</dict>
<key>Badge Color</key>
<dict>
<key>Alpha Component</key>
<real>0.5</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Bold Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Cursor Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.12078898400068283</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.59354037046432495</real>
<key>Red Component</key>
<real>0.99016290903091431</real>
</dict>
<key>Cursor Guide Color</key>
<dict>
<key>Alpha Component</key>
<real>0.25</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.9100000262260437</real>
<key>Red Component</key>
<real>0.64999997615814209</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.0</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Foreground Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.62745100259780884</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.62745100259780884</real>
<key>Red Component</key>
<real>0.62745100259780884</real>
</dict>
<key>Link Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.67799997329711914</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.27000001072883606</real>
<key>Red Component</key>
<real>0.023000000044703484</real>
</dict>
<key>Selected Text Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>1</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>1</real>
<key>Red Component</key>
<real>1</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.30241936445236206</real>
<key>Color Space</key>
<string>Calibrated</string>
<key>Green Component</key>
<real>0.30241936445236206</real>
<key>Red Component</key>
<real>0.30241936445236206</real>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment