forked from hbin/molokai-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.emacs
207 lines (96 loc) · 4.01 KB
/
.emacs
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
192
193
194
195
196
197
198
199
200
201
202
203
204
(global-linum-mode t)
(delete-selection-mode t)
(show-paren-mode t)
(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)
(setq-default indent-tab-mode nil)
(setq c-basic-offset 4)
(setq default-tab-width 4)
(global-hl-line-mode 1)
;;set windows undo and redo
;;(when (fboundp 'winner-mode)
(winner-mode 1)
(global-set-key (kbd "C-x 4 u") 'winner-undo)
(global-set-key (kbd "C-x 4 r") 'winner-redo)
;;)
;;fold
;;(hs-minor-mode t)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(global-set-key (kbd "C-c / -") 'hs-hide-all)
(global-set-key (kbd "C-c / =") 'hs-show-all)
(global-set-key (kbd "C-c , -") 'hs-hide-block)
(global-set-key (kbd "C-c , =") 'hs-show-block)
;;(require 'geiser)
(setq geiser-active-implementations '(racket))
(defun geiser-save ()
(interactive)
(geiser-repl--write-input-ring))
(defun smooth-scroll (increment)
(scroll-up increment) (sit-for 0.05)
(scroll-up increment) (sit-for 0.02)
(scroll-up increment) (sit-for 0.02)
(scroll-up increment) (sit-for 0.05)
(scroll-up increment) (sit-for 0.06)
(scroll-up increment))
(global-set-key [(mouse-5)] '(lambda () (interactive) (smooth-scroll 1)))
(global-set-key [(mouse-4)] '(lambda () (interactive) (smooth-scroll -1)))
(windmove-default-keybindings 'meta)
(setq ring-bell-function 'ignore)
;;set transparent effect
(global-set-key [(f11)] 'loop-alpha)
(setq alpha-list '((100 100) (95 65) (85 55) (75 45) (65 35)))
(defun loop-alpha ()
(interactive)
(let ((h (car alpha-list))) ;; head value will set to
((lambda (a ab)
(set-frame-parameter (selected-frame) 'alpha (list a ab))
(add-to-list 'default-frame-alist (cons 'alpha (list a ab)))
) (car h) (car (cdr h)))
(setq alpha-list (cdr (append alpha-list (list h))))
)
)
(defun onekey-compile ()
"Compile current buffer"
(interactive)
(let (filename suffix progname compiler)
(setq filename (file-name-nondirectory buffer-file-name))
(setq progname (file-name-sans-extension filename))
(setq suffix (file-name-extension filename))
(if (string= suffix "c") (setq compiler (concat "gcc -g -o " progname " ")))
;;(if (or (string= suffix "cc") (string= suffix "cpp")) (setq compiler (concat "g++ -Wall -Wextra -Wshadow -std=c++11 -g -o " progname " ")))
(if (or (string= suffix "cc") (string= suffix "cpp")) (setq compiler (concat "g++ -Wl,--stack=256000000 -std=c++11 -g -DLYC -o " progname " ")))
(if (string= suffix "tex") (setq compiler "latex "))
(if (string= suffix "java") (setq compiler "javac "))
(compile (concat compiler filename))))
(global-set-key (kbd "<f5>") 'onekey-compile)
;; Setting Chinese Font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
(font-spec :family "Microsoft Yahei" :size 11)))
;;themes' path
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(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.
'(custom-enabled-themes (quote (molokai)))
'(custom-safe-themes
(quote
("86e90834c45e0cb06b231f66f248504c7abe3bb9c9df8d2fec74fad6cab838da" "dfab391ba4b68e5d3986f179804e2481218cac00ffd832281319b9d757941e93" "07586969d22d7e92f595657cefeaf0fa9eee79bf48bc6935322a782c5d6d25ee" "25ed1d587f51389966b4bbe883b257a2f35289eb2791dcfc74624f8ee7804ad9" default)))
'(inhibit-startup-screen t)
'(menu-bar-mode nil)
'(nil nil t)
'(package-archives
(quote
(("melpa" . "http://melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/"))))
'(show-paren-mode t)
'(tool-bar-mode nil))
(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.
'(inhibit-startup-screen t))