Browse code

Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh

NanoTech authored on 01/10/2010 at 04:23:50
Showing 17 changed files
... ...
@@ -3,7 +3,6 @@ alias pu='pushd'
3 3
 alias po='popd'
4 4
 
5 5
 # Basic directory operations
6
-alias .='pwd'
7 6
 alias ...='cd ../..'
8 7
 alias -- -='cd -'
9 8
 
... ...
@@ -1,4 +1,4 @@
1
-## fixme - the load process here seems a bit bizarre
1
+# fixme - the load process here seems a bit bizarre
2 2
 
3 3
 unsetopt menu_complete   # do not autoselect the first completion entry
4 4
 unsetopt flowcontrol
... ...
@@ -30,6 +30,11 @@ zstyle ':completion:*:*:*:*:*' menu select
30 30
 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
31 31
 zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
32 32
 
33
+# disable named-directories autocompletion
34
+zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
35
+cdpath=(.)
36
+
37
+
33 38
 # Load known hosts file for auto-completion with ssh and scp commands
34 39
 if [ -f ~/.ssh/known_hosts ]; then
35 40
   zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
... ...
@@ -5,7 +5,7 @@ function title {
5 5
     print -nR $'\033k'$1$'\033'\\\
6 6
 
7 7
     print -nR $'\033]0;'$2$'\a'
8
-  elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
8
+  elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then
9 9
     # Use this one instead for XTerms:
10 10
     print -nR $'\033]0;'$*$'\a'
11 11
   fi
... ...
@@ -20,6 +20,7 @@ bindkey "^[[F"  end-of-line
20 20
 bindkey "^[[4~" end-of-line
21 21
 bindkey ' ' magic-space    # also do history expansion on space
22 22
 
23
+bindkey '^[[Z' reverse-menu-complete
23 24
 
24 25
 # consider emacs keybindings:
25 26
 
... ...
@@ -21,5 +21,3 @@ then
21 21
 else
22 22
   /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
23 23
 fi
24
-
25
-unset config_file
26 24
\ No newline at end of file
... ...
@@ -1,6 +1,6 @@
1 1
 #compdef brew
2 2
 
3
-# copied from _fink
3
+# imported from the latest homebrew contributions
4 4
 
5 5
 _brew_all_formulae() {
6 6
   formulae=(`brew search`)
... ...
@@ -12,19 +12,25 @@ _brew_installed_formulae() {
12 12
 
13 13
 local -a _1st_arguments
14 14
 _1st_arguments=(
15
+  'cat:display formula file for a formula'
16
+  'cleanup:uninstall unused and old versions of packages'
17
+  'create:create a new formula'
18
+  'deps:list dependencies and dependants of a formula'
19
+  'doctor:audits your installation for common issues'
20
+  'edit:edit a formula'
21
+  'home:visit the homepage of a formula or the brew project'
22
+  'info:information about a formula'
15 23
   'install:install a formula'
24
+  'link:link a formula'
25
+  'list:list files in a formula or not-installed formulae'
26
+  'log:git commit log for a formula'
27
+  'outdated:list formulas for which a newer version is available'
28
+  'prune:remove dead links'
16 29
   'remove:remove a formula'
17 30
   'search:search for a formula (/regex/ or string)'
18
-  'list:list files in a formula or not-installed formulae'
19
-  'link:link a formula'
20 31
   'unlink:unlink a formula'
21
-  'home:visit the homepage of a formula or the brew project'
22
-  'info:information about a formula'
23
-  'prune:remove dead links'
24 32
   'update:freshen up links'
25
-  'log:git commit log for a formula'
26
-  'create:create a new formula'
27
-  'edit:edit a formula'
33
+  'uses:show formulas which depend on a formula'
28 34
 )
29 35
 
30 36
 local expl
... ...
@@ -47,12 +53,12 @@ case "$words[1]" in
47 47
     _arguments \
48 48
       '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
49 49
       '1: :->forms' &&  return 0
50
-      
50
+
51 51
       if [[ "$state" == forms ]]; then
52 52
         _brew_installed_formulae
53 53
         _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
54 54
       fi ;;
55
-  install|home|log|info)
55
+  install|home|log|info|uses|cat|deps)
56 56
     _brew_all_formulae
57 57
     _wanted formulae expl 'all formulae' compadd -a formulae ;;
58 58
   remove|edit|xo)
59 59
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+#!/bin/zsh
1
+# 
2
+# Make the dirstack more persistant
3
+# 
4
+# Add dirpersist to $plugins in ~/.zshrc to load
5
+# 
6
+
7
+# $zdirstore is the file used to persist the stack
8
+zdirstore=~/.zdirstore
9
+
10
+dirpersistinstall () {
11
+    if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
12
+    else
13
+        if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
14
+            echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
15
+        else
16
+            echo "If you don't want this message to appear, remove dirspersist from \$plugins"
17
+        fi
18
+    fi
19
+}
20
+
21
+dirpersiststore () {
22
+    dirs -p | perl -e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore
23
+}
24
+
25
+dirpersistrestore () {
26
+    if [ -f $zdirstore ]; then
27
+        source $zdirstore
28
+    fi
29
+}
30
+
31
+DIRSTACKSIZE=10
32
+setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
33
+
34
+dirpersistinstall
35
+dirpersistrestore
36
+
37
+# Make popd changes permanent without having to wait for logout
38
+alias popd="popd;dirpersiststore"
0 39
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+#Aliases
1
+alias pc="sudo port clean --all installed"
2
+alias pi="sudo port install $1"
3
+alias psu="sudo port selfupdate"
4
+alias puni="sudo port uninstall inactive"
5
+alias puo="sudo port upgrade outdated"
6
+alias pup="psu && puo"
0 7
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+# Based on code from Joseph M. Reagle
1
+# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
2
+
3
+local SSH_ENV=$HOME/.ssh/environment
4
+
5
+function start_agent {
6
+  /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
7
+  chmod 600 ${SSH_ENV}
8
+  . ${SSH_ENV} > /dev/null
9
+  /usr/bin/ssh-add;
10
+}
11
+
12
+# Source SSH settings, if applicable
13
+
14
+if [ -f "${SSH_ENV}" ]; then
15
+  . ${SSH_ENV} > /dev/null
16
+  ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
17
+    start_agent;
18
+  }
19
+else
20
+  start_agent;
21
+fi
22
+
0 23
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+function zle-line-init zle-keymap-select {
1
+  zle reset-prompt
2
+}
3
+
4
+zle -N zle-line-init
5
+zle -N zle-keymap-select
6
+
7
+bindkey -v
8
+
9
+# if mode indicator wasn't setup by theme, define default
10
+if [[ "$MODE_INDICATOR" == "" ]]; then
11
+  MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
12
+fi
13
+
14
+function vi_mode_prompt_info() {
15
+  echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
16
+}
17
+
18
+# define right prompt, if it wasn't defined by a theme
19
+if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then
20
+  RPS1='$(vi_mode_prompt_info)'
21
+fi
0 22
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
1
+%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
2
+
3
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
4
+ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
6
+ZSH_THEME_GIT_PROMPT_CLEAN=""
0 7
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+# Copied from old version of tonotdo's theme. LSCOLORS modified.
1
+PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» '
2
+RPROMPT='[%*]'
3
+
4
+# git theming
5
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}"
6
+ZSH_THEME_GIT_PROMPT_SUFFIX=""
7
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})"
8
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})"
9
+
10
+export LSCOLORS="exfxcxdxbxegedabagacad"
11
+export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
0 12
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+grey='\e[0;90m'
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
3
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
4
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
6
+
7
+function josh_prompt {
8
+  (( spare_width = ${COLUMNS} ))
9
+  prompt=" "
10
+
11
+  branch=$(current_branch)
12
+  ruby_version=$(rvm_prompt_info)
13
+  path_size=${#PWD}
14
+  branch_size=${#branch}
15
+  ruby_size=${#ruby_version}
16
+  user_machine_size=${#${(%):-%n@%m-}}
17
+  
18
+  if [[ ${#branch} -eq 0 ]]
19
+    then (( ruby_size = ruby_size + 1 ))
20
+  else
21
+    (( branch_size = branch_size + 4 ))
22
+    if [[ -n $(git status -s 2> /dev/null) ]]; then
23
+      (( branch_size = branch_size + 2 ))
24
+    fi
25
+  fi
26
+  
27
+  (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
28
+
29
+  while [ ${#prompt} -lt $spare_width ]; do
30
+    prompt=" $prompt"
31
+  done
32
+  
33
+  prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
34
+  
35
+  echo $prompt
36
+}
37
+
38
+setopt prompt_subst
39
+
40
+PROMPT='
41
+%n@%m $(josh_prompt)
42
+%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '
0 43
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
1
+
2
+PROMPT='%{$fg[green]%}%c \
3
+$(git_prompt_info)\
4
+%{$fg[red]%}%(!.#.»)%{$reset_color%} '
5
+PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
6
+RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} '
7
+
8
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}("
9
+ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} "
10
+ZSH_THEME_GIT_PROMPT_CLEAN=""
11
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}"
12
+
0 13
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+PROMPT='%{$fg_bold[red]%}%m%{$reset_color%}:%{$fg[cyan]%}%c%{$reset_color%}:%# '
1
+RPROMPT='%{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}% '
2
+
3
+ZSH_THEME_GIT_PROMPT_PREFIX="<%{$fg[red]%}"
4
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
5
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$fg[green]%}>%{$reset_color%}"
6
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}>"
0 7
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+# Comment 
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX=' (git:'
3
+ZSH_THEME_GIT_PROMPT_SUFFIX=')'
4
+
5
+PROMPT='%{$fg[magenta]%}[%c]$(git_prompt_info) $ %{$reset_color%}'
0 6
\ No newline at end of file
... ...
@@ -22,7 +22,7 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you."
22 22
 echo "export PATH=$PATH" >> ~/.zshrc
23 23
 
24 24
 echo "Time to change your default shell to zsh!"
25
-chsh -s /bin/zsh
25
+chsh -s "/usr/bin/env zsh"
26 26
 
27 27
 echo '         __                                     __  '
28 28
 echo '  ____  / /_     ____ ___  __  __   ____  _____/ /_ '
... ...
@@ -32,5 +32,5 @@ echo '\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  '
32 32
 echo '                        /____/'
33 33
 
34 34
 echo "\n\n ....is now installed."
35
-/bin/zsh
35
+/usr/bin/env zsh
36 36
 source ~/.zshrc