Skip to content

Instantly share code, notes, and snippets.

@anthonator
Last active September 30, 2015 23:38
Show Gist options
  • Save anthonator/1881191 to your computer and use it in GitHub Desktop.
Save anthonator/1881191 to your computer and use it in GitHub Desktop.
Emacs config for Rails dev
(push "/usr/local/git/bin" exec-path)
(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)
(setq linum-format "%d ")
(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)
(global-linum-mode t)
(require 'package)
(setq package-archives (cons '("tromey" . "http://tromey.com/elpa/") package-archives))
(package-initialize)
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(require 'el-get)
(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 '("Guardfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Bowerfile" . 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-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.jbuilder\\'" . 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))))
(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 haml-mode-hook ()
(autoload 'haml-mode "haml-mode" nil t)
(add-hook 'haml-mode-hook '(lambda ()
(setq indent-tabs-mode nil)
(define-key haml-mode-map "\C-m" 'newline-and-indent))))
(defun scss-mode-hook ()
(autoload 'scss-mode "scss-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.scss$" . scss-mode))
(setq scss-compile-at-save nil)
(setq css-indent-level 2)
(setq css-indent-offset 2))
(defun coffee-mode-hook ()
(autoload 'coffee-mode "coffee-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode)))
(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)
(: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)
(: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
:url "https://github.com/nex3/haml-mode"
:features haml-mode
:after (lambda () (haml-mode-hook)))
(:name scss-mode
:type git
:url "https://github.com/antonj/scss-mode.git"
:features scss-mode
:after (lambda () (scss-mode-hook)))
(:name coffee-mode
:type git
:url "https://github.com/defunkt/coffee-mode.git"
:features coffee-mode
:after (lambda () (coffee-mode-hook)))
))
(el-get 'sync)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment