Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 293a2ece914decc83358f20d2116635230f037a6 @delynn committed Jun 18, 2012
@@ -0,0 +1,2 @@
+vim/.netrwhist
+vim/.VimballRecord
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2012 Ryan Bates
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,72 @@
+# Ryan Bates Dot Files
+
+These are config files to set up a system the way I like it. It now uses [Oh My ZSH](https://github.com/robbyrussell/oh-my-zsh). If you would like to see my old, custom Bash and ZSH config, check out [this branch](https://github.com/ryanb/dotfiles/tree/custom-bash-zsh)
+
+I am running on Mac OS X, but it will likely work on Linux as well.
+
+
+## Installation
+
+Run the following commands in your terminal. It will prompt you before it does anything destructive. Check out the [Rakefile](https://github.com/ryanb/dotfiles/blob/custom-bash-zsh/Rakefile) to see exactly what it does.
+
+```terminal
+git clone git://github.com/ryanb/dotfiles ~/.dotfiles
+cd ~/.dotfiles
+rake install
+```
+
+After installing, open a new terminal window to see the effects.
+
+Feel free to customize the .zshrc file to match your preference.
+
+
+## Features
+
+Many of the following features are added through the "rbates" Oh My ZSH plugin.
+
+I normally place all of my coding projects in ~/code, so this directory can easily be accessed (and tab completed) with the "c" command.
+
+```terminal
+c railsca<tab>
+```
+
+There is also an "h" command which behaves similar, but acts on the home path.
+
+```terminal
+h doc<tab>
+```
+
+Tab completion is also added to rake and cap commands:
+
+```
+rake db:mi<tab>
+cap de<tab>
+```
+
+To speed things up, the results are cached in local .rake_tasks~ and .cap_tasks~. It is smart enough to expire the cache automatically in most cases, but you can simply remove the files to flush the cache.
+
+If you're using git, you'll notice the current branch name shows up in the prompt while in a git repository.
+
+There are several features enabled in Ruby's irb including history and completion. Many convenience methods are added as well such as "ri" which can be used to get inline documentation in IRB. See irbrc file for details.
+
+
+## Uninstall
+
+To remove the dotfile configs, run the following commands. Be certain to double check the contents of the files before removing so you don't lose custom settings.
+
+```
+unlink ~/.bin
+unlink ~/.gitignore
+unlink ~/.gemrc
+unlink ~/.gvimrc
+unlink ~/.irbrc
+unlink ~/.vim
+unlink ~/.vimrc
+rm ~/.zshrc # careful here
+rm ~/.gitconfig
+rm -rf ~/.dotfiles
+rm -rf ~/.oh-my-zsh
+chsh -s /bin/bash # change back to Bash if you want
+```
+
+Then open a new terminal window to see the effects.
@@ -0,0 +1,91 @@
+require 'rake'
+require 'erb'
+
+desc "install the dot files into user's home directory"
+task :install do
+ install_oh_my_zsh
+ switch_to_zsh
+ replace_all = true
+ files = Dir['*'] - %w[Rakefile README.rdoc LICENSE oh-my-zsh]
+ files << "oh-my-zsh/custom/plugins/berryd"
+ files << "oh-my-zsh/custom/berryd.zsh-theme"
+ files.each do |file|
+ system %Q{mkdir -p "$HOME/.#{File.dirname(file)}"} if file =~ /\//
+ if File.exist?(File.join(ENV['HOME'], ".#{file.sub(/\.erb$/, '')}"))
+ if File.identical? file, File.join(ENV['HOME'], ".#{file.sub(/\.erb$/, '')}")
+ puts "identical ~/.#{file.sub(/\.erb$/, '')}"
+ elsif replace_all
+ replace_file(file)
+ else
+ print "overwrite ~/.#{file.sub(/\.erb$/, '')}? [ynaq] "
+ case $stdin.gets.chomp
+ when 'a'
+ replace_all = true
+ replace_file(file)
+ when 'y'
+ replace_file(file)
+ when 'q'
+ exit
+ else
+ puts "skipping ~/.#{file.sub(/\.erb$/, '')}"
+ end
+ end
+ else
+ link_file(file)
+ end
+ end
+end
+
+def replace_file(file)
+ system %Q{rm -rf "$HOME/.#{file.sub(/\.erb$/, '')}"}
+ link_file(file)
+end
+
+def link_file(file)
+ if file =~ /.erb$/
+ puts "generating ~/.#{file.sub(/\.erb$/, '')}"
+ File.open(File.join(ENV['HOME'], ".#{file.sub(/\.erb$/, '')}"), 'w') do |new_file|
+ new_file.write ERB.new(File.read(file)).result(binding)
+ end
+ elsif file =~ /zshrc$/ # copy zshrc instead of link
+ puts "copying ~/.#{file}"
+ system %Q{cp "$PWD/#{file}" "$HOME/.#{file}"}
+ else
+ puts "linking ~/.#{file}"
+ system %Q{ln -s "$PWD/#{file}" "$HOME/.#{file}"}
+ end
+end
+
+def switch_to_zsh
+ if ENV["SHELL"] =~ /zsh/
+ puts "using zsh"
+ else
+ print "switch to zsh? (recommended) [ynq] "
+ case $stdin.gets.chomp
+ when 'y'
+ puts "switching to zsh"
+ system %Q{chsh -s `which zsh`}
+ when 'q'
+ exit
+ else
+ puts "skipping zsh"
+ end
+ end
+end
+
+def install_oh_my_zsh
+ if File.exist?(File.join(ENV['HOME'], ".oh-my-zsh"))
+ puts "found ~/.oh-my-zsh"
+ else
+ print "install oh-my-zsh? [ynq] "
+ case $stdin.gets.chomp
+ when 'y'
+ puts "installing oh-my-zsh"
+ system %Q{git clone https://github.com/robbyrussell/oh-my-zsh.git "$HOME/.oh-my-zsh"}
+ when 'q'
+ exit
+ else
+ puts "skipping oh-my-zsh, you will need to change ~/.zshrc"
+ end
+ end
+end
9 gemrc
@@ -0,0 +1,9 @@
+---
+:verbose: true
+gem: --no-ri --no-rdoc
+:update_sources: true
+:sources:
+- http://gems.rubyforge.org
+:backtrace: false
+:bulk_threshold: 1000
+:benchmark: false
@@ -0,0 +1,85 @@
+[user]
+ name = <%= print(" Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
+ email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
+
+[alias]
+ a = add
+ aa = !git add -u && git add . && git status
+ ap = add -p
+ b = branch -v -a
+ br = branch
+ c = commit -m
+ ca = commit --amend -m
+ ci = commit
+ cleanup = !git remote prune origin && git gc && git clean -dfx && git stash clear
+ co = checkout
+ cob = checkout -b
+ cobt = checkout --track -b
+ d = diff
+ done = !git fetch && git rebase origin/master && git checkout master && git merge @{-1} && rake && git push
+ ir = !git rebase -i origin/master
+ l = log --oneline
+ log1 = log -1 --oneline
+ p = push
+ ph = push heroku master
+ publish = !git checkout master && git pull && git checkout dev && git rebase master && git checkout master && git merge dev && git wtf
+ r = remote -v
+ rmb = !sh -c 'git branch -D $1 && git push origin :$1' -
+ s = status -sb
+ st = status
+ up = !git fetch origin && git rebase origin/master
+
+[apply]
+ whitespace = nowarn
+
+[branch]
+ autosetupmerge = true
+
+[core]
+ excludesfile = <%= ENV['HOME'] %>.gitignore
+ filemode = true
+ logallrefupdates = true
+ whitespac = space-before-tab, trailing-space
+ editor = mate -w
+ autocrlf = input
+
+[color]
+ ui = auto
+
+[color "diff"]
+ meta = blue bold
+ frag = magenta bold
+ old = red bold
+ new = green bold
+
+[color "branch"]
+ current = yellow reverse
+ local = yellow bold
+ remote = green bold
+ plain = red bold
+
+[color "status"]
+ added = yellow
+ changed = green bold
+ untracked = blue bold
+
+[format]
+ pretty = %C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset
+
+[merge]
+ tool = opendiff
+ summary = true
+
+[push]
+ # Push current branch even if you've never pushed it before
+ default = current
+
+[github]
+ user = <%= print(" GitHub Username: "); STDOUT.flush; STDIN.gets.chomp %>
+ token = <%= print("GitHub API Token: "); STDOUT.flush; STDIN.gets.chomp %>
+
+[pivotal]
+ full-name = <%= print(" Pivotal Name: "); STDOUT.flush; STDIN.gets.chomp %>
+ api-token = <%= print("Pivotal API Token: "); STDOUT.flush; STDIN.gets.chomp %>
+ only-mine = true
+ integration-branch = staging
@@ -0,0 +1,32 @@
+# OS X
+.DS_Store
+.svn
+.*.swp
+Icon?
+*~
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+# TextMate
+*.tmproj
+*.tmproject
+tmtags
+
+# Archive
+# It's better to unpack these files and commit the raw source because
+# git has its own built in compression methods.
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.tar.gz
+*.zip
+*.bzip
6 gvimrc
@@ -0,0 +1,6 @@
+set guioptions-=T " hide toolbar
+set lines=55 columns=100
+
+colorscheme railscasts
+
+set guifont=DejaVu\ Sans\ Mono:h13
43 irbrc
@@ -0,0 +1,43 @@
+#!/usr/bin/env 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
+
+%w[rubygems looksee/shortcuts wirble].each do |gem|
+ begin
+ require gem
+ rescue LoadError
+ end
+end
+
+class Object
+ # list methods which aren't in superclass
+ def local_methods(obj = self)
+ (obj.methods - obj.class.superclass.instance_methods).sort
+ end
+end
+
+def copy(str)
+ IO.popen('pbcopy', 'w') { |f| f << str.to_s }
+end
+
+def copy_history
+ history = Readline::HISTORY.entries
+ index = history.rindex("exit") || -1
+ content = history[(index+1)..-2].join("\n")
+ puts content
+ copy content
+end
+
+def paste
+ `pbpaste`
+end
+
+load "#{ENV['HOME']}/.railsrc" if defined?(Rails)
@@ -0,0 +1,11 @@
+local current_path='%{$fg_bold[cyan]%}%c%{$reset_color%}'
+# local rvm_prompt='%{$fg_bold[blue]%}[%{$reset_color%}%{$fg[green]%}$(rvm-prompt)%{$reset_color%}%{$fg_bold[blue]%}]%{$reset_color%}'
+local git_branch='%{$fg_bold[blue]%}$(git_prompt_info)'
+local my_prompt='%{$fg[cyan]%}$ %{$reset_color%}'
+
+ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg[red]%}"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ✹%{$fg[blue]%}]"
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}]"
+
+PROMPT=" ${current_path} ${rvm_prompt}${git_branch} ${my_prompt}"
@@ -0,0 +1,8 @@
+#compdef cap
+if [[ -f Capfile ]]; then
+ local recent=$(ls -t .cap_tasks~ Capfile **/deploy.rb 2> /dev/null | head -n 1)
+ if [[ $recent != .cap_tasks~ ]]; then
+ cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
+ fi
+ compadd $(cat .cap_tasks~)
+fi
Oops, something went wrong.

0 comments on commit 293a2ec

Please sign in to comment.