Skip to content

Instantly share code, notes, and snippets.

@joshuamiller
Created March 16, 2011 19:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuamiller/873111 to your computer and use it in GitHub Desktop.
Save joshuamiller/873111 to your computer and use it in GitHub Desktop.
(setq mac-option-key-is-meta nil)
(setq mac-command-key-is-meta t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier nil)
;; via http://www.viget.com/extend/emacs-24-rails-development-environment-from-scratch-to-productive-in-5-minu/
;; emacs configuration
(push "/usr/local/bin" exec-path)
(add-to-list 'load-path "~/.emacs.d")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
(fset 'yes-or-no-p 'y-or-n-p)
(delete-selection-mode t)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(blink-cursor-mode t)
(show-paren-mode t)
(column-number-mode t)
(set-fringe-style -1)
(tooltip-mode -1)
(set-frame-font "Menlo-14")
(load-theme 'tango-dark)
(defun ruby-mode-hook ()
(autoload 'ruby-mode "ruby-mode" nil t)
(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
(add-hook 'ruby-mode-hook '(lambda ()
(setq ruby-deep-arglist t)
(setq ruby-deep-indent-paren nil)
(setq c-tab-always-indent nil)
(require 'inf-ruby)
(require 'ruby-compilation)
(define-key ruby-mode-map (kbd "M-r" 'run-rails-test-or-ruby-buffer)))))
(defun rhtml-mode-hook ()
(autoload 'rhtml-mode "rhtml-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.erb\\'" . rhtml-mode))
(add-to-list 'auto-mode-alist '("\\.rjs\\'" . rhtml-mode))
(add-hook 'rhtml-mode '(lambda ()
(define-key rhtml-mode-map (kbd "M-s") 'save-buffer))))
(defun yaml-mode-hook ()
(autoload 'yaml-mode "yaml-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode)))
(defun css-mode-hook ()
(autoload 'css-mode "css-mode" nil t)
(add-hook 'css-mode-hook '(lambda ()
(setq css-indent-level 2)
(setq css-indent-offset 2))))
(defun is-rails-project ()
(when (textmate-project-root)
(file-exists-p (expand-file-name "config/environment.rb" (textmate-project-root)))))
(defun run-rails-test-or-ruby-buffer ()
(interactive)
(if (is-rails-project)
(let* ((path (buffer-file-name))
(filename (file-name-nondirectory path))
(test-path (expand-file-name "test" (textmate-project-root)))
(command (list ruby-compilation-executable "-I" test-path path)))
(pop-to-buffer (ruby-compilation-do filename command)))
(ruby-compilation-this-buffer)))
(require 'package)
(setq package-archives (cons '("tromey" . "http://tromey.com/elpa/") package-archives))
(package-initialize)
(global-set-key (kbd "S-<left>") 'windmove-left)
(global-set-key (kbd "S-<right>") 'windmove-right)
(global-set-key (kbd "S-<up>") 'windmove-up)
(global-set-key (kbd "S-<down>") 'windmove-down)
(global-set-key (kbd "C-t") 'textmate-goto-file)
(global-set-key (kbd "C-x g") 'magit-status)
; via Yegge http://sites.google.com/site/steveyegge2/effective-emacs
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
; use Racket as our Scheme
(setq scheme-program-name
"/usr/local/bin/racket")
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(require 'el-get)
(setq el-get-sources
'((:name ruby-mode
:type elpa
:load "ruby-mode.el"
:after (lambda () (ruby-mode-hook)))
(:name inf-ruby :type elpa)
(:name ruby-compilation :type elpa)
(:name css-mode
:type elpa
:after (lambda () (css-mode-hook)))
(:name textmate
:type git
:url "git://github.com/defunkt/textmate.el"
:load "textmate.el")
(:name rvm
:type git
:url "http://github.com/djwhitt/rvm.el.git"
:load "rvm.el"
:compile ("rvm.el")
:after (lambda() (rvm-use-default)))
(:name rhtml
:type git
:url "https://github.com/eschulte/rhtml.git"
:features rhtml-mode
:after (lambda () (rhtml-mode-hook)))
(:name yaml-mode
:type git
:url "http://github.com/yoshiki/yaml-mode.git"
:features yaml-mode
:after (lambda () (yaml-mode-hook)))
(:name haml-mode
:type git
:load "haml-mode.el"
:url "https://github.com/nex3/haml-mode.git")
(:name sass-mode
:type git
:load "sass-mode.el"
:url "https://github.com/nex3/sass-mode.git"
:after (lambda() (sass-mode-hook )))
(:name itsmagit
:type git
:load "magit.el"
:url "https://github.com/philjackson/magit.git")
(:name feature-mode
:type git
:load "feature-mode.el"
:url "https://github.com/michaelklishin/cucumber.el.git")
(:name rinari
:type git
:load "rinari.el"
:url "https://github.com/crazycode/rinari")
(:name gist
:type git
:load "gist.el"
:url "https://github.com/defunkt/gist.el.git")
))
(el-get 'sync)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment