~estraw/.emacs.d

ref: c72ecd5bd0c2e398a6527eaa752b82804a182fcd .emacs.d/modules/module-lang-general.el -rw-r--r-- 2.9 KiB
c72ecd5bEvan Straw Misc formatting and other changes 3 months ago
                                                                                
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
;; ---------------
;; Enable commands disabled by default
;; ---------------
(put 'downcase-region 'disabled nil)

;; ---------------
;; Generic LSP Configuration
;; ---------------
(use-package projectile
  :bind-keymap
  ("C-c p" . projectile-command-map))

(use-package neotree
  :commands (neotree))

(use-package lsp-mode
  :commands (lsp)
  :bind (:map lsp-mode-map
	      ("C-c C-r" . lsp-rename))
  :config
  (setq lsp-file-watch-threshold 3000)
  (use-package lsp-ui)
  (use-package hydra)
  (use-package company-lsp))

(use-package yasnippet
  :config
  (defun yas-commit-editmsg ()
    (when (string= (buffer-name) "COMMIT_EDITMSG")
      (yas-minor-mode-on)))
  :commands (yas-minor-mode)
  :hook ((prog-mode . yas-minor-mode)
	 (text-mode . yas-commit-editmsg)
	 (yas-minor-mode . yas-reload-all)))

(use-package company
  :commands (company-mode)
  :config
  (setq company-idle-delay 0.1)
  :hook (prog-mode . company-mode)
  :bind (:map company-active-map
	      ("M-n" . nil)
	      ("M-p" . nil)
	      ("C-n" . company-select-next)
	      ("C-p" . company-select-previous)))

(use-package company-quickhelp
  :after (company)
  :hook (prog-mode . company-quickhelp-mode))

(use-package smartparens
  :config
  (require 'smartparens-config)
  (smartparens-global-mode)
  (sp-with-modes '(java-mode c++-mode c-mode go-mode groovy-mode arduino-mode)
    (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
    (sp-local-pair "/**" "*/" :post-handlers '(("| " "SPC")
     										   (" ||\n[i]" "RET")))
	(sp-local-pair "'" "'"))
  (sp-with-modes '(css-mode js2-mode js-mode)
    (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
    (sp-local-pair "/**" "*/" :post-handlers '(("| " "SPC")
     										   (" ||\n[i]" "RET"))))
  (sp-with-modes '(tuareg-mode utop-mode)
    (sp-local-pair "(*" "*)" :post-handlers '(("| " "SPC")
											  (" ||\n[i]" "RET")))))

;; ---------------
;; Generic configuration for all languages
;; ---------------

;;*  (use-package column-enforce-mode
;;*    :commands (column-enforce-mode)
;;*    :ensure t
;;*    :config
;;*    (setq column-enforce-column 95)
;;*    :hook prog-mode)

(global-hl-line-mode)
(column-number-mode)

(use-package rainbow-delimiters
  :commands (rainbow-delimiters-mode)
  :hook (prog-mode . rainbow-delimiters-mode))

(use-package gradle-mode
  :ensure t
  :commands (gradle-mode)
  :hook prog-mode)

(add-hook 'prog-mode-hook
	  '(lambda ()
	     (linum-mode)
	     (auto-fill-mode)
	     (setq fill-column 95)
	     (display-fill-column-indicator-mode)))

(use-package realgud
  :commands (realgud:gdb))

(require 'ansi-color)
(defun colorize-compilation-buffer ()
  (toggle-read-only)
  (ansi-color-apply-on-region compilation-filter-start (point))
  (toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

(use-package flycheck
  :hook (prog-mode . flycheck-mode))

(provide 'module-lang-general)