-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
171 lines (142 loc) · 4.26 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
;; My emacs configuration
;; Author: Aldrin Mathew
;; FONT STYLING
(set-face-attribute 'default nil :font (if (eq 'system-type 'windows-nt)
"Iosevka NF"
"Iosevka Nerd Font"))
(set-face-attribute 'default nil :height 170)
;; PACKAGES
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/"))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(setq package-list
'(
ace-window
atom-one-dark-theme
clang-format
exec-path-from-shell
fountain-mode
go-mode
js2-mode
lsp-ui
lsp-ivy
lsp-treemacs
lsp-mode
magit
projectile
shell-pop
treemacs
treemacs-magit
tree-sitter
tree-sitter-hl
tree-sitter-langs
tree-sitter-query
wakatime-mode
which-key
)
)
(dolist (package package-list)
(when (and (not (package-installed-p package)) (assoc package package-archive-contents))
(package-install package)))
;; LOADS
(add-to-list 'load-path "~/.emacs.d/elisp")
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
;; CONFIGURATIONS
(server-start)
(setq line-number-mode t)
(setq column-number-mode t)
(global-display-line-numbers-mode)
(require 'projectile)
(setq projectile-indexing-method 'alien)
(require 'clang-format)
(setq clang-format-style "LLVM")
(add-hook 'c++-mode-hook (lambda () (add-hook 'before-save-hook 'clang-format-buffer)))
(exec-path-from-shell-initialize)
(require 'ace-window)
(global-set-key (kbd "M-o") 'ace-window)
(require 'treemacs)
(setq aw-ignored-buffers (delq 'treemacs-mode aw-ignored-buffers))
(add-hook 'emacs-startup-hook 'treemacs)
(with-eval-after-load 'treemacs
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action))
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 40)
(setq git-commit-cd-to-toplevel t)
(global-set-key (kbd "C-x C-r") 'recentf-open-files)
(require 'magit)
(global-set-key (kbd "M-g") 'magit)
(require 'tree-sitter)
(require 'tree-sitter-hl)
(require 'tree-sitter-langs)
(require 'tree-sitter-query)
(require 'fountain-mode)
(require 'shell-pop)
(custom-set-variables
'(shell-pop-term-shell "/bin/bash")
'(shell-pop-window-position "bottom")
'(shell-pop-universal-key "C-<return>")
'(shell-pop-autocd-to-working-dir t)
'(shell-pop-restore-window-configuration t)
'(shell-pop-cleanup-buffer-at-process-exit t))
(require 'wakatime-mode)
(global-wakatime-mode)
;; HOOKS
;; Shell mode
(add-hook 'shell-mode-hook (lambda ()
(local-set-key (kbd "M-l") 'erase-buffer)))
;; Startup
(custom-set-variables
'(initial-buffer-choice 'recentf-open-files))
;; C++
(add-hook 'c++-mode-hook 'lsp-mode)
(add-hook 'c++-mode-hook 'lsp-ui-mode)
(add-hook 'c++-mode-hook 'tree-sitter-hl-mode)
;; C
(add-hook 'c-mode-hook 'lsp-mode)
(add-hook 'c-mode-hook 'lsp-ui-mode)
(add-hook 'c-mode-hook 'tree-sitter-hl-mode)
;; Go
(add-hook 'go-mode-hook #'lsp-deferred)
(defun lsp-go-install-save-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
;;(add-hook 'go-mode-hook 'tree-sitter-hl-mode)
;; Javascript
(add-hook 'js-mode-hook 'lsp-mode)
(add-hook 'js-mode-hook 'lsp-ui-mode)
(add-hook 'js-mode-hook 'js2-minor-mode)
(add-hook 'js-mode-hook 'tree-sitter-hl-mode)
;; TypeScript
(add-hook 'ts-mode-hook 'lsp-mode)
(add-hook 'ts-mode-hook 'lsp-ui-mode)
(add-hook 'ts-mode-hook 'tree-sitter-hl-mode)
;; Rust
(add-hook 'rust-mode-hook 'lsp-mode)
(add-hook 'rust-mode-hook 'lsp-ui-mode)
(add-hook 'rust-mode-hook 'tree-sitter-hl-mode)
;; Dart
(add-hook 'dart-mode-hook 'lsp-mode)
(add-hook 'dart-mode-hook 'lsp-ui-mode)
(add-hook 'dart-mode-hook 'tree-sitter-hl-mode)
;; Fountain
;;(setq whitespace-space font-lock-comment-face)
(add-hook 'fountain-mode-hook (lambda ()
(setq-local face-remapping-alist '((default (:height 200) default)))
(setq-local whitespace-style
'(face tabs tab-mark))
(whitespace-mode)
))
;; THEMES
(load-theme 'atom-one-dark t)
;; (load-theme 'atom-dark t)
;; (load-theme 'kanagawa t)
;; (load-theme 'timu-spacegrey t)
;; (load-theme 'everforest-hard-dark t)
;; (load-theme 'almost-mono-black t)
;; (load-theme 'poet-dark-monochrome t)
;; (load-theme 'turbonight t)