Skip to content

Commit

Permalink
Merge branch 'master' of github.com:robbyrussell/oh-my-zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
sjl committed Jul 21, 2010
2 parents 7ab8155 + 7c27985 commit 677c845
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 34 deletions.
24 changes: 10 additions & 14 deletions README.textile
Expand Up @@ -4,6 +4,8 @@ bq. "OH MY ZSHELL!"

h2. Setup

@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9.

h3. The automatic installer... (do you trust me?)

@wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
Expand All @@ -25,22 +27,19 @@ h3. The manual way

@chsh -s /bin/zsh@

4. Start / restart zsh (open a new terminal is easy enough..)
4. Start / restart zsh (open a new terminal is easy enough...)

h3. Problems?

You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to oh-my-zsh.
You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_.

h2. Usage

TODO: Update this..

* Rake autocomplete: @rake (tab)@. Will generate a cache of all your rake tasks and then let you auto-complete and/or select the task to run.
* ssh autocomplete: @ssh (tab)@ or @scp (tab)@
* Git branch, it'll tell you which branch you're in when you're in a git repository directory.
* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
** example: @plugins=(git osx ruby)@
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with Oh My Zsh.
* much much more..
** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers...

h2. Useful

Expand All @@ -49,6 +48,7 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
h3. Customization

If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin.

h3. Uninstalling

Expand All @@ -66,8 +66,4 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y

h3. Send us your theme!

I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.

h3. Todo from imajes:

* need to make the title bar support git folder
I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.
8 changes: 0 additions & 8 deletions lib/aliases.zsh
@@ -1,17 +1,9 @@
#!/bin/zsh

# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'

alias ss='thin --stats "/thin/stats" start'
alias devlog='tail -f log/development.log'

# Super user
alias _='sudo'

# Show history
alias history='fc -l 1'

# TextMate
alias et='mate . &'
2 changes: 0 additions & 2 deletions lib/completion.zsh
Expand Up @@ -25,8 +25,6 @@ zstyle ':completion:*' list-colors ''
bindkey -M menuselect '^o' accept-and-infer-next-history

zstyle ':completion:*:*:*:*:*' menu select
# zstyle ':completion:*:*:*:*:processes' force-list always

zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"

Expand Down
2 changes: 2 additions & 0 deletions lib/correction.zsh
Expand Up @@ -6,3 +6,5 @@ alias mysql='nocorrect mysql'
alias mkdir='nocorrect mkdir'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias ebuild='nocorrect ebuild'
alias hpodder='nocorrect hpodder'
10 changes: 0 additions & 10 deletions lib/functions.zsh
Expand Up @@ -44,13 +44,3 @@ function tab() {
end tell
EOF
}

function take() {
mkdir -p $1
cd $1
}

function tm() {
cd $1
mate $1
}
1 change: 1 addition & 0 deletions lib/history.zsh
Expand Up @@ -10,6 +10,7 @@ setopt hist_verify
setopt inc_append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_space

setopt SHARE_HISTORY
setopt APPEND_HISTORY
4 changes: 4 additions & 0 deletions oh-my-zsh.sh
Expand Up @@ -10,6 +10,10 @@ for config_file ($ZSH/lib/*.zsh) source $config_file
# Load all of your custom configurations from custom/
for config_file ($ZSH/custom/*.zsh) source $config_file

# Load all of the plugins that were defined in ~/.zshrc
plugin=${plugin:=()}
for plugin ($plugins) source $ZSH/plugins/$plugin.plugin.zsh

# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" = "true" ]
then
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions plugins/git.plugin.zsh
@@ -0,0 +1,32 @@
# Aliases
alias g='git'
alias gst='git status'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gd='git diff | mate'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'


# Git and svn mix
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'

#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}

# these aliases take advangate of the previous function
alias ggpull='git pull origin $(current_branch)'
alias ggpush='git push origin $(current_branch)'
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
16 changes: 16 additions & 0 deletions plugins/lighthouse.plugin.zsh
@@ -0,0 +1,16 @@
# To use: add a .lighthouse file into your directory with the URL to the
# individual project. For example:
# https://rails.lighthouseapp.com/projects/8994
# Example usage: http://screencast.com/t/ZDgwNDUwNT
open_lighthouse_ticket () {
if [ ! -f .lighthouse-url ]; then
echo "There is no .lighthouse file in the current directory..."
return 0;
else
lighthouse_url=$(cat .lighthouse-url);
echo "Opening ticket #$1";
`open $lighthouse_url/tickets/$1`;
fi
}

alias lho='open_lighthouse_ticket'
6 changes: 6 additions & 0 deletions plugins/mysql-macports.plugin.zsh
@@ -0,0 +1,6 @@
# commands to control local mysql-server installation
# paths are for osx installtion via macports

alias mysqlstart='sudo /opt/local/bin/mysqld_safe5'
alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
alias mysqlstatus='mysqladmin5 -u root -p ping'
11 changes: 11 additions & 0 deletions plugins/osx.plugin.zsh
@@ -0,0 +1,11 @@
function tab() {
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "cd \"$PWD\"; $*" in window 1
end tell
EOF
}
36 changes: 36 additions & 0 deletions plugins/rails.plugin.zsh
@@ -0,0 +1,36 @@

alias ss='thin --stats "/thin/stats" start'
alias sg='ruby script/generate'
alias sd='ruby script/destroy'
alias sp='ruby script/plugin'
alias ssp='ruby script/spec'
alias rdbm='rake db:migrate'
alias sc='ruby script/console'
alias sd='ruby script/server --debugger'
alias devlog='tail -f log/development.log'

function _cap_does_task_list_need_generating () {
if [ ! -f .cap_tasks~ ]; then return 0;
else
accurate=$(stat -f%m .cap_tasks~)
changed=$(stat -f%m config/deploy.rb)
return $(expr $accurate '>=' $changed)
fi
}

function _cap () {
if [ -f config/deploy.rb ]; then
if _cap_does_task_list_need_generating; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
> .cap_tasks~
fi
compadd `cat .cap_tasks~`
fi
}

compctl -K _cap cap

function remote_console() {
/usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
}
4 changes: 4 additions & 0 deletions plugins/ruby.plugin.zsh
@@ -0,0 +1,4 @@
alias sgem='sudo gem'

# Find ruby file
alias rfind='find . -name *.rb | xargs grep -n'
14 changes: 14 additions & 0 deletions plugins/textmate.plugin.zsh
@@ -0,0 +1,14 @@

# TextMate
alias et='mate . &'
alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'

# Editor Ruby file in TextMate
alias mr='mate CHANGELOG app config db lib public script spec test'

function tm() {
cd $1
mate $1
}
4 changes: 4 additions & 0 deletions templates/zshrc.zsh-template
Expand Up @@ -14,6 +14,10 @@ export ZSH_THEME="prose"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
19 changes: 19 additions & 0 deletions themes/eastwood.zsh-theme
@@ -0,0 +1,19 @@
#RVM settings
if [[ -s ~/.rvm/scripts/rvm ]] ; then
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
fi

ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
local cb=$(current_branch)
if [ -n "$cb" ]; then
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}

PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b '
27 changes: 27 additions & 0 deletions themes/takashiyoshida.zsh-theme
@@ -0,0 +1,27 @@
#
# PROMPT
#
PROMPT_BRACKET_BEGIN='%{$fg_bold[white]%}['
PROMPT_HOST='%{$fg_bold[cyan]%}%m'
PROMPT_SEPARATOR='%{$reset_color%}:'
PROMPT_DIR='%{$fg_bold[yellow]%}%c'
PROMPT_BRACKET_END='%{$fg_bold[white]%}]'

PROMPT_USER='%{$fg_bold[white]%}%n'
PROMPT_SIGN='%{$reset_color%}%#'

GIT_PROMPT_INFO='$(git_prompt_info)'

# My current prompt looks like:
# [host:current_dir] (git_prompt_info)
# [username]%
PROMPT="${PROMPT_BRACKET_BEGIN}${PROMPT_HOST}${PROMPT_SEPARATOR}${PROMPT_DIR}${PROMPT_BRACKET_END}${GIT_PROMPT_INFO}
${PROMPT_BRACKET_BEGIN}${PROMPT_USER}${PROMPT_BRACKET_END}${PROMPT_SIGN} "

#
# Git repository
#
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
ZSH_THEME_GIT_PROMPT_CLEAN=''
6 changes: 6 additions & 0 deletions tools/upgrade.sh
@@ -1,6 +1,12 @@
current_path=`pwd`
echo "Upgrading Oh My Zsh"
( cd $ZSH && git pull origin master )
echo ' __ __ '
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
echo ' /____/'
echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session."
echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh"
cd $current_path

0 comments on commit 677c845

Please sign in to comment.