-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.el
241 lines (202 loc) · 8.21 KB
/
config.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
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Anish Moorthy"
user-mail-address "[email protected]")
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
(setq doom-font (font-spec :family "monospace" :size 14))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-Iosvkem)
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c g k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c g d') to jump to their definition and see how
;; they are implemented.
;; Anish's Configuration ;;
;; Look idk what vc even does but it slows down tramp and causes errors in
;; magit forge https://github.com/magit/magit/issues/1274 so it's gone fs
(setq vc-handled-backends nil)
(setq auth-sources '("~/.authinfo.gpg"))
;; Relative line numbers, but I still never use them lol
(setq display-line-numbers-type 'relative)
;; Enable narrow-to-region by default
(put 'narrow-to-region 'disabled nil)
;; Enable the fill-column indicator everywhere
(global-display-fill-column-indicator-mode)
;; Maximize GUI on startup
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; Create a hook for lispy modes (emacs lisp, CL, clojure, etc)
;; lispy-mode-hook is an actual thing, so we just use "lispy-hook"
(defvar lispy-hook)
(add-hook 'lisp-mode-hook (lambda () (run-hooks 'lispy-hook)))
(add-hook 'emacs-lisp-mode-hook (lambda () (run-hooks 'lispy-hook)))
(add-hook 'sly-mrepl-mode-hook (lambda () (run-hooks 'lispy-hook)))
(add-hook 'lispy-hook (lambda () (setq fill-column 100)))
;; (add-hook 'lispy-hook #'hungry-delete-mode)
(add-hook 'lispy-hook #'aggressive-indent-mode)
(add-hook 'lispy-hook #'smartparens-strict-mode)
(add-hook 'lispy-hook #'evil-cleverparens-mode)
(defadvice projectile-project-root (around ignore-remote first activate)
(unless (file-remote-p default-directory) ad-do-it))
(load "~/.doom.d/keybindings.el")
(use-package company
:custom
(company-begin-commands '(self-insert-command))
(company-idle-delay .1)
(company-minimum-prefix-length 3)
(company-show-numbers t)
(company-tooltip-align-annotations 't)
(company-auto-complete-chars nil)
:bind (:map company-active-map
("TAB" . #'company-complete-selection)
("<tab>" . #'company-complete-selection)
("SPC" . nil)
("RET" . nil)
("<return>" . nil))
:config
(global-company-mode)
(use-package company-quickhelp
:defer t
:custom (company-quickhelp-delay 0))
;; I don't actually use coq these days, but wth
(use-package company-coq
:defer t
:custom (coq-compile-before-require t)
:config (load "~/.emacs.d/private/proof-general/generic/proof-site")))
(use-package counsel-projectile
:config
;; Make counsel-projectile-switch-project open a dired buffer instead
;; of immediately asking you to open a file in the project
;; https://github.com/ericdanan/counsel-projectile/issues/62#issuecomment-353732566
(counsel-projectile-modify-action
'counsel-projectile-switch-project-action
'((default counsel-projectile-switch-project-action-dired))))
(use-package evil-cleverparens
:after smartparens
:hook (lispy-mode . evil-cleverparens-mode))
(use-package hungry-delete
:custom (hungry-delete-join-reluctantly t))
;; Prefer clangd as C++ Language Server
(use-package lsp-clangd
:custom
(lsp-clients-clangd-args
'("-j=4"
"--background-index"
"--clang-tidy"
"--completion-style=detailed"
"--header-insertion=never"
"--header-insertion-decorators=0"))
:config
(set-lsp-priority! 'clangd 2))
(use-package magit
:custom
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
(magit-auto-revert-mode t)
(git-rebase-confirm-cancel nil))
(use-package org
:custom
(org-directory "~/.org")
(org-agenda-window-setup 'only-window))
(use-package python
:custom
(python-indent-offset 4))
(use-package shackle
:custom (shackle-rules
'((shell-mode :same t :inhibit-window-quit t)))
:config
(shackle-mode))
(use-package sly
:custom
(inferior-lisp-program "sbcl")
(sly-complete-symbol-function 'sly-flex-completions)
(sly-compile-file-options '(:fasl-directory "/tmp/"))
:config
;; I don't like popups, which Doom puts sly into by default
;; See ~/.emacs.d/modules/lang/common-lisp/config.el for the list of things to
;; override
(set-popup-rules!
(mapcar (lambda (regex) (list regex :ignore t))
'("^\\*sly-mrepl" "^\\*sly-compilation" "^\\*sly-traces"
"^\\*sly-description" "^\\*sly-\\(?:db\\|inspector\\)"))))
;; (use-package rust-mode
;; :config
;; (push "~/.cargo/bin/cargo" exec-path))
(use-package smartparens
:hook (lispy-mode . turn-on-smartparens-strict-mode))
(use-package vterm
:hook (vterm-mode . (lambda () (setq show-trailing-whitespace nil))))
(use-package ws-butler
:config (ws-butler-global-mode))
(use-package! window-purpose
:custom
(purpose-layout-dirs '("~/.doom.d/layouts/"))
;; Although the package suggests using add-to-list, default value is nil
(purpose-mode-user-purposes '((rustic-mode . rust-1)
(rustic-compilation-mode . rust-3)))
:config
(purpose-compile-user-configuration))
(use-package yasnippet
:custom (yas-snippet-dirs '("~/.doom.d/snippets/")))
(defun copy-whole-buffer-to-clipboard ()
"Copy entire buffer to clipboard"
(interactive)
(clipboard-kill-ring-save (point-min) (point-max)))
(defun load-local-file (filename)
"Loads ~/.doom.d.local/filename if the file exists"
(let ((full-name (concat (file-name-as-directory "~/.doom.d.local/")
filename)))
(when (file-exists-p full-name)
(load full-name))))
(load-local-file "init.el")
(add-to-list 'purpose-user-mode-purposes '(rustic-mode . rust-1))
(add-to-list 'purpose-user-mode-purposes '(rustic-compilation-mode . rust-3))
(require 'window-purpose-x)
(purpose-compile-user-configuration)
;; (purpose-mode)
;; Stolen from coldnew/linux-kernel-coding-style.el on github, installing the package doesn't work?
(defun linux-kernel-coding-style/setup ()
(let ((filename (buffer-file-name)))
;; Enable kernel mode for the appropriate files
(when (and filename
(or (locate-dominating-file filename "Kbuild")
(locate-dominating-file filename "Kconfig")
(save-excursion (goto-char 0)
(search-forward-regexp "^#include <linux/\\(module\\|kernel\\)\\.h>$" nil t))))
(setq indent-tabs-mode t)
(setq tab-width 8)
(setq c-basic-offset 8)
(c-set-style "linux-kernel")
(message "Setting up indentation for the linux kernel"))))
(use-package cc-mode
:hook (c-mode . linux-kernel-coding-style/setup))
(use-package whitespace
:custom
(whitespace-style '(face indentation tab-mark trailing))
(show-trailing-whitespace t)
;; Turn on global-whitespace-mode, otherwise doom-highlight-non-default-indentation-h sets its own
;; whitespace configuration for some reason.
:config (global-whitespace-mode +1))