forked from sandbox/emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modes.el
191 lines (152 loc) · 6.89 KB
/
modes.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
;;========================================================================
;; nxhtml mode
;;========================================================================
;; (load "~/.emacs.d/plugins/nxhtml/autostart.el")
;; (load "~/.emacs.d/lisp/multi-mode.el")
;;========================================================================
;; yasnippets - this adds some auto completion commands for several
;; languages
;;========================================================================
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(require 'yasnippet_extensions)
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
;;========================================================================
;; php
;;========================================================================
;; (require 'php-mode)
;; (add-hook 'php-mode-hook
;; '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))
;; (setq auto-mode-alist (cons '("\\.php$" . php-mode) auto-mode-alist))
;;========================================================================
;; javascript
;;========================================================================
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
(autoload 'javascript-mode "javascript" nil t)
;;========================================================================
;; c sharp
;;========================================================================
(autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
(setq auto-mode-alist
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist))
;;========================================================================
;; shell-mode
;;========================================================================
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(setq ansi-term-color-vector
[unspecified "gray3" "light coral" "pale green" "khaki"
"RoyalBlue2" "MediumPurple1" "sky blue" "gray98"])
;;========================================================================
;; MATLAB
;;========================================================================
(autoload 'matlab-mode "~/.emacs.d/matlab.el" "Enter Matlab mode." t)
(autoload 'matlab-shell "~/.emacs.d/matlab.el" "Interactive Matlab mode." t)
;; matlab mode for matlab
(setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist))
(defun my-matlab-mode-hook ()
(setq matlab-function-indent t); if you want function bodies indented
(setq fill-column 76); where auto-fill should wrap
(font-lock-mode 1)
(turn-on-auto-fill)
(if (not running-xemacs)
(matlab-mode-hilit)))
(setq matlab-mode-hook 'my-matlab-mode-hook)
(defun my-matlab-shell-mode-hook ()
(setq matlab-function-indent t); if you want function bodies indented
(setq fill-column 76); where auto-fill should wrap
(font-lock-mode 1))
(setq matlab-shell-mode-hook 'my-matlab-shell-mode-hook)
;;========================================================================
;; R
;;========================================================================
(add-to-list 'load-path "~/.emacs.d/ess-5.10/lisp")
(require 'ess-site)
;;========================================================================
;; CSV
;;========================================================================
(require 'csv-mode)
(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode))
(autoload 'csv-mode "csv-mode"
"Major mode for editing comma-separated value files." t)
;;========================================================================
;; Markdown
;;========================================================================
(autoload 'markdown-mode "markdown-mode.el"
"Major mode for editing Markdown files" t)
(setq auto-mode-alist
(cons '("\\.md" . markdown-mode) auto-mode-alist))
(setq auto-mode-alist
(cons '("\\.markdown" . markdown-mode) auto-mode-alist))
;; ==============================================================================
;; MODE AUTOLOAD setup for extensions
;; ==============================================================================
;; processing mode
(setq auto-mode-alist (cons '("\\.pde$" . java-mode) auto-mode-alist))
;; flex mode for CS143 class
(setq auto-mode-alist (cons '("\\.lex$" . java-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.flex$" . c++-mode) auto-mode-alist))
;; figure out how to actually change the default using this for now.
(setq auto-mode-alist (cons '("\\.tex$" . latex-mode) auto-mode-alist))
;; figure out how to actually change the default using this for now.
(setq auto-mode-alist (cons '("\\.ru$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.gemspec$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("^Rakefile$" . ruby-mode) auto-mode-alist))
;; (setq auto-mode-alist (cons '("\\.erb$" . eruby-nxhtml-mumamo-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.erb$" . html-mode) auto-mode-alist))
;;
;; MODES FOR RUBY ON RAILS SHIT
;;
(require 'ruby-electric)
(add-to-list 'load-path "~/.emacs.d/lisp/rinari/util")
(autoload 'inf-ruby "inf-ruby" "Run an inferior Ruby process" t)
(autoload 'inf-ruby-keys "inf-ruby" "" t)
(eval-after-load 'ruby-mode
'(add-hook 'ruby-mode-hook 'inf-ruby-keys))
(add-hook 'ruby-mode-hook 'ruby-electric-mode)
;; (setq load-path (cons (expand-file-name "~/.emacs.d/rails-reloaded") load-path))
;; (require 'rails-autoload)
;;
;; BETTER GIT SUPPORT
;;
(require 'magit)
;;
;; textmate
;;
;; (add-to-list 'load-path "~/.emacs.d/vendor/textmate.el")
;; (require 'textmate)
;; (textmate-mode)
;; ==============================================================================
;; window management across sessions
;; ==============================================================================
(require 'switch-window)
(require 'windows)
(win:startup-with-window)
(autoload 'save-current-configuration "revive" "Save status" t)
(autoload 'resume "revive" "Resume Emacs" t)
(autoload 'wipe "revive" "Wipe Emacs" t)
;; testing out the ido mode
(ido-mode t)
(setq ido-enable-flex-matching t) ;; enable fuzzy matching
;;(setq grep-find-use-xargs t) ;; uses xargs in grep-find
;; (setq grep-find-use-xargs nil)
;; (cua-mode t)
(put 'dired-find-alternate-file 'disabled nil)
;;
;; Loading modes that didn't come default with emacs
;;
(defun viper-cua-region-fix()
(define-key viper-vi-global-user-map [backspace] 'backward-delete-char-untabify)
(define-key viper-vi-global-user-map "\C-d" 'delete-char)
(define-key viper-insert-global-user-map [backspace] 'backward-delete-char-untabify)
(define-key viper-insert-global-user-map "\C-d" 'delete-char)
(define-key viper-vi-global-user-map "\C-e" 'viper-goto-eol))
(eval-after-load 'viper '(viper-cua-region-fix))
(require 'vimpulse)
;;
;; Loading a wrap region to enclose text in parentheses and shit!
;;
(require 'wrap-region)
(wrap-region-global-mode)
;(require 'haml-mode)