Browse code

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

Claus Witt authored on 14/01/2011 at 15:53:42
Showing 21 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 locals.zsh
2 2
 log/.zsh_history
3 3
 projects.zsh
4
-custom/*.zsh
4
+custom/*
5 5
 !custom/example.zsh
6 6
\ No newline at end of file
... ...
@@ -36,5 +36,9 @@ cd () {
36 36
 
37 37
 alias md='mkdir -p'
38 38
 alias rd=rmdir
39
+alias d='dirs -v'
39 40
 
40
-alias d='dirs -v'
41 41
\ No newline at end of file
42
+# mkdir & cd to it
43
+function mcd() { 
44
+  mkdir -p "$1" && cd "$1"; 
45
+}
42 46
\ No newline at end of file
... ...
@@ -1,4 +1,4 @@
1
-# add brew completion function to path
1
+# add gem completion function to path
2 2
 fpath=($ZSH/plugins/gem $fpath)
3 3
 autoload -U compinit
4 4
 compinit -i
... ...
@@ -8,6 +8,7 @@ alias gd='git diff | mate'
8 8
 alias gdv='git diff -w "$@" | vim -R -'
9 9
 alias gc='git commit -v'
10 10
 alias gca='git commit -v -a'
11
+alias gco='git checkout'
11 12
 alias gb='git branch'
12 13
 alias gba='git branch -a'
13 14
 alias gcount='git shortlog -sn'
... ...
@@ -26,7 +27,7 @@ function current_branch() {
26 26
   echo ${ref#refs/heads/}
27 27
 }
28 28
 
29
-# these aliases take advangate of the previous function
29
+# these aliases take advantage of the previous function
30 30
 alias ggpull='git pull origin $(current_branch)'
31 31
 alias ggpush='git push origin $(current_branch)'
32
-alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
33 32
\ No newline at end of file
33
+alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
34 34
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+alias rs='ruby script/rails server'
1
+alias rg='ruby script/rails generate'
2
+alias rd='ruby script/rails destroy'
3
+alias rp='ruby script/rails plugin'
4
+alias rdbm='rake db:migrate db:test:clone'
5
+alias rc='ruby script/rails console'
6
+alias rd='ruby script/rais server --debugger'
7
+alias devlog='tail -f log/development.log'
0 8
new file mode 100644
... ...
@@ -0,0 +1,42 @@
0
+function svn_prompt_info {
1
+    if [[ -d .svn ]]; then
2
+        echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
3
+$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
4
+    fi
5
+}
6
+
7
+
8
+function in_svn() {
9
+    if [[ -d .svn ]]; then
10
+        echo 1
11
+    fi
12
+}
13
+
14
+function svn_get_repo_name {
15
+    if [ is_svn ]; then
16
+        svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
17
+    
18
+        svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
19
+    fi
20
+}
21
+
22
+function svn_get_rev_nr {
23
+    if [ is_svn ]; then
24
+        svn info 2> /dev/null | sed -n s/Revision:\ //p
25
+    fi
26
+}
27
+
28
+function svn_dirty_choose {
29
+    if [ is_svn ]; then
30
+        s=$(svn status 2>/dev/null)
31
+        if [ $s ]; then 
32
+            echo $1
33
+        else 
34
+            echo $2
35
+        fi
36
+    fi
37
+}
38
+
39
+function svn_dirty {
40
+    svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN
41
+}
0 42
\ No newline at end of file
... ...
@@ -1,4 +1,4 @@
1
-if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
1
+if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
2 2
 
3 3
 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
1
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
2 2
 
3 3
 PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
4 4
 RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
5 5
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+# the svn plugin has to be activated for this to work.
1
+
2
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
5
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
6
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}"
7
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) "
8
+
9
+
10
+
11
+ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}"
12
+ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}"
13
+
14
+ZSH_THEME_SVN_PROMPT_PREFIX="svn:("
15
+ZSH_THEME_SVN_PROMPT_SUFFIX=")"
16
+ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}"
17
+ZSH_THEME_SVN_PROMPT_CLEAN=" "
0 18
\ No newline at end of file
... ...
@@ -1,4 +1,4 @@
1
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi
1
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi
2 2
 
3 3
 PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
4 4
 RPROMPT='[%*]'
5 5
new file mode 100644
... ...
@@ -0,0 +1,56 @@
0
+# the idea of this theme is to contain a lot of info in a small string, by
1
+# compressing some parts and colorcoding, which bring useful visual cues,
2
+# while limiting the amount of colors and such to keep it easy on the eyes.
3
+# When a command exited >0, the timestamp will be in red and the exit code
4
+# will be on the right edge.
5
+# The exit code visual cues will only display once.
6
+# (i.e. they will be reset, even if you hit enter a few times on empty command prompts)
7
+
8
+typeset -A host_repr
9
+
10
+# translate hostnames into shortened, colorcoded strings
11
+host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4")
12
+
13
+# local time, color coded by last return code
14
+time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
15
+time_disabled="%{$fg[green]%}%*%{$reset_color%}"
16
+time=$time_enabled
17
+
18
+# user part, color coded by privileges
19
+local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
20
+
21
+# Hostname part.  compressed and colorcoded per host_repr array
22
+# if not found, regular hostname in default color
23
+local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
24
+
25
+# Compacted $PWD
26
+local pwd="%{$fg[blue]%}%c%{$reset_color%}"
27
+
28
+PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)'
29
+
30
+# i would prefer 1 icon that shows the "most drastic" deviation from HEAD,
31
+# but lets see how this works out
32
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
33
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
34
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}"
35
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
36
+
37
+# elaborate exitcode on the right when >0
38
+return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
39
+return_code_disabled=
40
+return_code=$return_code_enabled
41
+
42
+RPS1='${return_code}'
43
+
44
+function accept-line-or-clear-warning () {
45
+	if [[ -z $BUFFER ]]; then
46
+		time=$time_disabled
47
+		return_code=$return_code_disabled
48
+	else
49
+		time=$time_enabled
50
+		return_code=$return_code_enabled
51
+	fi
52
+	zle accept-line
53
+}
54
+zle -N accept-line-or-clear-warning
55
+bindkey '^M' accept-line-or-clear-warning
... ...
@@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
5 5
 ZSH_THEME_GIT_PROMPT_CLEAN=""
6 6
 
7 7
 function prompt_char {
8
-	if [ "$(whoami)" = "root" ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
8
+	if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
9 9
 }
10 10
 
11 11
 PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
12 12
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+# ZSH Theme emulating the Fish shell's default prompt.
1
+
2
+local user_color='green'; [ $UID -eq 0 ] && user_color='red'
3
+PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
4
+PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
5
+RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)'
6
+
7
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}"
8
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
0 9
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+if [ "$(whoami)" = "root" ]
1
+then CARETCOLOR="red"
2
+else CARETCOLOR="blue"
3
+fi
4
+
5
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
6
+
7
+PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} '
8
+
9
+RPS1='$(vi_mode_prompt_info) ${return_code}'
10
+
11
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}‹"
12
+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
13
+
14
+MODE_INDICATOR="%{$fg_bold[magenta]%}<%{$reset_color%}%{$fg[magenta]%}<<%{$reset_color%}"
15
+
16
+# TODO use 265 colors
17
+#MODE_INDICATOR="$FX[bold]$FG[020]<$FX[no_bold]%{$fg[blue]%}<<%{$reset_color%}"
18
+# TODO use two lines if git
0 19
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} '
1
+
2
+ZSH_THEME_GIT_PROMPT_PREFIX="("
3
+ZSH_THEME_GIT_PROMPT_SUFFIX=") "
... ...
@@ -1,6 +1,6 @@
1 1
 # ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
2 2
 
3
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
3
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
4 4
 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
5 5
 
6 6
 PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
7 7
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+# Simple theme based on my old zsh settings.
1
+
2
+function get_host {
3
+	echo '@'`hostname`''
4
+}
5
+
6
+PROMPT='> '
7
+RPROMPT='%~$(git_prompt_info)$(get_host)'
8
+
9
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}"
10
+ZSH_THEME_GIT_PROMPT_PREFIX="("
11
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
0 12
\ No newline at end of file
1 13
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S
1
+
2
+PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}'
3
+
4
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
5
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
... ...
@@ -1,4 +1,4 @@
1
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
1
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
2 2
 
3 3
 PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
4 4
 RPROMPT='[%*]'
... ...
@@ -1,4 +1,4 @@
1
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
1
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
2 2
 
3 3
 PROMPT='
4 4
 %{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%}
5 5
new file mode 100644
... ...
@@ -0,0 +1,24 @@
0
+# /|/ Code by Stephen
1
+# /|/ "Rixius" Middleton
2
+# 
3
+# name in folder (github)
4
+# ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right.
5
+function collapse_pwd {
6
+    echo $(pwd | sed -e "s,^$HOME,~,")
7
+}
8
+function prompt_char {
9
+    echo -n "%{$bg[white]%}%{$fg[red]%}"
10
+    git branch >/dev/null 2>/dev/null && echo "±%{$reset_color%}" && return
11
+    echo "≥%{$reset_color%}"
12
+}
13
+RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}"
14
+
15
+PROMPT='
16
+%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info)
17
+$(prompt_char) '
18
+RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}'
19
+
20
+ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
21
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
22
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}"
23
+ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}"