-
Notifications
You must be signed in to change notification settings - Fork 1
/
rails.el
60 lines (40 loc) · 1.61 KB
/
rails.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(require 'rdoc-mode)
(setq auto-mode-alist (cons '("\\README$" . rdoc-mode) auto-mode-alist))
(require 'snippet)
(require 'find-recursive)
(require 'rails)
(add-hook 'ruby-mode-hook
(lambda()
(add-hook 'local-write-file-hooks
'(lambda()
(save-excursion
(untabify (point-min) (point-max))
(delete-trailing-whitespace)
)))
(set (make-local-variable 'indent-tabs-mode) 'nil)
(set (make-local-variable 'tab-width) 2)
(imenu-add-to-menubar "IMENU")
(require 'ruby-electric)
(ruby-electric-mode t)
(local-set-key "\t" 'hippie-expand)
;; for autotest
(define-key ruby-mode-map (kbd "C-c C-a") 'autotest-switch)
(define-key ruby-mode-map (kbd "C-c y") 'toggle-buffer)
))
;; for autotest
(require 'autotest)
(autoload 'autotest-switch "autotest" "doco" t)
(autoload 'autotest "autotest" "doco" t)
(require 'toggle)
;; (toggle-style "rspec")
;; disable new line syntax check
(global-set-key "\C-r" 'toggle-buffer)
(setq flymake-start-syntax-check-on-newline nil)
;; shortcut
(global-set-key "\M-m" 'rails-nav:goto-models)
(global-set-key "\M-c" 'rails-nav:goto-controllers)
(global-set-key "\M-l" 'rails-nav:goto-layouts)
(global-set-key "\M-j" 'rails-nav:goto-javascripts)
(global-set-key "\M-C" 'rails-model-layout:switch-to-controller)
(global-set-key "\M-H" 'rails-controller-layout:switch-to-helper)
(global-set-key "\M-M" 'rails-controller-layout:switch-to-model)