-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
1139 lines (873 loc) · 57.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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; <autoinstall> list the packages you want
; auto-package-update error: Package `emacs-24.4' is unavailable
(setq package-list '(undo-tree projectile multiple-cursors
auto-complete
company
company-irony
flycheck
flycheck-irony
irony
yasnippet
ido-completing-read+
exec-path-from-shell
highlight-parentheses smex
highlight-symbol
magit
dumb-jump
nlinum
linum-relative wttrin emmet-mode hydra
rainbow-delimiters ag dash s
smartparens
tide
feature-mode
dockerfile-mode ; dockerfile
yaml-mode ; yaml
zenburn-theme ; theme
smooth-scrolling ; window
window-numbering ; window
windresize ; window
helm ; helm
helm-ag ; helm
helm-dash ; helm
helm-projectile ; helm
company-irony-c-headers ; c
auto-package-update ; package
use-package ; package
gradle-mode ; java
groovy-mode ; java
meghanada ; java
elpy ; python
jedi ; python
eslint-fix ; javascript
js2-mode ; javascript
web-beautify ; javascript
web-mode ; javascript
xref-js2 ; javascript
go-autocomplete ; golang
go-eldoc ; golang
go-errcheck ; golang
go-mode ; golang
godoctor ; golang
paradox ghub))
; package-refresh-contents
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
; https://mirror.tuna.tsinghua.edu.cn/help/elpa/
; <autoinstall> list the repositories containing them
;; elpa
(require 'package)
; (add-to-list 'package-archives
; '("melpa-stable" . "http://stable.melpa.org/packages/") t)
; (add-to-list 'package-archives
; '("melpa-stable" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa-stable/") t)
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
(package-initialize)
; <autoinstall> fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
; <autoinstall> install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
;; This is only needed once, near the top of the file
(eval-when-compile
;; Following line is not needed if use-package.el is in ~/.emacs.d
; (add-to-list 'load-path "<path where use-package is installed>")
(require 'use-package))
; 更新 package
(auto-package-update-maybe) ; 定期自动更新所有 package
; paradox-upgrade-packages ; 手动更新所有 package
; auto-package-update-now ; 手动更新所有 package
; package-menu-mark-xxx ; 先标记,再做特殊处理
(require 'paradox)
(paradox-enable)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(add-to-list 'load-path "~/.emacs.d/mypackages")
(defalias 'yes-or-no-p 'y-or-n-p)
;; auto-complete
(ac-config-default)
(column-number-mode 1)
; (set-language-environment "UTF-8")
; (set-default-coding-systems 'utf-8)
; (set-buffer-file-coding-system 'utf-8-unix)
; (set-clipboard-coding-system 'utf-8-unix)
; (set-file-name-coding-system 'utf-8-unix)
; (set-keyboard-coding-system 'utf-8-unix)
; (set-next-selection-coding-system 'utf-8-unix)
; (set-selection-coding-system 'utf-8-unix)
; (set-terminal-coding-system 'utf-8-unix)
; (setq locale-coding-system 'utf-8)
; (prefer-coding-system 'utf-8)
(global-linum-mode 1) ; always show line numbers
(unless (display-graphic-p)
(defun fix-linum-color ()
(interactive)
(setq linum-format "%4d\u2502")
(set-face-attribute 'linum nil :foreground "white"))
(add-hook 'linum-mode-hook 'fix-linum-color)
)
; (global-nlinum-mode 1) ; always show line numbers
; (unless (display-graphic-p)
; (defun fix-nlinum-color ()
; (interactive)
; (setq nlinum-format "%4d\u2502")
; (set-face-attribute 'linum nil :foreground "white"))
; (add-hook 'nlinum-mode-hook 'fix-nlinum-color)
; )
; (add-hook 'eshell-mode-hook (lambda () (nlinum-mode -1)))
; (global-linum-mode 1) ; always show line numbers
; (require 'linum-relative)
; (linum-on)
; ; (linum-relative-on)
; (custom-set-faces '(linum-relative-current-face
; ((t :inherit linum :foreground "red" :background "white" :weight bold))))
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
; http://spacemacs.org/layers/+tools/dash/README.html
(add-to-list 'load-path "~/.emacs.d/mypackages/dash-at-point")
(autoload 'dash-at-point "dash-at-point"
"Search the word at point with Dash." t nil)
; (global-set-key "\C-cd" 'dash-at-point)
; (global-set-key "\C-ce" 'dash-at-point-with-docset)
; helm-dash-install-docset
; helm-dash-activate-docset
(setq helm-dash-browser-func 'eww)
(defun helm-dash-use-go-doc ()
(interactive)
(setq-local helm-dash-docsets '("Go")))
(add-hook 'go-mode-hook 'helm-dash-use-go-doc)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(require 'vline)
(require 'hl-line+)
(require 'col-highlight)
(require 'crosshairs)
; (crosshairs t) ; 显示行号有问题
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(add-to-list 'load-path "~/.emacs.d/mypackages/highlight-indent-guides")
(require 'highlight-indent-guides)
(setq highlight-indent-guides-auto-enabled nil)
(setq highlight-indent-guides-method 'character)
(setq highlight-indent-guides-auto-character-face-perc 20)
(set-face-foreground 'highlight-indent-guides-character-face "dimgray")
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; (if (display-graphic-p)
; (load-GUI-theme))
; (unless (display-graphic-p)
; (load-Terminal-theme))
; (add-to-list 'load-path "~/.emacs.d/mypackages/all-the-icons")
; (require 'all-the-icons)
; ; ; https://elpa.emacs-china.org/packages/all-the-icons/
; ; ; * Description: A library for inserting Developer icons
; ; ; * Home page: https://github.com/domtronn/all-the-icons.el
; ; ; * Versions: 2.5.2 (melpa-stable), 20170505.13 (melpa)
; ; ; * Dependencies: emacs-24.3, font-lock+-0, memoize-1.0.1
; ; ; https://elpa.emacs-china.org/packages/font-lock+/
; (require 'font-lock+)
; ; (add-to-list 'load-path "~/.emacs.d/mypackages/memoize")
; (require 'memoize)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; neotree
;; https://www.emacswiki.org/emacs/NeoTree
;; cd ~/.emacs.d/mypackages/
;; git clone https://github.com/jaypei/emacs-neotree.git neotree
(add-to-list 'load-path "~/.emacs.d/mypackages/neotree")
(require 'neotree)
(put 'erase-buffer 'disabled nil)
(neotree-toggle)
(global-set-key (kbd "<f8>") 'neotree-toggle)
; terminal 中的 color 问题
; (unless (display-graphic-p)
; (custom-set-faces
; '(col-highlight ((t (:background "color-233"))))
; '(hl-line ((t (:background "color-233"))))
; '(lazy-highlight ((t (:background "black" :foreground "white" :underline t))))
; '(neo-dir-link-face ((t (:foreground "cyan"))))
; '(neo-file-link-face ((t (:foreground "white")))))
; (custom-set-variables)
; )
(setq neo-window-fixed-size nil)
; (setq neo-theme (if (display-graphic-p) 'icons 'arrow))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
(defun jrh-isearch-with-region ()
"Use region as the isearch text."
(when mark-active
(let ((region (funcall region-extract-function nil)))
(deactivate-mark)
(isearch-push-state)
(isearch-yank-string region))))
(add-hook 'isearch-mode-hook #'jrh-isearch-with-region)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'multiple-cursors)
(global-set-key (kbd "M-n") 'mc/mark-next-like-this)
(global-set-key (kbd "M-p") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c m") 'mc/edit-lines)
(global-set-key (kbd "C-c a") 'mc/mark-all-like-this)
;; company
;; http://company-mode.github.io/
(add-hook 'after-init-hook 'global-company-mode)
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
; (setq recenter-positions '(middle top bottom))
(setq recenter-positions '(top bottom))
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; yasnippet
(require 'yasnippet)
(yas-global-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; c language
; https://www.emacswiki.org/emacs/ReformatBuffer
(defun indent-buffer ()
(interactive)
(save-excursion
(indent-region (point-min) (point-max) nil)))
(global-set-key (kbd "<f12>") 'indent-buffer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "C-c <left>") 'windmove-left)
(global-set-key (kbd "C-c <right>") 'windmove-right)
(global-set-key (kbd "C-c <up>") 'windmove-up)
(global-set-key (kbd "C-c <down>") 'windmove-down)
(setq windmove-wrap-around t)
(require 'window-numbering)
(window-numbering-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-undo-tree-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 关闭 emacs 启动时的页面
(setq inhibit-startup-message 1)
(setq gnus-inhibit-startup-message 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 自动保存
; https://www.emacswiki.org/emacs/AutoSave
(defconst emacs-tmp-dir (format "%s%s%s/" temporary-file-directory "emacs" (user-uid)))
(setq backup-directory-alist
`((".*" . ,emacs-tmp-dir)))
(setq auto-save-file-name-transforms
`((".*" ,emacs-tmp-dir t)))
(setq auto-save-list-file-prefix
emacs-tmp-dir)
; buffer 的 save 和 worte to disk 是有区别的
(setq auto-save-interval 5
auto-save-timeout 5)
(defun full-auto-save ()
(interactive)
(save-excursion
(dolist (buf (buffer-list))
(set-buffer buf)
(if (and (buffer-file-name) (buffer-modified-p))
(basic-save-buffer)))))
(add-hook 'auto-save-hook 'full-auto-save)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; semantic
; https://www.gnu.org/software/emacs/manual/semantic.html
(setq semantic-default-submodes '(
global-semanticdb-minor-mode
global-semantic-idle-scheduler-mode
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-decoration-mode
; global-semantic-highlight-func-mode
; global-semantic-stickyfunc-mode
global-semantic-mru-bookmark-mode))
(semantic-mode 1)
(global-set-key (kbd "C-c j") 'semantic-ia-fast-jump)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; cscope
; http://cscope.sourceforge.net
; 在项目根目录下运行 cscope-indexer -r
; 快捷键通过 f10 打开菜单看
(add-hook 'c-mode-common-hook
'(lambda ()
(require 'xcscope)))
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ; smooth-scrolling
; ; https://www.emacswiki.org/emacs/SmoothScrolling
; (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
; (setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
; (setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
; (setq scroll-step 1
; scroll-conservatively 10000)
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(require 'groovy-mode)
; (add-to-list 'auto-mode-alist '("\\.gradle\\'" . groovy-mode))
(require 'gradle-mode)
; (gradle-mode 1)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; web-mode ;
; http://web-mode.org/ ;
(require 'web-mode) ;
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)) ;
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) ;
;
;
;
; js2-mode ;
; http://xiaohanyu.me/oh-my-emacs/modules/ome-javascript.html#js2-mode ;
(require 'js2-mode) ;
(add-to-list 'auto-mode-alist '("\\.json$" . js2-mode)) ;
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) ;
(setq js2-mode-hook ;
'(lambda () (progn ;
(setq-default js2-basic-offset 2) ;
))) ;
;
;
;
; web-beautify ;
; https://github.com/yasuyk/web-beautify ;
; sublime 用的 https://github.com/victorporof/Sublime-HTMLPrettify ;
; 配置文件用的同一个 ~/.jsbeautifyrc ;
; sublime 换成 ESLint-Formatter 了 ;
(require 'web-beautify) ;; Not necessary if using ELPA package ;
(eval-after-load 'js2-mode ;
'(define-key js2-mode-map (kbd "C-c b") 'web-beautify-js)) ;
;; Or if you're using 'js-mode' (a.k.a 'javascript-mode') ;
(eval-after-load 'js ;
'(define-key js-mode-map (kbd "C-c b") 'web-beautify-js)) ;
;
(eval-after-load 'json-mode ;
'(define-key json-mode-map (kbd "C-c b") 'web-beautify-js)) ;
;
(eval-after-load 'sgml-mode ;
'(define-key html-mode-map (kbd "C-c b") 'web-beautify-html)) ;
;
(eval-after-load 'web-mode ;
'(define-key web-mode-map (kbd "C-c b") 'web-beautify-html)) ;
;
(eval-after-load 'css-mode ;
'(define-key css-mode-map (kbd "C-c b") 'web-beautify-css)) ;
;
;
;
;
(require 'xref-js2) ;
(define-key js2-mode-map (kbd "M-.") nil) ;
(add-hook 'js2-mode-hook (lambda () ;
(add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t))) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; https://github.com/smihica/emmet-mode ;
; emmet-mode ;
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes ;
(add-hook 'css-mode-hook 'emmet-mode) ;; enable Emmet's css abbreviation. ;
(global-set-key (kbd "C-c e") 'emmet-expand-line) ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
;; company is an optional dependency. You have to
;; install it separately via package-install
;; `M-x package-install [ret] company`
(company-mode +1))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
; python
; https://github.com/jorgenschaefer/elpy
(elpy-enable)
(add-hook 'elpy-mode-hook
(lambda ()
(semantic-mode 0)))
; https://tkf.github.io/emacs-jedi/latest/
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
; Install Python server
; M-x jedi:install-server in Emacs
(setq jedi:environment-root "python2_7")
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; 补全括号
(electric-pair-mode t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; highlight-parentheses
; https://www.emacswiki.org/emacs/HighlightParentheses
(require 'highlight-parentheses)
(define-globalized-minor-mode global-highlight-parentheses-mode
highlight-parentheses-mode
(lambda ()
(highlight-parentheses-mode t)))
(global-highlight-parentheses-mode t)
(unless (display-graphic-p)
(global-hl-line-mode 1)
(set-face-background 'hl-line "color-233")
; To keep syntax highlighting in the current line
(set-face-foreground 'highlight nil)
; selected text
(set-face-attribute 'region nil :background "#666" :foreground "#ffffff")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; clang-format
; http://clang.llvm.org/docs/ClangFormat.html#vim-integration
; http://releases.llvm.org/download.html
(load "~/.emacs.d/mypackages/clang-format.el")
; (global-set-key (kbd "C-c b") 'clang-format-region)
; (global-set-key (kbd "C-c b") 'clang-format-buffer)
(setq c-mode-hook
'(lambda () (progn
(global-set-key (kbd "C-c b") 'clang-format-buffer)
)))
(setq clang-format-style-option "llvm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; https://github.com/nonsequitur/smex
(require 'smex) ; Not needed if you use package.el
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
; when Smex is auto-initialized on its first run.
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ido-ubiquitous
;; https://github.com/DarwinAwardWinner/ido-ubiquitous
(ido-mode 1)
(ido-everywhere 1)
; (require 'ido-ubiquitous)
; (ido-ubiquitous-mode 1)
; ido-ubiquitous 换成 ido-completing-read+
(require 'ido-completing-read+)
(ido-ubiquitous-mode 1)
; 在 ubuntu 上,ido-yes-or-no 没安装成功
; (require 'ido-yes-or-no)
; (ido-yes-or-no-mode 1)
(require 'icomplete)
(icomplete-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ido-grid-mode
(add-to-list 'load-path "~/.emacs.d/mypackages/ido-grid-mode")
(require 'ido-grid-mode)
(ido-grid-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; helm
; 作用和 ido 差不多,但上手难
(require 'helm-config)
; (helm-mode 1)
; (global-set-key (kbd "M-x") #'helm-M-x)
(global-set-key (kbd "C-x C-f") #'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
(global-set-key (kbd "C-x b") 'helm-buffers-list)
(setq helm-ff-skip-boring-files t)
; (setq helm-ff-file-name-history-use-recentf t)
(setq helm-boring-file-regexp-list
'("\\.DS_Store" "\\.git$" "\\.hg$" "\\.svn$" "\\.CVS$" "\\._darcs$" "\\.la$" "\\.o$" "~$"
"\\.so$" "\\.a$" "\\.elc$" "\\.fas$" "\\.fasl$" "\\.pyc$" "\\.pyo$"))
; (setq helm-boring-buffer-regexp-list '("\\*Messages\\*" "\\*Help\\*" "\\*Shell Command Output" "\\*Flycheck error message" "\\*meghanada-" "\\*wttr.in - "))
(setq helm-boring-buffer-regexp-list '("\\*" "^[^.]*$"))
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
; (projectile-mode t)
(require 'helm-projectile)
(helm-projectile-on)
(global-set-key (kbd "C-c p h") 'helm-projectile)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
;; helm from https://github.com/emacs-helm/helm
(require 'helm)
;; Locate the helm-swoop folder to your path
(add-to-list 'load-path "~/.emacs.d/mypackages/helm-swoop")
(require 'helm-swoop)
;; Change the keybinds to whatever you like :)
(global-set-key (kbd "M-i") 'helm-swoop)
(global-set-key (kbd "M-I") 'helm-swoop-back-to-last-point)
(global-set-key (kbd "C-c M-i") 'helm-multi-swoop)
(global-set-key (kbd "C-x M-i") 'helm-multi-swoop-all)
;; Move up and down like isearch
(define-key helm-swoop-map (kbd "C-r") 'helm-previous-line)
(define-key helm-swoop-map (kbd "C-s") 'helm-next-line)
(define-key helm-multi-swoop-map (kbd "C-r") 'helm-previous-line)
(define-key helm-multi-swoop-map (kbd "C-s") 'helm-next-line)
;; Save buffer when helm-multi-swoop-edit complete
(setq helm-multi-swoop-edit-save t)
;; If this value is t, split window inside the current window
(setq helm-swoop-split-with-multiple-windows t)
;; Split direcion. 'split-window-vertically or 'split-window-horizontally
(setq helm-swoop-split-direction 'split-window-horizontally)
;; If nil, you can slightly boost invoke speed in exchange for text color
(setq helm-swoop-speed-or-color nil)
;; ;; Go to the opposite side of line from the end or beginning of line
(setq helm-swoop-move-to-line-cycle t)
;; Optional face for line numbers
;; Face name is `helm-swoop-line-number-face`
(setq helm-swoop-use-line-number-face t)
;; If you prefer fuzzy matching
(setq helm-swoop-use-fuzzy-match t)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(require 'ag)
(setq ag-highlight-search t)
(setq ag-arguments (append '("--before=1" "--after=1") ag-arguments))
; 或者 helm-ag
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ; https://www.emacswiki.org/emacs/AsmMode
; (defun my-asm-mode-hook ()
; ;; you can use `comment-dwim' (M-;) for this kind of behaviour anyway
; (local-unset-key (vector asm-comment-char))
; ;; asm-mode sets it locally to nil, to "stay closer to the old TAB behaviour".
; (setq tab-always-indent (default-value 'tab-always-indent)))
; (add-hook 'asm-mode-hook #'my-asm-mode-hook)
(setq-default indent-tabs-mode nil)
(defun go-mode-setup ()
(setq compile-command "go build -v && go test -v && go vet")
(define-key (current-local-map) "\C-c\C-c" 'compile)
(go-eldoc-setup)
(setq gofmt-command "goimports")
; (add-hook 'before-save-hook 'gofmt-before-save)
(global-set-key (kbd "C-c b") 'gofmt)
(local-set-key (kbd "C-c j") 'godef-jump))
(add-hook 'go-mode-hook 'go-mode-setup)
(require 'go-autocomplete)
(require 'auto-complete-config)
; 下面这个报错,why?
; (add-to-list 'yas-snippet-dirs "~/.emacs.d/mypackages/yasnippet-go")
; 下面这个报错,why?
; (use-package flycheck
; :ensure t
; :init (global-flycheck-mode))
(global-flycheck-mode)
(add-to-list 'load-path "~/.emacs.d/mypackages/disaster")
(require 'disaster)
; (define-key c-mode-base-map (kbd "C-c d") 'disaster)
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 鼠标滚动和点击
; https://gist.github.com/ftrain/8443721
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; enable visual feedback on selections
(setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs
(setq diff-switches "-u")
;; always end a file with a newline
;(setq require-final-newline 'query)
;;; uncomment for CJK utf-8 support for non-Asian users
;; (require 'un-define)
(require 'xt-mouse)
(xterm-mouse-mode)
(require 'mouse)
(xterm-mouse-mode t)
(defun track-mouse (e))
(setq mouse-wheel-follow-mouse 't)
(defvar alternating-scroll-down-next t)
(defvar alternating-scroll-up-next t)
(defun alternating-scroll-down-line ()
(interactive "@")
(when alternating-scroll-down-next
; (run-hook-with-args 'window-scroll-functions )
(scroll-down-line))
(setq alternating-scroll-down-next (not alternating-scroll-down-next)))
(defun alternating-scroll-up-line ()
(interactive "@")
(when alternating-scroll-up-next
; (run-hook-with-args 'window-scroll-functions)
(scroll-up-line))
(setq alternating-scroll-up-next (not alternating-scroll-up-next)))
(global-set-key (kbd "<mouse-4>") 'alternating-scroll-down-line)
(global-set-key (kbd "<mouse-5>") 'alternating-scroll-up-line)
; kills to the left
(global-set-key "\M-k" '(lambda () (interactive) (kill-line 0)))
; http://ergoemacs.org/emacs/whitespace-mode.html
; make whitespace-mode use just basic coloring
(setq whitespace-style (quote
; (spaces tabs space-mark tab-mark newline newline-mark)))
(spaces tabs space-mark tab-mark)))
(global-whitespace-mode 1)
; https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-09/msg00461.html
; (set-face-attribute 'whitespace-space nil :background nil :foreground "gray30")
; (set-face-background 'whitespace-space nil)
; (set-face-foreground 'whitespace-space "gray10")
; (set-face-background 'whitespace-newline nil)
; (set-face-foreground 'whitespace-newline "gray10")
(require 'grep)
(grep-apply-setting 'grep-find-command '("find . -type f ! -path \"*/\\.git/*\" ! -path \"*/node_modules/*\" ! -path \"*/components/*\" -exec grep -nH -C 2 -e '' {} +" . 112))
(grep-apply-setting 'grep-command "grep -nH -C 2 -e ")
; https://stackoverflow.com/questions/10867199/emacs-in-terminal-meta-arrow-keybindings
(add-hook 'term-setup-hook
'(lambda ()
(define-key function-key-map "\e[1;9A" [M-up])
(define-key function-key-map "\e[1;9B" [M-down])
(define-key function-key-map "\e[1;9C" [M-right])
(define-key function-key-map "\e[1;9D" [M-left])))
(defun move-line (n)
"Move the current line up or down by N lines."
(interactive "p")
(setq col (current-column))
(beginning-of-line) (setq start (point))
(end-of-line) (forward-char) (setq end (point))
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(insert line-text)
;; restore point to original column in moved line
(forward-line -1)
(forward-char col)))
(defun move-line-up (n)
"Move the current line up by N lines."
(interactive "p")
(move-line (if (null n) -1 (- n))))
(defun move-line-down (n)
"Move the current line down by N lines."
(interactive "p")
(move-line (if (null n) 1 n)))
(global-set-key (kbd "M-<up>") 'move-line-up)
(global-set-key (kbd "M-<down>") 'move-line-down)
(set-default 'truncate-lines t)
; To have emacs wordwrap OFF add:
; (setq-default truncate-lines 1)
; To have emacs word-wrap ON add:
; (setq-default truncate-lines 0)
(add-hook 'eshell-mode-hook
(lambda ()
(setq truncate-lines nil)))
(require 'goto-chg)
(global-set-key [(control ?.)] 'goto-last-change)
(global-set-key [(control ?,)] 'goto-last-change-reverse)
(add-to-list 'load-path "~/.emacs.d/mypackages/evil")
(require 'evil)
(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
(evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-quick-look)
(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
(evil-define-key 'normal neotree-mode-map (kbd "a") 'neotree-stretch-toggle)
(evil-define-key 'normal neotree-mode-map (kbd "r") 'neotree-refresh)
(evil-define-key 'normal neotree-mode-map (kbd "C-x C-f") #'helm-find-files)
(evil-mode 1)
(setq evil-default-state 'emacs)
(add-to-list 'load-path "~/.emacs.d/mypackages/powerline")
(require 'powerline)
; (powerline-default-theme)
(add-to-list 'load-path "~/.emacs.d/mypackages/airline-themes")
(require 'airline-themes)
(load-theme 'airline-light t)
; 好像很卡
; (add-to-list 'load-path "~/.emacs.d/mypackages/highlight-thing")
; (require 'highlight-thing)
; (global-highlight-thing-mode)
; http://rejeep.github.io/emacs/elisp/2010/03/11/duplicate-current-line-or-region-in-emacs.html
(defun duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated. However, if
there's a region, all lines that region covers will be duplicated."
(interactive "p")
(let (beg end (origin (point)))
(if (and mark-active (> (point) (mark)))
(exchange-point-and-mark))
(setq beg (line-beginning-position))
(if mark-active
(exchange-point-and-mark))
(setq end (line-end-position))
(let ((region (buffer-substring-no-properties beg end)))
(dotimes (i arg)
(goto-char end)
(newline)
(insert region)
(setq end (point)))
(goto-char (+ origin (* (length region) arg) arg)))))
(global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
(require 'org)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list "~/org/work.org"
"~/org/study.org"
"~/org/todo.org"
"~/org/home.org"))
; irony company-irony company-irony-c-headers flycheck-irony
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
(require 'dumb-jump)
(dumb-jump-mode)
(global-set-key (kbd "C-c g") 'dumb-jump-go)
(require 'smartparens-config)
(add-hook 'prog-mode-hook #'smartparens-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(add-to-list 'load-path (expand-file-name "~/.emacs.d/mypackages/origami/"))
(require 'origami)
; (global-origami-mode t)
(add-hook 'prog-mode-hook #'global-origami-mode)
(global-set-key [f2] 'origami-toggle-node)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(require 'highlight-symbol)
(add-hook 'prog-mode-hook #'highlight-symbol-mode)
(global-set-key [f3] 'highlight-symbol-prev)
(global-set-key [f4] 'highlight-symbol-next)
; (global-set-key [(control f3)] 'highlight-symbol)
; (global-set-key [(shift f3)] 'highlight-symbol-prev)
; (global-set-key [(meta f3)] 'highlight-symbol-query-replace)
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(require 'feature-mode)
(add-to-list 'auto-mode-alist '("\.feature$" . feature-mode))
; ↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥↥
; ↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧↧
(add-to-list 'load-path "~/.emacs.d/mypackages/google-styleguide")
(require 'google-c-style)
(use-package autodisass-java-bytecode
:ensure t
:defer t)
(use-package meghanada
:defer t
:init
(add-hook 'java-mode-hook
(lambda ()
(google-set-c-style)
(google-make-newline-indent)
(meghanada-mode t)
(global-set-key (kbd "C-c b") 'meghanada-code-beautify)))