Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
zsh
  • Loading branch information
jaz303 committed May 20, 2013
1 parent bd0fdea commit 61b0a2b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions etc/zprofile
@@ -0,0 +1 @@
# Login shells (2)
20 changes: 20 additions & 0 deletions etc/zshenv
@@ -0,0 +1,20 @@
# All shells (1)

#
# Paths

TRY_PATHS="
${HOME}/bin
${HOME}/.dotfiles/bin
/opt/local/bin
/opt/local/sbin
/opt/jruby/bin
/opt/scala/bin
/usr/local/mysql/bin
${HOME}/dev/tools/depot_tools
"

for try_path in $TRY_PATHS
do
test -d $try_path && export PATH=$PATH:$try_path
done
67 changes: 67 additions & 0 deletions etc/zshrc
@@ -0,0 +1,67 @@
# Interactive shells (3)

#
# Prompt

autoload -U colors
colors
setopt prompt_subst

# Modify the colors and symbols in these variables as desired.
GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
GIT_PROMPT_SUFFIX="]%{$reset_color%}"
GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡"
GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●"
GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●"
GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"

# Show Git branch/tag, or name-rev if on detached head
parse_git_branch() {
(git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
}

# Show different symbols as appropriate for various Git repository states
parse_git_state() {

# Compose this value via multiple conditional appends.
local GIT_STATE=""

local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then
GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING
fi

if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED
fi

if ! git diff --quiet 2> /dev/null; then
GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED
fi

if ! git diff --cached --quiet 2> /dev/null; then
GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED
fi

if [[ -n $GIT_STATE ]]; then
echo "$GIT_STATE "
fi

}

# If inside a Git repository, print its branch and state
git_prompt_string() {
local git_where="$(parse_git_branch)"
[ -n "$git_where" ] && echo "$(parse_git_state)$GIT_PROMPT_PREFIX${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX"
}

PS1="%(?,%{$fg_bold[green]%}-,%{$fg_bold[red]%}!)%{$reset_color%} %{$reset_color%} %{$fg_bold[green]%}%n@%m %{$fg_bold[blue]%}%1~ %#%{$reset_color%} "
RPS1='$(git_prompt_string) %{$fg_bold[yellow]%}#%h%{$reset_color%}'

#
# Aliases

alias ls='ls -G'
alias ll='ls -lh'
alias lll='ls -lah'
alias grep='grep --color=auto'

0 comments on commit 61b0a2b

Please sign in to comment.