Permalink
Browse files

init

  • Loading branch information...
waymondo committed Jun 4, 2012
0 parents commit b82d233bc62fb5ec001ed1e7382a1b1c234511b3
Showing with 1,744 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +6 −0 .gitmodules
  3. +30 −0 README.md
  4. +50 −0 Rakefile
  5. +5 −0 ackrc
  6. +4 −0 aprc
  7. +25 −0 emacs.d/bindings.el
  8. +50 −0 emacs.d/carbon.el
  9. +148 −0 emacs.d/config.el
  10. +15 −0 emacs.d/custom.el
  11. +225 −0 emacs.d/defuns.el
  12. +34 −0 emacs.d/init.el
  13. +74 −0 emacs.d/modes.el
  14. +22 −0 emacs.d/packages.el
  15. +193 −0 emacs.d/vendor/less-css-mode.el
  16. +252 −0 emacs.d/vendor/mustache-mode.el
  17. +1 −0 emacs.d/vendor/rhtml-mode
  18. +1 −0 emacs.d/vendor/rinari
  19. +409 −0 emacs.d/vendor/slim-mode.el
  20. +10 −0 gemrc
  21. +47 −0 gitconfig
  22. +15 −0 gitignore
  23. +5 −0 irbrc
  24. +2 −0 powconfig
  25. +11 −0 pryrc
  26. +17 −0 tmux.conf
  27. +58 −0 vimrc
  28. +23 −0 zshrc
@@ -0,0 +1,12 @@
+*.DS_Store
+*.elc
+/emacs.d/eshell
+/emacs.d/elpa
+/emacs.d/tramp
+/emacs.d/places
+/emacs.d/savehist
+/emacs.d/history
+/emacs.d/recentf
+/emacs.d/saveplace
+/emacs.d/ac-comphist.dat
+/emacs.d/url/cookies
@@ -0,0 +1,6 @@
+[submodule "emacs.d/vendor/rinari"]
+ path = emacs.d/vendor/rinari
+ url = git://github.com/eschulte/rinari.git
+[submodule "emacs.d/vendor/rhtml-mode"]
+ path = emacs.d/vendor/rhtml-mode
+ url = git://github.com/eschulte/rhtml.git
@@ -0,0 +1,30 @@
+# dotfiles
+
+a mainly git, ruby, javascript, coffeesript, and less css set-up on osx with carbon emacs 24 as editor in chief and zsh in a single tmux-ed shell.
+
+## installation
+
+check it out into a directory of your choice:
+
+1. `git clone git://github.com/waymondo/dotfiles`
+2. `cd dotfiles`
+3. `rake install`
+
+### emacs 24
+
+installing emacs 24 is easy with [homebrew](http://mxcl.github.com/homebrew) =>
+
+`brew install emacs --cocoa --use-git-head --HEAD`
+`mv /usr/local/Cellar/emacs/HEAD/Emacs.app /Applications/`
+
+### while you are brewing
+
+`brew install zsh tmux rbenv ruby-build ack`
+
+### also makes use of:
+
+* [pow](http://pow.cx)
+* [oh my zsh](https://github.com/robbyrussell/oh-my-zsh)
+* [peepopen](http://peepcode.com/products/peepopen)
+* [pry](https://github.com/pry/pry)
+* [awesome_print](https://github.com/michaeldv/awesome_print)
@@ -0,0 +1,50 @@
+require 'rake'
+require 'erb'
+
+desc "install the dot files into user's home directory"
+task :install do
+ replace_all = false
+ Dir['*'].each do |file|
+ next if %w[Rakefile README.md].include? 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
+ else
+ puts "linking ~/.#{file}"
+ system %Q{ln -s "$PWD/#{file}" "$HOME/.#{file}"}
+ end
+end
5 ackrc
@@ -0,0 +1,5 @@
+--type-add=ruby=.haml,.rake,.rsel,.sass,.scss,.feature,.less,.slim,.hbs
+--type-set
+coffeescript=.coffee
+--ignore-dir=node_modules
+--ignore-dir=.bundle
4 aprc
@@ -0,0 +1,4 @@
+AwesomePrint.defaults = {
+ :indent => 2,
+ :sort_keys => true
+}
@@ -0,0 +1,25 @@
+;; osx-ish
+(global-set-key (kbd "s-s") 'save-buffer)
+(global-set-key (kbd "s-z") 'undo)
+(global-set-key (kbd "s-w") 'kill-this-buffer)
+(global-set-key (kbd "s-F") 'ns-toggle-fullscreen)
+(global-set-key (kbd "C-=") 'text-scale-increase)
+(global-set-key (kbd "C--") 'text-scale-decrease)
+
+;; conveniency
+(global-set-key (kbd "s-=") 'ido-switch-buffer)
+(global-set-key (kbd "s--") 'switch-to-previous-buffer)
+(global-set-key [f1] 'magit-status)
+(global-set-key [f2] 'dired)
+(global-set-key [f3] 'open-project)
+(global-set-key (kbd "s-x") 'smex)
+(global-set-key (kbd "M-/") 'hippie-expand)
+
+;; shortcuts for common patterns
+(global-set-key (kbd "s->") 'arrow)
+(global-set-key (kbd "s-{") 'open-curlies-and-indent)
+(global-set-key (kbd "C-c k") 'bckwrd-kill-line)
+(global-set-key (kbd "s-u") 'dupe-line)
+(global-set-key (kbd "C-x \\") 'align-regexp)
+
+(provide 'bindings)
@@ -0,0 +1,50 @@
+(require 'volatile-highlights)
+(require 'auto-complete)
+(require 'textmate)
+(require 'magit)
+(require 'peepopen)
+(require 'ack-and-a-half)
+;(vendor 'rinari)
+(vendor 'rhtml-mode)
+
+(textmate-mode)
+(smex-initialize)
+(fringe-mode 0)
+
+(electric-pair-mode t)
+
+; autocomplete
+(global-auto-complete-mode t)
+(dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode
+ yaml-mode html-mode nxml-mode sh-mode lisp-mode markdown-mode
+ css-mode less-css-mode ruby-mode javascript-mode js-mode
+ js2-mode js3-mode php-mode slim-mode coffee-mode rhtml-mode
+ mustache-mode
+ ))
+(add-to-list 'ac-modes mode))
+
+(volatile-highlights-mode t)
+
+; osx stuff
+(normal-erase-is-backspace-mode t)
+(setq default-input-method "MacOSX"
+ delete-by-moving-to-trash t
+ mac-command-key-is-meta nil
+ browse-url-browser-function 'browse-url-default-macosx-browser
+)
+
+(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
+
+(defun copy-from-osx ()
+ (shell-command-to-string "pbpaste"))
+
+(defun paste-to-osx (text &optional push)
+ (let ((process-connection-type nil))
+ (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
+ (process-send-string proc text)
+ (process-send-eof proc))))
+
+(setq interprogram-cut-function 'paste-to-osx)
+(setq interprogram-paste-function 'copy-from-osx)
+
+(provide 'carbon)
@@ -0,0 +1,148 @@
+;; built-in
+(require 'uniquify)
+(require 'saveplace)
+(require 'recentf)
+
+;; vendored
+(require 'mustache-mode)
+(require 'slim-mode)
+(require 'less-css-mode)
+
+(setq inhibit-startup-message t)
+
+;; always update files, i.e. after git pull
+(global-auto-revert-mode 1)
+
+;; nice scrolling
+(setq scroll-margin 20)
+(setq scroll-conservatively 100000)
+(setq scroll-preserve-screen-position 1)
+
+;; disable auto-save files (#foo#)
+(setq auto-save-default nil)
+
+;; disable backup files (foo~)
+(setq backup-inhibited t)
+
+;; disable auto-save-list/.saves
+(setq auto-save-list-file-prefix nil)
+
+;; save place, save history, recentf
+(setq-default save-place t)
+(setq recentf-max-saved-items 200)
+(setq recentf-save-file "~/.emacs.d/recentf")
+(setq savehist-file "~/.emacs.d/savehist")
+(setq save-place-file "~/.emacs.d/places")
+(savehist-mode t)
+(recentf-mode t)
+
+;; shift+arrows to move between buffers
+(windmove-default-keybindings)
+
+;; ido
+(ido-mode t)
+(ido-everywhere t)
+(setq ido-enable-flex-matching t) ;; fuzzy matching
+(setq ido-use-virtual-buffers t) ;; include non-existent buffers
+(setq ido-auto-merge-work-directories-length nil)
+(setq ido-use-filename-at-point nil)
+(setq ido-max-window-height 29) ;; big ol window
+(setq ido-max-prospects 25)
+(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) ;; vertical results!
+(add-to-list 'ido-ignore-files "\\.DS_Store")
+(add-to-list 'ido-ignore-files "\\.ido.last")
+(add-to-list 'ido-ignore-files "\\.loaddefs.el")
+
+;; auto-complete in mini-buffer
+(icomplete-mode +1)
+
+;; tabs
+(setq-default tab-width 2)
+(setq-default indent-tabs-mode nil)
+
+;; utf-8
+(prefer-coding-system 'utf-8)
+(setq buffer-file-coding-system 'utf-8)
+
+;; meaningful names for buffers with the same name
+(setq uniquify-buffer-name-style 'forward)
+(setq uniquify-separator "")
+(setq uniquify-after-kill-buffer-p t) ; rename after killing uniquified
+(setq uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
+
+;; prefs
+(fset 'yes-or-no-p 'y-or-n-p)
+(setq visible-bell t)
+(setq confirm-nonexistent-file-or-buffer nil)
+(setq max-lisp-eval-depth 100000)
+(setq show-trailing-whitespace t)
+(setq pop-up-windows nil)
+(setq ns-pop-up-frames nil)
+(setq vc-handled-backends nil)
+(setq mac-allow-anti-aliasing t)
+
+;; minor modes
+(transient-mark-mode t)
+(show-paren-mode t)
+(hl-line-mode t)
+(blink-cursor-mode t)
+(size-indication-mode t)
+
+;; dired - reuse current buffer by pressing 'a'
+(put 'dired-find-alternate-file 'disabled nil)
+
+;; hooks
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
+
+;; automatically indenting yanked text if in programming-modes
+(defvar yank-indent-modes '(python-mode LaTeX-mode TeX-mode)
+ "Modes in which to indent regions that are yanked (or yank-popped). Only
+modes that don't derive from `prog-mode' should be listed here.")
+
+(defvar yank-advised-indent-threshold 1000
+ "Threshold (# chars) over which indentation does not automatically occur.")
+
+(defun yank-advised-indent-function (beg end)
+ "Do indentation, as long as the region isn't too large."
+ (if (<= (- end beg) yank-advised-indent-threshold)
+ (indent-region beg end nil)))
+
+(defadvice yank (after yank-indent activate)
+ "If current mode is one of 'yank-indent-modes,
+indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (or (derived-mode-p 'prog-mode)
+ (member major-mode yank-indent-modes)))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+(defadvice yank-pop (after yank-pop-indent activate)
+ "If current mode is one of 'yank-indent-modes,
+indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (or (derived-mode-p 'prog-mode)
+ (member major-mode yank-indent-modes)))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+;; occur with isearch
+(define-key isearch-mode-map (kbd "C-o")
+ (lambda () (interactive)
+ (let ((case-fold-search isearch-case-fold-search))
+ (occur (if isearch-regexp
+ isearch-string
+ (regexp-quote isearch-string))))))
+
+;; hippie expand match order
+(setq hippie-expand-try-functions-list '(try-expand-dabbrev
+ try-expand-dabbrev-all-buffers
+ try-expand-dabbrev-from-kill
+ try-complete-file-name-partially
+ try-complete-file-name
+ try-expand-all-abbrevs
+ try-expand-list
+ try-expand-line
+ try-complete-lisp-symbol-partially
+ try-complete-lisp-symbol))
+
+(provide 'config)
@@ -0,0 +1,15 @@
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(background-mode dark)
+ '(css-electric-keys (quote (125 59 0)))
+ '(css-indent-offset 2)
+ '(custom-safe-themes (quote ("b7553781f4a831d5af6545f7a5967eb002c8daeee688c5cbf33bf27936ec18b3" "baed08a10ff9393ce578c3ea3e8fd4f8c86e595463a882c55f3bd617df7e5a45" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1440d751f5ef51f9245f8910113daee99848e2c0" "485737acc3bedc0318a567f1c0f5e7ed2dfde3fb" "b0950b032aa3c8faab4864ae288296dd66b92eca" default))))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ )
Oops, something went wrong.

0 comments on commit b82d233

Please sign in to comment.