Permalink
Browse files

adding zsh, git, irb, rubygems configs, mostly copied from ryanb

  • Loading branch information...
1 parent 3b6f09b commit 270a5707c87f2fac75794d9912b43d3f45dd352b @briandoll committed Sep 21, 2008
View
10 gemrc
@@ -0,0 +1,10 @@
+---
+:gem: --no-ri --no-rdoc
+:sources:
+- http://gems.rubyforge.org
+- http://gems.github.com/
+:bulk_threshold: 1000
+:update_sources: true
+:verbose: true
+:backtrace: false
+:benchmark: false
View
14 gitconfig
@@ -0,0 +1,14 @@
+[user]
+ name = Brian Doll
+ email = brian@emphaticsolutions.com
+[alias]
+ co = checkout
+ s = status
+[color]
+ diff = auto
+ status = auto
+ branch = auto
+[core]
+ excludesfile = ~/.gitignore
+[apply]
+ whitespace = nowarn
View
3 gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+.svn
+*~
View
19 install.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+
+# from http://errtheblog.com/posts/89-huba-huba
+
+home = ENV['HOME']
+
+Dir.chdir File.dirname(__FILE__) do
+ dotfiles_dir = Dir.pwd.sub(home + '/', '')
+
+ Dir['*'].each do |file|
+ next if %w[Rakefile README LICENSE install.rb].include? file
+
+ target = File.join(home, ".#{file}")
+ unless File.exist? target
+ system %[ln -vsf #{File.join(dotfiles_dir, file)} #{target}]
+ end
+ end
+end
+
View
34 irbrc
@@ -0,0 +1,34 @@
+#!/usr/bin/ruby
+require 'irb/completion'
+require 'irb/ext/save-history'
+
+IRB.conf[:SAVE_HISTORY] = 1000
+IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
+
+IRB.conf[:PROMPT_MODE] = :SIMPLE
+
+IRB.conf[:AUTO_INDENT] = true
+
+class Object
+ # list methods which aren't in superclass
+ def local_methods(obj = self)
+ (obj.methods - obj.class.superclass.instance_methods).sort
+ end
+
+ # print documentation
+ #
+ # ri 'Array#pop'
+ # Array.ri
+ # Array.ri :pop
+ # arr.ri :pop
+ def ri(method = nil)
+ unless method && method =~ /^[A-Z]/ # if class isn't specified
+ klass = self.kind_of?(Class) ? name : self.class.name
+ method = [klass, method].compact.join('#')
+ end
+ puts `ri '#{method}'`
+ end
+end
+
+load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV']
+
View
15 railsrc
@@ -0,0 +1,15 @@
+#!/usr/bin/ruby
+
+def change_log(stream)
+ ActiveRecord::Base.logger = Logger.new(stream)
+ ActiveRecord::Base.clear_active_connections!
+end
+
+def show_log
+ change_log(STDOUT)
+end
+
+def hide_log
+ change_log(nil)
+end
+
View
33 zsh/aliases
@@ -0,0 +1,33 @@
+# cd
+alias ..='cd ..'
+
+# ls
+alias ls="ls -F"
+alias l="ls -lAh"
+alias ll="ls -l"
+alias la='ls -A'
+
+# git
+alias gl='git pull'
+alias gp='git push'
+alias gd='git diff'
+alias gc='git commit'
+alias gca='git commit -a'
+alias gco='git checkout'
+alias gb='git branch'
+alias gs='git status'
+alias grm="git status | grep deleted | awk '{print \$3}' | xargs git rm"
+
+# rails
+alias sc='script/console'
+alias ss='script/server'
+alias sg='script/generate'
+alias a='autotest -rails'
+alias tlog='tail -f log/development.log'
+alias scaffold='script/generate nifty_scaffold'
+alias migrate='rake db:migrate db:test:clone'
+alias rst='touch tmp/restart.txt'
+
+# commands starting with % for pasting from web
+alias %=' '
+
View
8 zsh/completion
@@ -0,0 +1,8 @@
+autoload -U compinit
+compinit
+
+# matches case insensitive for lowercase
+zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
+
+# pasting with tabs doesn't perform completion
+zstyle ':completion:*' insert-tab pending
View
39 zsh/config
@@ -0,0 +1,39 @@
+
+export EDITOR='emacs'
+export PATH="~/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:$PATH"
+export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH"
+
+fpath=(~/.zsh/functions $fpath)
+
+autoload -U ~/.zsh/functions/*(:t)
+
+HISTFILE=~/.zsh_history
+HISTSIZE=1000
+SAVEHIST=1000
+
+setopt NO_BG_NICE # don't nice background tasks
+setopt NO_HUP
+setopt NO_LIST_BEEP
+setopt LOCAL_OPTIONS # allow functions to have local options
+setopt LOCAL_TRAPS # allow functions to have local traps
+setopt HIST_VERIFY
+setopt SHARE_HISTORY # share history between sessions ???
+setopt EXTENDED_HISTORY # add timestamps to history
+setopt PROMPT_SUBST
+setopt CORRECT
+setopt COMPLETE_IN_WORD
+setopt IGNORE_EOF
+
+setopt APPEND_HISTORY # adds history
+setopt INC_APPEND_HISTORY SHARE_HISTORY # adds history incrementally and share it across sessions
+setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history
+setopt HIST_REDUCE_BLANKS
+
+zle -N newtab
+
+bindkey '^[^[[D' backward-word
+bindkey '^[^[[C' forward-word
+bindkey '^[[5D' beginning-of-line
+bindkey '^[[5C' end-of-line
+bindkey '^[[3~' delete-char
+bindkey '^[^N' newtab
View
8 zsh/functions/_cap
@@ -0,0 +1,8 @@
+#compdef cap
+if [ -f Capfile ]; then
+ recent=`last_modified .cap_tasks~ Capfile **/deploy.rb`
+ if [[ $recent != '.cap_tasks~' ]]; then
+ cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
+ fi
+ compadd `cat .cap_tasks~`
+fi
View
7 zsh/functions/_git-rm
@@ -0,0 +1,7 @@
+#compdef git-rm
+_arguments -S -A '-*' \
+ '-f[override the up-to-date check]' \
+ "-n[don't actually remove the files, just show if they exist in the index]" \
+ '-r[allow recursive removal when a leading directory-name is given]' \
+ '--cached[only remove files from the index]' && ret=0
+_files
View
2 zsh/functions/_h
@@ -0,0 +1,2 @@
+#compdef h
+_files -W ~ -/
View
8 zsh/functions/_rake
@@ -0,0 +1,8 @@
+#compdef rake
+if [ -f Rakefile ]; then
+ recent=`last_modified .rake_tasks~ Rakefile **/*.rake`
+ if [[ $recent != '.rake_tasks~' ]]; then
+ rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
+ fi
+ compadd `cat .rake_tasks~`
+fi
View
1 zsh/functions/gam
@@ -0,0 +1 @@
+curl $1 | git am
View
1 zsh/functions/gfp
@@ -0,0 +1 @@
+git format-patch master --stdout > $1
View
48 zsh/functions/git_info_for_prompt
@@ -0,0 +1,48 @@
+local g="$(git rev-parse --git-dir 2>/dev/null)"
+if [ -n "$g" ]; then
+ local r
+ local b
+ if [ -d "$g/../.dotest" ]
+ then
+ if test -f "$g/../.dotest/rebasing"
+ then
+ r="|REBASE"
+ elif test -f "$g/../.dotest/applying"
+ then
+ r="|AM"
+ else
+ r="|AM/REBASE"
+ fi
+ b="$(git symbolic-ref HEAD 2>/dev/null)"
+ elif [ -f "$g/.dotest-merge/interactive" ]
+ then
+ r="|REBASE-i"
+ b="$(cat "$g/.dotest-merge/head-name")"
+ elif [ -d "$g/.dotest-merge" ]
+ then
+ r="|REBASE-m"
+ b="$(cat "$g/.dotest-merge/head-name")"
+ elif [ -f "$g/MERGE_HEAD" ]
+ then
+ r="|MERGING"
+ b="$(git symbolic-ref HEAD 2>/dev/null)"
+ else
+ if [ -f "$g/BISECT_LOG" ]
+ then
+ r="|BISECTING"
+ fi
+ if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
+ then
+ if ! b="tag: $(git describe --exact-match HEAD 2>/dev/null)"
+ then
+ b="$(cut -c1-7 "$g/HEAD")..."
+ fi
+ fi
+ fi
+
+ if [ -n "$1" ]; then
+ printf "$1" "${b##refs/heads/}$r"
+ else
+ printf "[%s]" "${b##refs/heads/}$r"
+ fi
+fi
View
1 zsh/functions/h
@@ -0,0 +1 @@
+cd ~/$1;
View
1 zsh/functions/last_modified
@@ -0,0 +1 @@
+ls -t $* 2> /dev/null | head -n 1
View
26 zsh/functions/newtab
@@ -0,0 +1,26 @@
+savepath
+osascript >/dev/null <<EOF
+on do_submenu(app_name, menu_name, menu_item, submenu_item)
+ -- bring the target application to the front
+ tell application app_name
+ activate
+ end tell
+ tell application "System Events"
+ tell process app_name
+ tell menu bar 1
+ tell menu bar item menu_name
+ tell menu menu_name
+ tell menu item menu_item
+ tell menu menu_item
+ click menu item submenu_item
+ end tell
+ end tell
+ end tell
+ end tell
+ end tell
+ end tell
+ end tell
+end do_submenu
+
+do_submenu("Terminal", "Shell", "New Tab", 1)
+EOF
View
1 zsh/functions/savepath
@@ -0,0 +1 @@
+pwd > ~/.current_path~
View
5 zsh/functions/verbose_completion
@@ -0,0 +1,5 @@
+zstyle ':completion:*' verbose yes
+zstyle ':completion:*:descriptions' format '%B%d%b'
+zstyle ':completion:*:messages' format '%d'
+zstyle ':completion:*:warnings' format 'No matches for: %d'
+zstyle ':completion:*' group-name ''
View
6 zshrc
@@ -0,0 +1,6 @@
+. ~/.zsh/config
+. ~/.zsh/aliases
+. ~/.zsh/completion
+
+# use .localrc for settings specific to one system
+[[ -f ~/.localrc ]] && . ~/.localrc

0 comments on commit 270a570

Please sign in to comment.