Browse code

Importing initial files after reorganizing stuff.

Robby Russell authored on 28/08/2009 at 18:14:17
Showing 12 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,8 @@
0
+h2. Setup
1
+
2
+# Clone the repository to ~/zsh
3
+# Symlink the zsh config with: @ln -s ~/zsh/zshrc .zshrc@
4
+# Reload zsh (open a new terminal)
5
+
6
+
7
+
0 8
new file mode 100644
... ...
@@ -0,0 +1,44 @@
0
+alias c='cd'
1
+alias pu='pushd'
2
+alias po='popd'
3
+alias sc='ruby script/console'
4
+alias ss='ruby script/server'
5
+
6
+alias mr='mate CHANGELOG app config db lib public script spec test'
7
+alias .='pwd'
8
+alias ...='cd ../..'
9
+alias ....='cd ../../..'
10
+alias .....='cd ../../../..'
11
+alias ......='cd ../../../../..'
12
+alias .......='cd ../../../../../..'
13
+
14
+alias _='sudo'
15
+alias ss='setsid'
16
+
17
+alias g='grep -in'
18
+
19
+alias s='svn'
20
+alias e='mate'
21
+
22
+alias history='fc -l 1'
23
+
24
+# Git aliases
25
+
26
+alias utb='tar jxvf'
27
+alias utz='tar zxvf'
28
+
29
+alias ls='ls -GF'
30
+alias ll='ls -al'
31
+
32
+alias sgem='sudo gem'
33
+
34
+alias rfind='find . -name *.rb | xargs grep -n'
35
+
36
+alias xenon='ssh rrussell@xenon.planetargon.com'
37
+
38
+alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
39
+
40
+bindkey '\ew' kill-region
41
+
42
+bindkey -s '\el' "ls\n"
43
+bindkey -s '\e.' "..\n"
0 44
\ No newline at end of file
1 45
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+autoload colors; colors;
1
+
2
+unset LSCOLORS
3
+export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
0 4
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+setopt noautomenu
1
+setopt COMPLETE_IN_WORD
2
+setopt ALWAYS_TO_END
3
+
4
+unsetopt flowcontrol
5
+
6
+WORDCHARS=''
7
+
8
+autoload -U compinit
9
+compinit
10
+
11
+zmodload -i zsh/complist
12
+
13
+zstyle ':completion:*' list-colors ''
14
+zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
15
+
16
+unsetopt MENU_COMPLETE
17
+setopt AUTO_MENU
18
+
19
+bindkey -M menuselect '^o' accept-and-infer-next-history
20
+
21
+zstyle ':completion:*:*:*:*:*' menu yes select
22
+# zstyle ':completion:*:*:*:*:processes' force-list always
23
+
24
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
25
+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
26
+zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
0 27
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+function title {
1
+  if [[ $TERM == "screen" ]]; then
2
+    # Use these two for GNU Screen:
3
+    print -nR $'\033k'$1$'\033'\\\
4
+
5
+    print -nR $'\033]0;'$2$'\a'
6
+  elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
7
+    # Use this one instead for XTerms:
8
+    print -nR $'\033]0;'$*$'\a'
9
+  fi
10
+}
11
+
12
+function precmd {
13
+  title zsh "$PWD"
14
+}
15
+
16
+function preexec {
17
+  emulate -L zsh
18
+  local -a cmd; cmd=(${(z)1})
19
+  title $cmd[1]:t "$cmd[2,-1]"
20
+}
21
+
22
+
23
+function remote_console() {
24
+  /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
25
+}
0 26
\ No newline at end of file
1 27
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+# get the name of the branch we are on
1
+function git_prompt_info() {
2
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
3
+  branch=${ref#refs/heads/}
4
+
5
+  if [[ -d .git ]]; then
6
+    CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
7
+  else
8
+    CURRENT_BRANCH=''
9
+  fi
10
+
11
+
12
+  #echo "%{$fg[red]%}git:(%{$fg[green]$CURRENT_BRANCH%{$fg[red])"
13
+  echo $CURRENT_BRANCH
14
+}
15
+
16
+parse_git_dirty () {
17
+  [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ "
18
+}
0 19
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+#
1
+# Color grep results
2
+# Examples: http://rubyurl.com/ZXv
3
+#
4
+export GREP_OPTIONS='--color=auto'
5
+export GREP_COLOR='1;32'
0 6
\ No newline at end of file
1 7
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+# History stuff.
1
+setopt HIST_VERIFY
2
+setopt INC_APPEND_HISTORY
3
+setopt SHARE_HISTORY
4
+setopt EXTENDED_HISTORY
5
+setopt HIST_IGNORE_DUPS
6
+
7
+## Command history configuration
8
+#
9
+HISTFILE=$ZSH/log/.zsh_history
10
+HISTSIZE=2500
11
+SAVEHIST=2500
12
+setopt hist_ignore_dups # ignore duplication command history list
13
+setopt share_history # share command history data
14
+
0 15
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+# Add yourself some shortcuts to projects you often work on
1
+# Example:
2
+#
3
+# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
4
+#
0 5
\ No newline at end of file
1 6
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+bindkey -e
1
+
2
+# Directory stuff.
3
+setopt AUTO_NAME_DIRS
4
+
5
+# Speed stuff.
6
+
7
+#setopt NO_BEEP
8
+setopt AUTO_CD
9
+setopt MULTIOS
10
+setopt CDABLEVARS
11
+
12
+bindkey -e
13
+
14
+if [[ x$WINDOW != x ]]
15
+then
16
+    SCREEN_NO="%B$WINDOW%b "
17
+else
18
+    SCREEN_NO=""
19
+fi
20
+
21
+PS1="%n@%m:%~%# "
22
+
23
+# Setup the prompt with pretty colors
24
+setopt prompt_subst
25
+
26
+export LSCOLORS="Gxfxcxdxbxegedabagacad"
27
+
28
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
0 29
new file mode 100644
... ...
@@ -0,0 +1,42 @@
0
+_rake_does_task_list_need_generating () {
1
+  if [ ! -f .rake_tasks ]; then return 0;
2
+  else
3
+    accurate=$(stat -f%m .rake_tasks)
4
+    changed=$(stat -f%m Rakefile)
5
+    return $(expr $accurate '>=' $changed)
6
+  fi
7
+}
8
+
9
+_rake () {
10
+  if [ -f Rakefile ]; then
11
+    if _rake_does_task_list_need_generating; then
12
+      echo "\nGenerating .rake_tasks..." > /dev/stderr
13
+      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
14
+    fi
15
+    compadd `cat .rake_tasks`
16
+  fi
17
+}
18
+
19
+compdef _rake rake
20
+
21
+function _cap_does_task_list_need_generating () {
22
+  if [ ! -f .cap_tasks ]; then return 0;
23
+  else
24
+    accurate=$(stat -f%m .cap_tasks)
25
+    changed=$(stat -f%m config/deploy.rb)
26
+    return $(expr $accurate '>=' $changed)
27
+  fi
28
+}
29
+
30
+function _cap () {
31
+  if [ -f config/deploy.rb ]; then
32
+    if _cap_does_task_list_need_generating; then
33
+      echo "\nGenerating .cap_tasks..." > /dev/stderr
34
+      cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
35
+> .cap_tasks
36
+    fi
37
+    compadd `cat .cap_tasks`
38
+  fi
39
+}
40
+
41
+compdef _cap cap
0 42
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+export EDITOR=/opt/local/bin/joe
1
+export PAGER=less
2
+export ZSH=$HOME/zsh
3
+export LC_CTYPE=en_US.UTF-8
4
+
5
+# TODO: Refactor this sometimes soon...
6
+source $ZSH/colors.zsh
7
+source $ZSH/aliases.zsh
8
+source $ZSH/completion.zsh
9
+source $ZSH/rake_completion.zsh
10
+source $ZSH/functions.zsh
11
+source $ZSH/git.zsh
12
+source $ZSH/history.zsh
13
+source $ZSH/grep.zsh
14
+source $ZSH/prompt.zsh
15
+
16
+# Uncomment if you have a projects.zsh file
17
+# source $ZSH/projects.zsh
18
+
19
+# Directory stuff.
20
+
21
+setopt AUTO_NAME_DIRS
22
+
23
+# Speed stuff.
24
+
25
+#setopt NO_BEEP
26
+setopt AUTO_CD
27
+setopt MULTIOS
28
+setopt CDABLEVARS
29
+
30
+# Customize to your needs...
31
+export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin
32
+
33
+