Created
April 15, 2013 06:32
-
-
Save windwiny/5386127 to your computer and use it in GitHub Desktop.
.emacs.d/init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; emacs configuration | |
(column-number-mode) | |
;; 所有的备份文件转移到~/backups目录下 | |
(setq backup-directory-alist (quote (("." . "/tmp")))) | |
(setq version-control t) | |
(setq kept-old-versions 2) | |
(setq kept-new-versions 5) | |
(setq delete-old-versions t) | |
(setq backup-directory-alist '(("." . "/tmp"))) | |
(setq backup-by-copying t) | |
;; Emacs 中,改变文件时,默认都会产生备份文件(以 ~ 结尾的文件)。可以完全去掉 | |
;; (并不可取),也可以制定备份的方式。这里采用的是,把所有的文件备份都放在一 | |
;; 个固定的地方("~/var/tmp")。对于每个备份文件,保留最原始的两个版本和最新的 | |
;; 五个版本。并且备份的时候,备份文件是复本,而不是原件。 | |
;;不产生备份文件 | |
(setq make-backup-files nil) | |
;; ---------------------------------------------------------------------- | |
(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-18") | |
(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) | |
(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/crazycode/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))) | |
)) | |
(el-get 'sync) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment