-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.el
executable file
·360 lines (270 loc) · 12.3 KB
/
init.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
;; 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.
;;; Code:
(package-initialize)
(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(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.
'(ansi-color-names-vector
["#3F3F3F" "#CC9393" "#7F9F7F" "#F0DFAF" "#8CD0D3" "#DC8CC3" "#93E0E3" "#DCDCCC"])
'(company-quickhelp-color-background "#4F4F4F")
'(company-quickhelp-color-foreground "#DCDCCC")
'(custom-safe-themes
(quote
("e03d2efd989b91f29ed5f91f160b0054031e6b6574950f7d64792a3acf0c9565" "ef0d2cd0b5ecebd6794a2012ffa08393e536b33e3e377ac2930bf5d7304dcb21" "83faf27892c7119f6016e3609f346d3dae3516dede8fd8a5940373d98f615b4e" "d9129a8d924c4254607b5ded46350d68cc00b6e38c39fc137c3cfb7506702c12" "d606ac41cdd7054841941455c0151c54f8bff7e4e050255dbd4ae4d60ab640c1" "f5512c02e0a6887e987a816918b7a684d558716262ac7ee2dd0437ab913eaec6" default)))
'(fci-rule-color "#383838")
'(nrepl-message-colors
(quote
("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
'(org-agenda-files
(quote
("~/.org/pythonCert.org" "~/.org/gtd.org" "~/.org/first.org")))
'(package-selected-packages
(quote
(nlinum-hl nlinum smartparens htmlize windresize elpy jedi magit flycheck evil yasnippet-snippets helm php-auto-yasnippets yasnippet sqlup-mode php-mode emmet-mode auto-complete dracula-theme labburn-theme foggy-night-theme ## zenburn-theme highlight-indent-guides w3 org org-plus-contrib)))
'(pdf-view-midnight-colors (quote ("#DCDCCC" . "#383838")))
'(vc-annotate-background "#2B2B2B")
'(vc-annotate-color-map
(quote
((20 . "#BC8383")
(40 . "#CC9393")
(60 . "#DFAF8F")
(80 . "#D0BF8F")
(100 . "#E0CF9F")
(120 . "#F0DFAF")
(140 . "#5F7F5F")
(160 . "#7F9F7F")
(180 . "#8FB28F")
(200 . "#9FC59F")
(220 . "#AFD8AF")
(240 . "#BFEBBF")
(260 . "#93E0E3")
(280 . "#6CA0A3")
(300 . "#7CB8BB")
(320 . "#8CD0D3")
(340 . "#94BFF3")
(360 . "#DC8CC3"))))
'(vc-annotate-very-old-color "#DC8CC3"))
(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.
)
;;To add MELPA
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Functionality;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
( global-auto-complete-mode t )
(ac-config-default)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ORG Mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-switchb)
;; latex config
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted)
(setq org-export-latex 'minted)
(setq org-src-fontify-natively t)
(setq org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)))
;; add easy template for python language
(add-to-list 'org-structure-template-alist '("p" "#+BEGIN_SRC python -n :results output pp replace :exports both\n?\n#+END_SRC"))
;; add easy template for imgae insertion
(add-to-list 'org-structure-template-alist '("img" "#+CAPTION: ?\n#+ATTR_LATEX: :width 330px\n[[./path/to/photo]]"))
;; add new page easy template
(add-to-list 'org-structure-template-alist '("n" "#+LATEX: \\newpage\n?"))
;; add whiteSpace easy template
(add-to-list 'org-structure-template-alist '("vs" "#+LATEX: \\vspace{10 mm}\n?"))
;; point to python3
(setq org-babel-python-command "python3")
;; stop asking confirmation for code eveluation
(setq org-confirm-babel-evaluate nil)
;; enable flyspell in org-mode
(add-hook 'org-mode-hook 'flyspell-mode)
(define-key global-map "\C-o" 'flyspell-auto-correct-previous-word)
;; to enable time stamp for TODO
(setq org-log-done t)
;; Change M-RET behaviour
(setq org-M-RET-may-split-line nil)
;; to enable note for TODO
;; (setq org-log-done 'note)
;; Enable indention
(setq org-startup-indented t)
;; enable tab on evil mode
(setq evil-want-C-i-jump nil)
;; define org-mode Capture default file
(setq org-default-notes-file (concat org-directory "/notes.org"))
;; define capture global key-map
(define-key global-map "\C-cc" 'org-capture)
;; defin todo and daily template
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "~/.org/gtd.org" "Tasks")
"* TODO %?\n %i\n %a")
("j" "Journal" entry (file+datetree "~/.org/journal.org")
"* %?\nEntered on %U\n %i\n %a")))
;; Set to the location of your Org files on your local system
(setq org-directory "~/.org")
;; Set to the name of the file where new notes will be stored
(setq org-mobile-inbox-for-pull "~/.org/flagged.org")
;; Set to <your Dropbox root directory>/MobileOrg.
(setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
;; define default agenda files
;; (setq org-agenda-files (list "~/.org/gtd.org"
;; "~/.org/journal.org"
;; "~/.org/first.org"))
;; Disable the splash screen (to enable it agin, replace the t with 0)
(setq inhibit-splash-screen t)
;; Enable transient mark mode
(transient-mark-mode 1)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (require 'ox-latex)
;; ;(add-to-list 'org-latex-packages-alist '("" "minted"))
;; (setq org-latex-listings 'minted)
;; (setq org-latex-pdf-process
;; '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
;; (require 'ox-latex)
;; (add-to-list 'org-latex-packages-alist '("" "minted"))
;; (setq org-latex-listings 'minted)
;; (setq org-latex-pdf-process
;; '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
;; (setq org-src-fontify-natively t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YASnippets;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(yas-global-mode 1)
(global-set-key (kbd "C-x y") 'yas/create-php-snippet)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Helm;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'helm-config)
(global-set-key (kbd "M-x") #'helm-M-x)
(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") #'helm-find-files)
(helm-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Emmet Mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; Auto-start on any markup modes
(add-hook 'sgml-mode-hook 'emmet-mode)
;; ;; enable Emmet's css abbreviation
(add-hook 'css-mode-hook 'emmet-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Evil mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; use Emacs keybindings when in insert
(require 'evil)
(evil-mode 1)
(setcdr evil-insert-state-map nil)
(define-key evil-insert-state-map [escape] 'evil-normal-state)
;; change mode-line color by evil state
(lexical-let ((default-color (cons (face-background 'mode-line)
(face-foreground 'mode-line))))
(add-hook 'post-command-hook
(lambda ()
(let ((color (cond ((minibufferp) default-color)
((evil-insert-state-p) '("#f4424b" . "#ffffff"))
((evil-emacs-state-p) '("#262626" . "#86ae86"))
((buffer-modified-p) '("#1771b9" . "#ffffff"))
(t default-color))))
(set-face-background 'mode-line (car color))
(set-face-foreground 'mode-line (cdr color))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SmartParens;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'smartparens-config)
(add-hook 'prog-mode-hook 'turn-on-smartparens-mode)
(add-hook 'markdown-mode-hook 'turn-on-smartparens-mode)
(add-hook 'org-mode-hook 'turn-on-smartparens-mode)
(global-set-key (kbd "C-M-a") 'sp-beginning-of-sexp)
(global-set-key (kbd "C-M-e") 'sp-end-of-sexp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Jedi Python mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Elpy Python mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(elpy-enable)
(setq python-shell-completion-native-enable nil)
;;(setq elpy-modules nil)
;;(setq python-python-command "/usr/local/Cellar/python/3.7.0/bin/python3")
;;change emacs python version
(setq python-shell-interpreter "/usr/local/Cellar/python/3.7.0/bin/python3")
(setq elpy-rpc-python-command "python3")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Flycheck mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-flycheck-mode 1)
(add-hook 'after-init-hook #'global-flycheck-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;magit mode;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "C-x g") 'magit-status)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Wind Move;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (fboundp 'windmove-default-keybindings)
(windmove-default-keybindings))
(define-key input-decode-map "\e[1;2A" [S-up])
(windmove-default-keybindings)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SQL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Capitalize keywords in SQL mode
(add-hook 'sql-mode-hook 'sqlup-mode)
;; Capitalize keywords in an interactive session (e.g. psql)
(add-hook 'sql-interactive-mode-hook 'sqlup-mode)
;; Set a global keyword to use sqlup on a region
(global-set-key (kbd "C-c u") 'sqlup-capitalize-keywords-in-region)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INTERFACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enable Line Number
;; (global-nlinum-mode 1)
;; (require 'nlinum-hl)
(global-display-line-numbers-mode t)
(setq display-line-numbers-width-start t)
;; after X amount of idle time flush windows to renew numbers
;; (run-with-idle-timer 5 t #'nlinum-hl-flush-window)
;; (run-with-idle-timer 30 t #'nlinum-hl-flush-all-windows)
;; Add Space after numbers
;; (setq nlinum-format "%d ")
;; Enable Mouse
(xterm-mouse-mode 1)
;; Add Line and space after numbers
;;(setq linum-format "%4d \u2502 ")
;; Enable foggy-night them
;; (load-theme 'foggy-night t)
;;Enable line Highlights
(global-hl-line-mode 1)
;;;;;Remap Split resize;;;;;;;;;;;;;
(global-set-key (kbd "<C-left>") 'shrink-window-horizontally)
(global-set-key (kbd "<C-right>") 'enlarge-window-horizontally)
;; (global-set-key (kbd "<C-up>") nil)
;; (global-set-key (kbd "<C-up>") 'shrink-window)
;; (global-set-key (kbd "<C-down>") nil)
;; (global-set-key (kbd "<C-down>") 'enlarge-window)
;;;;; ZENBUR Area ;;;;;;;;;;;;;
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'zenburn t)
;; use variable-pitch fonts for some headings and titles
(setq zenburn-use-variable-pitch t)
;; scale headings in org-mode
(setq zenburn-scale-org-headlines t)
;; scale headings in outline-mode
(setq zenburn-scale-outline-headlines t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enable and Configuration of highlight-indent-guides
(require 'highlight-indent-guides)
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
(add-hook 'text-mode-hook 'highlight-indent-guides-mode)
(setq highlight-indent-guides-method 'column)
(setq highlight-indent-guides-auto-enabled nil)
(set-face-background 'highlight-indent-guides-odd-face "darkgray")
(set-face-background 'highlight-indent-guides-even-face "dimgray")
(set-face-foreground 'highlight-indent-guides-character-face "dimgray")
;;(setq highlight-indent-guides-auto-enabled )
;;(setq highlight-indent-guides-auto-odd-face-perc 15)
;;(setq highlight-indent-guides-auto-even-face-perc 15)
;;(setq highlight-indent-guides-auto-character-face-perc 20)
;;; init.el ends here