Commit 6cddf720 authored by Andrew Janke's avatar Andrew Janke
Browse files

Merge branch 'master' into installer-portable-colors

parents 82c76f6b cbc1a080
# Based on evan's prompt # Based on evan's prompt
# Shows the exit status of the last command if non-zero # Shows the exit status of the last command if non-zero
# Uses "#" instead of "»" when running with elevated privileges # Uses "#" instead of "»" when running with elevated privileges
PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . ${fg[red]}%? )%{${fg[blue]}%}»%{${reset_color}%} " PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . %{${fg[red]}%}%? )%{${fg[blue]}%}»%{${reset_color}%} "
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' %{$fg[red]%}%!%{$reset_color%} $(prompt_char) '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}"
......
#!/usr/bin/env zsh
# ------------------------------------------------------------------------------
# FILE: emotty.zsh-theme
# DESCRIPTION: A varying emoji based theme
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# DEPENDS: emotty plugin
# RECOMMENDS: Hasklig font
#
# This theme shows a different emoji for each tty at the main prompt.
#
# There are pre-defined different emoji sets to choose from, e.g.:
# emoji, stellar, floral, zodiac, love (see emotty plugin).
#
# To choose a different emotty set than the default (emoji)
# % export emotty_set=nature
#
# For the superuser (root) this theme shows a designated indicator
# and switches the foreground color to red
# (see root_prompt variable, default: skull).
# But you are using sudo (8) instead of designated a root shell, right‽
#
# When logged in via SSH the main prompt also shows the user- and hostname.
#
# The exit status of the last failed command is displayed in the window title
# along with an indicator (see warn_glyph variable, default: collision symbol).
# To clear it just run: $NULL, true or :
#
# The right prompt shows the current working directory (3 levels up) in cyan.
#
# When in a git repository the main prompt shows the current branch name
# with a branch indicator in yellow
# (see vcs_branch_glyph variable, default: Hasklig branch glyph).
#
# If there are modified files the prompt switches to red and shows an unstaged
# indicator (see vcs_unstaged_glyph variable, default: circled letter M).
#
# If there are staged files the prompt switches to green and shows an staged
# indicator (see vcs_staged_glyph variable, default: high voltage sign).
#
# In a git repository the right prompt shows the repository name in bold and
# prepends the current working directory subpath within the repository.
#
# When git currently performs an action such as merge or rebase, the action is
# displayed in red instead of the branch name and a special action indicator
# is shown (see vcs_action_glyph variable, default: chevron).
# ------------------------------------------------------------------------------
user_prompt="$(emotty)"
root_prompt="$emoji[skull]"
warn_prompt="$emoji[collision_symbol]"
vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}"
vcs_staged_glyph="%{$emoji[high_voltage_sign] %1G%}"
vcs_branch_glyph=$(print -P $'\Ue0a0') # 
vcs_action_glyph=$(print -P $'\U276f') # ❯
red="$FG[001]"
yellow="$FG[003]"
green="$FG[002]"
cyan="$FG[014]"
prompt_glyph="%{%(#.${root_prompt}.${user_prompt})%1G%}"
# Uncomment the next line if you also like to see the warn_prompt in the prompt on the right.
#last_command_failed="%(?.. %F{red}%1{${warn_prompt} %1G%}%?%f)"
setopt promptsubst
autoload -U add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git #hg svn cvs
zstyle ':vcs_info:*' get-revision false
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git:*' unstagedstr "${red}${vcs_unstaged_glyph}"
zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}"
# %(K|F){color} set (back|fore)ground color
# %(k|f) reset (back|fore)ground color
zstyle ':vcs_info:*' max-exports 3
zstyle ':vcs_info:*' nvcsformats "${prompt_glyph} " '%3~' ''
zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]"
red_if_root="%(!.%F{red}.)"
sshuser_on_host="${SSH_TTY:+%(!.$red.$yellow)%n@%m$reset_color}"
PROMPT='${sshuser_on_host}${vcs_info_msg_0_}${red_if_root} '
RPROMPT='${cyan}${vcs_info_msg_1_##.|}${vcs_info_msg_2_}%f${last_command_failed}'
emotty_title() {
title "${${?/[^0]*/$warn_prompt $?}/0/${prompt_glyph}}"
}
add-zsh-hook precmd emotty_title
add-zsh-hook precmd vcs_info
# vim:ft=zsh ts=2 sw=2 sts=2
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png # ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
# Based on bira theme # Based on bira theme
# load some modules
autoload -U zsh/terminfo # Used in the colour alias below
setopt prompt_subst setopt prompt_subst
# make some aliases for the colours: (could use normal escape sequences too) () {
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}' local PR_USER PR_USER_OP PR_PROMPT PR_HOST
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Check the UID # Check the UID
if [[ $UID -ne 0 ]]; then # normal user if [[ $UID -ne 0 ]]; then # normal user
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}' PR_USER='%F{green}%n%f'
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}' PR_USER_OP='%F{green}%#%f'
local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR' PR_PROMPT='%f➤ %f'
else # root else # root
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}' PR_USER='%F{red}%n%f'
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}' PR_USER_OP='%F{red}%#%f'
local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR' PR_PROMPT='%F{red}➤ %f'
fi fi
# Check if we are on SSH or not # Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH PR_HOST='%F{red}%M%f' # SSH
else else
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH PR_HOST='%F{green}%M%f' # no SSH
fi fi
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}' local return_code="%(?..%F{red}%? ↵%f)"
local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%~%f%b"
local rvm_ruby='' local rvm_ruby=''
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect local user rvm installation if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
rvm_ruby='%{$PR_RED%}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%{$PR_NO_COLOR%}' rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
elif which rvm-prompt &> /dev/null; then # detect sysem-wide rvm installation elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
elif which rbenv &> /dev/null; then # detect Simple Ruby Version management elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}' rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
fi fi
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}' local git_branch='$(git_prompt_info)'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─$PR_PROMPT " ╰─$PR_PROMPT "
RPS1="${return_code}" RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹" }
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
...@@ -59,16 +59,17 @@ ZSH_THEME_GIT_PROMPT_PREFIX="" ...@@ -59,16 +59,17 @@ ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="" ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" ZSH_THEME_GIT_PROMPT_UNTRACKED="$blue%%"
ZSH_THEME_GIT_PROMPT_MODIFIED="*" ZSH_THEME_GIT_PROMPT_MODIFIED="$red*"
ZSH_THEME_GIT_PROMPT_ADDED="+" ZSH_THEME_GIT_PROMPT_ADDED="$green+"
ZSH_THEME_GIT_PROMPT_STASHED="$" ZSH_THEME_GIT_PROMPT_STASHED="$blue$"
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="=" ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="$green="
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">" ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<" ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>" ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)' PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
PROMPT+='$(__git_ps1)' GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
PROMPT+="$GIT_PROMPT"
PROMPT+=" $last_command_output%#$reset " PROMPT+=" $last_command_output%#$reset "
RPROMPT='' RPROMPT=''
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
export VIRTUAL_ENV_DISABLE_PROMPT=1 export VIRTUAL_ENV_DISABLE_PROMPT=1
function virtualenv_info { function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('$fg[blue]`basename $VIRTUAL_ENV`%{$reset_color%}') ' [ $VIRTUAL_ENV ] && echo '('%F{blue}`basename $VIRTUAL_ENV`%f') '
} }
PR_GIT_UPDATE=1 PR_GIT_UPDATE=1
...@@ -20,18 +20,18 @@ autoload -U add-zsh-hook ...@@ -20,18 +20,18 @@ autoload -U add-zsh-hook
autoload -Uz vcs_info autoload -Uz vcs_info
#use extended color pallete if available #use extended color pallete if available
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then if [[ $terminfo[colors] -ge 256 ]]; then
turquoise="%F{81}" turquoise="%F{81}"
orange="%F{166}" orange="%F{166}"
purple="%F{135}" purple="%F{135}"
hotpink="%F{161}" hotpink="%F{161}"
limegreen="%F{118}" limegreen="%F{118}"
else else
turquoise="$fg[cyan]" turquoise="%F{cyan}"
orange="$fg[yellow]" orange="%F{yellow}"
purple="$fg[magenta]" purple="%F{magenta}"
hotpink="$fg[red]" hotpink="%F{red}"
limegreen="$fg[green]" limegreen="%F{green}"
fi fi
# enable VCS systems you use # enable VCS systems you use
...@@ -48,7 +48,7 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true ...@@ -48,7 +48,7 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true
# %a - action (e.g. rebase-i) # %a - action (e.g. rebase-i)
# %R - repository path # %R - repository path
# %S - path in the repository # %S - path in the repository
PR_RST="%{${reset_color}%}" PR_RST="%f"
FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})"
FMT_ACTION="(%{$limegreen%}%a${PR_RST})" FMT_ACTION="(%{$limegreen%}%a${PR_RST})"
FMT_UNSTAGED="%{$orange%}●" FMT_UNSTAGED="%{$orange%}●"
...@@ -96,5 +96,5 @@ function steeef_precmd { ...@@ -96,5 +96,5 @@ function steeef_precmd {
add-zsh-hook precmd steeef_precmd add-zsh-hook precmd steeef_precmd
PROMPT=$' PROMPT=$'
%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_$(virtualenv_info)%{$reset_color%} %{$purple%}%n${PR_RST} at %{$orange%}%m${PR_RST} in %{$limegreen%}%~${PR_RST} $vcs_info_msg_0_$(virtualenv_info)
$ ' $ '
...@@ -20,7 +20,7 @@ else ...@@ -20,7 +20,7 @@ else
fi fi
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
echo "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!" printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
exit exit
fi fi
unset CHECK_ZSH_INSTALLED unset CHECK_ZSH_INSTALLED
...@@ -35,6 +35,13 @@ if [ -d "$ZSH" ]; then ...@@ -35,6 +35,13 @@ if [ -d "$ZSH" ]; then
exit exit
fi fi
# Prevent the cloned repository from having insecure permissions. Failing to do
# so causes compinit() calls to fail with "command not found: compdef" errors
# for users with insecure umasks (e.g., "002", allowing group writability). Note
# that this will be ignored under Cygwin by default, as Windows ACLs take
# precedence over umasks except for filesystems mounted with option "noacl".
umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
printf "git not installed\n" printf "git not installed\n"
...@@ -60,12 +67,17 @@ export PATH=\"$PATH\" ...@@ -60,12 +67,17 @@ export PATH=\"$PATH\"
" ~/.zshrc > ~/.zshrc-omztemp " ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f ~/.zshrc-omztemp ~/.zshrc
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') # If this user's login shell is not already "zsh", attempt to switch.
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then
# If this platform provides a "chsh" command (not Cygwin), do it, man!
if hash chsh >/dev/null 2>&1; then
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
chsh -s $(grep /zsh$ /etc/shells | tail -1) chsh -s $(grep /zsh$ /etc/shells | tail -1)
# Else, suggest the user do so manually.
else
printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
fi
fi fi
unset TEST_CURRENT_SHELL
printf "${GREEN}" printf "${GREEN}"
echo ' __ __ ' echo ' __ __ '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment