Browse Source

Importing initial files after reorganizing stuff.

Robby Russell 14 years ago
parent
commit
5da20b9ddd
12 changed files with 259 additions and 0 deletions
  1. 8 0
      README.textile
  2. 44 0
      aliases.zsh
  3. 4 0
      colors.zsh
  4. 27 0
      completion.zsh
  5. 26 0
      functions.zsh
  6. 19 0
      git.zsh
  7. 6 0
      grep.zsh
  8. 15 0
      history.zsh
  9. 5 0
      projects.zsh-example
  10. 29 0
      prompt.zsh
  11. 42 0
      rake_completion.zsh
  12. 34 0
      zshrc

+ 8 - 0
README.textile

@@ -0,0 +1,8 @@
+h2. Setup
+
+# Clone the repository to ~/zsh
+# Symlink the zsh config with: @ln -s ~/zsh/zshrc .zshrc@
+# Reload zsh (open a new terminal)
+
+
+

+ 44 - 0
aliases.zsh

@@ -0,0 +1,44 @@
+alias c='cd'
+alias pu='pushd'
+alias po='popd'
+alias sc='ruby script/console'
+alias ss='ruby script/server'
+
+alias mr='mate CHANGELOG app config db lib public script spec test'
+alias .='pwd'
+alias ...='cd ../..'
+alias ....='cd ../../..'
+alias .....='cd ../../../..'
+alias ......='cd ../../../../..'
+alias .......='cd ../../../../../..'
+
+alias _='sudo'
+alias ss='setsid'
+
+alias g='grep -in'
+
+alias s='svn'
+alias e='mate'
+
+alias history='fc -l 1'
+
+# Git aliases
+
+alias utb='tar jxvf'
+alias utz='tar zxvf'
+
+alias ls='ls -GF'
+alias ll='ls -al'
+
+alias sgem='sudo gem'
+
+alias rfind='find . -name *.rb | xargs grep -n'
+
+alias xenon='ssh rrussell@xenon.planetargon.com'
+
+alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
+
+bindkey '\ew' kill-region
+
+bindkey -s '\el' "ls\n"
+bindkey -s '\e.' "..\n"

+ 4 - 0
colors.zsh

@@ -0,0 +1,4 @@
+autoload colors; colors;
+
+unset LSCOLORS
+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'

+ 27 - 0
completion.zsh

@@ -0,0 +1,27 @@
+setopt noautomenu
+setopt COMPLETE_IN_WORD
+setopt ALWAYS_TO_END
+
+unsetopt flowcontrol
+
+WORDCHARS=''
+
+autoload -U compinit
+compinit
+
+zmodload -i zsh/complist
+
+zstyle ':completion:*' list-colors ''
+zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
+
+unsetopt MENU_COMPLETE
+setopt AUTO_MENU
+
+bindkey -M menuselect '^o' accept-and-infer-next-history
+
+zstyle ':completion:*:*:*:*:*' menu yes 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"
+zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`

+ 26 - 0
functions.zsh

@@ -0,0 +1,26 @@
+function title {
+  if [[ $TERM == "screen" ]]; then
+    # Use these two for GNU Screen:
+    print -nR $'\033k'$1$'\033'\\\
+
+    print -nR $'\033]0;'$2$'\a'
+  elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
+    # Use this one instead for XTerms:
+    print -nR $'\033]0;'$*$'\a'
+  fi
+}
+
+function precmd {
+  title zsh "$PWD"
+}
+
+function preexec {
+  emulate -L zsh
+  local -a cmd; cmd=(${(z)1})
+  title $cmd[1]:t "$cmd[2,-1]"
+}
+
+
+function remote_console() {
+  /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
+}

+ 19 - 0
git.zsh

@@ -0,0 +1,19 @@
+# get the name of the branch we are on
+function git_prompt_info() {
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+  branch=${ref#refs/heads/}
+
+  if [[ -d .git ]]; then
+    CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])"
+  else
+    CURRENT_BRANCH=''
+  fi
+
+
+  #echo "%{$fg[red]%}git:(%{$fg[green]$CURRENT_BRANCH%{$fg[red])"
+  echo $CURRENT_BRANCH
+}
+
+parse_git_dirty () {
+  [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ "
+}

+ 6 - 0
grep.zsh

@@ -0,0 +1,6 @@
+#
+# Color grep results
+# Examples: http://rubyurl.com/ZXv
+#
+export GREP_OPTIONS='--color=auto'
+export GREP_COLOR='1;32'

+ 15 - 0
history.zsh

@@ -0,0 +1,15 @@
+# History stuff.
+setopt HIST_VERIFY
+setopt INC_APPEND_HISTORY
+setopt SHARE_HISTORY
+setopt EXTENDED_HISTORY
+setopt HIST_IGNORE_DUPS
+
+## Command history configuration
+#
+HISTFILE=$ZSH/log/.zsh_history
+HISTSIZE=2500
+SAVEHIST=2500
+setopt hist_ignore_dups # ignore duplication command history list
+setopt share_history # share command history data
+

+ 5 - 0
projects.zsh-example

@@ -0,0 +1,5 @@
+# Add yourself some shortcuts to projects you often work on
+# Example:
+#
+# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
+#

+ 29 - 0
prompt.zsh

@@ -0,0 +1,29 @@
+bindkey -e
+
+# Directory stuff.
+setopt AUTO_NAME_DIRS
+
+# Speed stuff.
+
+#setopt NO_BEEP
+setopt AUTO_CD
+setopt MULTIOS
+setopt CDABLEVARS
+
+bindkey -e
+
+if [[ x$WINDOW != x ]]
+then
+    SCREEN_NO="%B$WINDOW%b "
+else
+    SCREEN_NO=""
+fi
+
+PS1="%n@%m:%~%# "
+
+# Setup the prompt with pretty colors
+setopt prompt_subst
+
+export LSCOLORS="Gxfxcxdxbxegedabagacad"
+
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'

+ 42 - 0
rake_completion.zsh

@@ -0,0 +1,42 @@
+_rake_does_task_list_need_generating () {
+  if [ ! -f .rake_tasks ]; then return 0;
+  else
+    accurate=$(stat -f%m .rake_tasks)
+    changed=$(stat -f%m Rakefile)
+    return $(expr $accurate '>=' $changed)
+  fi
+}
+
+_rake () {
+  if [ -f Rakefile ]; then
+    if _rake_does_task_list_need_generating; then
+      echo "\nGenerating .rake_tasks..." > /dev/stderr
+      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
+    fi
+    compadd `cat .rake_tasks`
+  fi
+}
+
+compdef _rake rake
+
+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
+}
+
+compdef _cap cap

+ 34 - 0
zshrc

@@ -0,0 +1,34 @@
+export EDITOR=/opt/local/bin/joe
+export PAGER=less
+export ZSH=$HOME/zsh
+export LC_CTYPE=en_US.UTF-8
+
+# TODO: Refactor this sometimes soon...
+source $ZSH/colors.zsh
+source $ZSH/aliases.zsh
+source $ZSH/completion.zsh
+source $ZSH/rake_completion.zsh
+source $ZSH/functions.zsh
+source $ZSH/git.zsh
+source $ZSH/history.zsh
+source $ZSH/grep.zsh
+source $ZSH/prompt.zsh
+
+# Uncomment if you have a projects.zsh file
+# source $ZSH/projects.zsh
+
+# Directory stuff.
+
+setopt AUTO_NAME_DIRS
+
+# Speed stuff.
+
+#setopt NO_BEEP
+setopt AUTO_CD
+setopt MULTIOS
+setopt CDABLEVARS
+
+# Customize to your needs...
+export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin
+
+