Advertisement
Guest User

.emacs

a guest
Aug 28th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.06 KB | None | 0 0
  1. ;; emacs configuration
  2.  
  3. (push "/usr/local/bin" exec-path)
  4. (add-to-list 'load-path "~/.emacs.d/elpa")
  5.  
  6. (setq x-select-enable-clipboard t)
  7.  
  8.  
  9. (global-set-key (kbd "C-y") 'redo)
  10.  
  11. (global-set-key (kbd "<f2>") 'clipboard-kill-region)
  12. (global-set-key (kbd "<f3>") 'clipboard-kill-ring-save)
  13. (global-set-key (kbd "<f4>") 'yank)       ; paste
  14. (global-set-key (kbd "<f5>") 'undo)
  15. (global-set-key (kbd "<home>") 'move-beginning-of-line)
  16. (global-set-key (kbd "<end>") 'move-end-of-line)
  17.  
  18. ;;(global-set-key (kbd "C-z") 'undo)
  19. ;;(global-set-key (kbd "C-c") 'clipboard-kill-ring-save)
  20. ;;(global-set-key (kbd "C-v") 'yank)
  21. ;;(global-set-key (kbd "C-x") 'clipboard-kill-region)
  22. ;;(global-set-key (kbd "<C-f4>") 'yank-pop) ; paste previous
  23.  
  24. (setq make-backup-files nil)
  25. (setq auto-save-default nil)
  26. (setq-default tab-width 2)
  27. (setq-default indent-tabs-mode nil)
  28. (setq inhibit-startup-message t)
  29.  
  30. (fset 'yes-or-no-p 'y-or-n-p)
  31.  
  32. (delete-selection-mode t)
  33. (scroll-bar-mode -1)
  34. ;;(tool-bar-mode -1)
  35. (blink-cursor-mode t)
  36. (show-paren-mode t)
  37. (column-number-mode t)
  38. (set-fringe-style -1)
  39. (tooltip-mode -1)
  40.  
  41. (set-frame-font "Menlo-16")
  42. (load-theme 'tango)
  43.  
  44. (require 'package)
  45.  
  46. (package-initialize)
  47. (add-to-list
  48. 'package-archives
  49.  '("melpa" . "http://melpa.milkbox.net/packages/") t)
  50. (add-to-list
  51. 'package-archives
  52.  '("github" . "https://github.com/auto-complete/") t)
  53.  
  54.  
  55. (when (not package-archive-contents)
  56.  (package-refresh-contents))
  57. (setq url-http-attempt-keepalives nil)
  58.  
  59. ;;(add-to-list
  60. ;;  'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete-1.3.1/dict")
  61. ;;   (require 'auto-complete-config)
  62. ;;(ac-config-default)
  63.  
  64. (add-to-list 'load-path "~/.emacs.d")
  65.  
  66. (defun ruby-mode-hook ()
  67.   (autoload 'ruby-mode "ruby-mode" nil t)
  68.  (add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))
  69.  (add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
  70.  (add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
  71.  (add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))
  72.  (add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))
  73.  (add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))
  74.  (add-hook 'ruby-mode-hook '(lambda ()
  75.                    (setq ruby-deep-arglist t)
  76.                    (setq ruby-deep-indent-paren (setq load-path (cons "~/.emacs.d/elisp" load-path))
  77. (require 'auto-complete)
  78. (require 'auto-complete-config)
  79. (global-auto-complete-mode t)
  80. nil)
  81.                    (setq c-tab-always-indent nil)
  82.                    (require 'inf-ruby)
  83. (package-initialize)
  84. (setq url-http-attempt-keepalives nil)
  85.                    (require 'ruby-compilation)
  86.                    (define-key ruby-mode-map (kbd "M-r") 'run-rails-test-or-ruby-buffer))))
  87. (defun rhtml-mode-hook ()
  88.  (autoload 'rhtml-mode "rhtml-mode" nil t)
  89.  (add-to-list 'auto-mode-alist '("\\.erb\\'" . rhtml-mode))
  90.  (add-to-list 'auto-mode-alist '("\\.rjs\\'" . rhtml-mode))
  91.  (add-hook 'rhtml-mode '(lambda ()
  92.                (define-key rhtml-mode-map (kbd "M-s") 'save-buffer))))
  93.  
  94. (defun yaml-mode-hook ()
  95.  (autoload 'yaml-mode "yaml-mode" nil t)
  96.  (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
  97.  (add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode)))
  98.  
  99. (defun css-mode-hook ()
  100.  (autoload 'css-mode "css-mode" nil t)
  101.  (add-hook 'css-mode-hook '(lambda ()
  102.                   (setq css-indent-level 2)
  103.                   (setq css-indent-offset 2))))
  104. (defun is-rails-project ()
  105.  (when (textmate-project-root)
  106.    (file-exists-p (expand-file-name "config/environment.rb" (textmate-project-root)))))
  107. (global-set-key (kbd "C-z") 'undo)
  108.  
  109. (defun run-rails-test-or-ruby-buffer ()
  110.  (interactive)
  111.  (if (is-rails-project)
  112.      (let* ((path (buffer-file-name))
  113.          (filename (file-name-nondirectory path))
  114.          (test-path (expand-file-name "test" (textmate-project-root)))
  115.          (command (list ruby-compilation-executable "-I" test-path path)))
  116.     (pop-to-buffer (ruby-compilation-do filename command)))
  117.    (ruby-compilation-this-buffer)))
  118.  
  119. (require 'package)
  120. (setq package-archives (cons '("tromey" . "http://tromey.com/elpa/") package-archives))
  121. (package-initialize)
  122.  
  123. (add-to-list 'load-path "~/.emacs.d/el-get/el-get")
  124. (require 'el-get)
  125.  
  126. (add-to-list 'load-path (expand-file-name "~/.emacs.d/rails"))
  127. (require 'rails)
  128.  
  129. (setq el-get-sources
  130.      '((:name ruby-mode
  131.            :type elpa
  132.            :load "ruby-mode.el"
  133.            :after (lambda () (ruby-mode-hook)))
  134.     (:name inf-ruby :type elpa)
  135.     (:name ruby-compilation :type elpa)
  136.     (:name css-mode
  137.            :type elpa
  138.            :after (lambda () (css-mode-hook)))
  139.     (:name textmate
  140.            :type git
  141.            :url "git://github.com/defunkt/textmate.el"
  142.            :load "textmate.el")
  143.     (:name rvm
  144.            :type git
  145.            :url "http://github.com/djwhitt/rvm.el.git"
  146.            :load "rvm.el"
  147.            :compile ("rvm.el")
  148.            :after (lambda() (rvm-use-default)))
  149.     (:name rhtml
  150.            :type git
  151.            :url "https://github.com/crazycode/rhtml.git"
  152.            :features rhtml-mode
  153.            :after (lambda () (rhtml-mode-hook)))
  154.     (:name yaml-mode
  155.            :type git
  156.            :url "http://github.com/yoshiki/yaml-mode.git"
  157.            :features yaml-mode
  158.            :after (lambda () (yaml-mode-hook)))
  159.     ))
  160. (el-get 'sync)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement