-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_emacs_xw6600
140 lines (103 loc) · 4.27 KB
/
dot_emacs_xw6600
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
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(package-selected-packages
(quote
(go-mode ssass-mode yasnippet markdown-mode dockerfile-mode solarized-theme fill-column-indicator magit ruby-end sass-mode yaml-mode haml-mode)))
'(show-paren-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(require 'haml-mode)
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(require 'sass-mode)
;; highlight color is the same as background color, so you cannot see what you highlight
;; https://bugs.launchpad.net/ubuntu/+source/emacs24/+bug/1628707
(set-face-attribute 'region nil :background "#666" :foreground "#ffffff")
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.sass$" . ssass-mode))
;; Haml
(add-hook 'haml-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(define-key haml-mode-map "\C-m" 'newline-and-indent)))
;; Sass
(add-hook 'ssass-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)))
;; ruby mode auto indent
(add-hook 'ruby-mode-hook (lambda () (local-set-key "\r" 'newline-and-indent)))
;; YAML
;; (require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-hook 'yaml-mode-hook
'(lambda ()
(define-key yaml-mode-map "\C-m" 'newline-and-indent)))
;; -----------------------------------------------------------------------
;; Shift the selected region right if distance is postive, left if
;; negative
(defun shift-region (distance)
(let ((mark (mark)))
(save-excursion
(indent-rigidly (region-beginning) (region-end) distance)
(push-mark mark t t)
;; Tell the command loop not to deactivate the mark
;; for transient mark mode
(setq deactivate-mark nil))))
(defun shift-right ()
(interactive)
(shift-region 2))
(defun shift-left ()
(interactive)
(shift-region -2))
;; Bind (shift-right) and (shift-left) function to your favorite keys. I use
;; the following so that Ctrl-Shift-Right Arrow moves selected text one
;; column to the right, Ctrl-Shift-Left Arrow moves selected text one
;; column to the left:
(global-set-key [C-S-right] 'shift-right)
(global-set-key [C-S-left] 'shift-left)
;; -----------------------------------------------------------------------
(global-set-key [f5] 'rgrep)
(global-set-key [f6] 'comment-or-uncomment-region)
(global-set-key [f7] 'goto-line)
(global-set-key [f11] 'magit-status)
;; Surround region with "region".t
(fset 'surr-t
[?\M-x ?n ?a ?r ?r ?o tab ?r tab return ?\M-< ?\" ?\M-> ?\" ?. ?t ?\M-x ?w ?i ?d ?e ?n return])
(global-set-key [f8] 'surr-t)
(fset 'surr-q
[?\M-x ?n ?a ?r ?r ?o tab ?r tab return ?\M-< ?= right ?\" ?\M-> ?\" ?. ?t ?\M-x ?w ?i ?d ?e ?n return])
(global-set-key [f9] 'surr-q)
(setq custom-safe-themes t)
(load-theme 'solarized-light t)
(setq x-underline-at-descent-line t)
(setq solarized-use-less-bold t)
(global-linum-mode t)
;;(require 'fill-column-indicator)
;;(setq fci-rule-column 75)
;;(fci-mode t)
;; --------------------------------------------------------------------
(setq js-indent-level 2)
(setq tramp-default-method "ssh")
(customize-set-variable 'tramp-syntax 'simplified)