-
Notifications
You must be signed in to change notification settings - Fork 1
/
misc-settings.el
191 lines (152 loc) · 4.75 KB
/
misc-settings.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
;;; -*- lexical-binding: t; use-package-always-ensure: t; -*-
;;; utf-8 because it's the 21st century
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;;; just a whole bunch of config vars
(setf
;; put stuff in .emacs.d
backup-directory-alist (list (cons "." (concat user-emacs-directory
"backups")))
;; flash for bell instead of making a noise
visible-bell t
ring-bell-function 'ignore
;; start in *scratch* instead of the logo
inhibit-startup-screen t
;; read-quoted-char in hex
read-quoted-char-radix 16
;; things which require no explanation
require-final-newline t
load-prefer-newer t
tab-stop-list (number-sequence 2 120 2)
compilation-scroll-output 'first-error
shell-command-dont-erase-buffer t
shell-command-prompt-show-cwd t)
(setq-default
;; 90-char lines
fill-column 90)
;;; reopen files with point in the place it was when closed
(use-package saveplace
:ensure nil
:config
(setf save-place-file (concat user-emacs-directory "places"))
(save-place-mode 1)
:demand t)
(use-package rx
:ensure nil
:demand t)
(use-package re-builder
:ensure nil
:after rx
:config (setf reb-re-syntax 'rx)
:demand t)
;;; garbage collect on focus-out
(defun gc-if-unfocused ()
(unless (cl-find t (mapcar #'frame-focus-state (frame-list)))
(garbage-collect)))
(if (string-version-lessp emacs-version "27.1")
(add-hook 'focus-out-hook #'gc-if-unfocused)
(add-function :after after-focus-change-function #'gc-if-unfocused))
;;; read the chars y or n instead of the strings yes or no
(fset 'yes-or-no-p 'y-or-n-p)
;;; as in modern oses, typing with a selection active replaces it
(delete-selection-mode 1)
(use-package dockerfile-mode
:mode "Dockerfile[^[:space:]]*")
;;; show column number in modeline
(column-number-mode 1)
;;; indent with spaces
(setq-default indent-tabs-mode nil)
(use-package tramp
:config (setf tramp-default-method "ssh")
:demand t)
(use-package flycheck
:demand t)
(use-package flyspell
:ensure nil
:demand t)
(use-package yaml-mode
:mode "\\.yml\\'")
;;; if multiple buffers have the same filename, add more of the full
;;; path to the beginning of the buffer name to disambiguate
(use-package uniquify
:ensure nil
:config (setf uniquify-buffer-name-style 'forward)
:demand t)
;;; display line numbers using the sexy high-performance c library
(use-package display-line-numbers
:ensure nil
:if (>= emacs-major-version 26)
:config
(setf display-line-numbers-grow-only t
display-line-numbers-width-start 4
display-line-numbers-width 4)
(global-display-line-numbers-mode)
:demand t)
;;; ag search
(use-package ag
:demand t)
;;; project(ile)
(use-package projectile
:config (projectile-mode)
:demand t)
(use-package counsel-projectile
:after (counsel projectile)
:config (counsel-projectile-mode)
:demand t)
;;; (ma)git
(use-package magit
:config (setf magit-completing-read-function 'ivy-completing-read)
:bind (("C-x g" . magit-status)
("C-x M-g" . magit-dispatch)))
(use-package magit-lfs
:after magit)
;;; rainbow-delims
(use-package rainbow-delimiters
:config (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
:demand t)
(use-package gnuplot
:demand t
:mode ("\\.gp\\'" . gnuplot-mode))
(use-package llvm-mode
:load-path "/usr/local/src/llvm/utils/emacs"
:mode "\\.llvm\\'")
(use-package unicode-fonts
:demand t
:config (unicode-fonts-setup))
;;; auto-save stuff
;; keep auto-save files in a subdir of .emacs.d, instead of next to their source files
(defvar auto-save-files-dir
(expand-file-name (concat user-emacs-directory "auto-saves/"))
"Parent directory in which to store auto-save files")
(setf auto-save-file-name-transforms `((".*" ,auto-save-files-dir t)))
;;; dired
;; command to use system `open'
(defvar open-shell-command
(cl-case system-type
('darwin "open")
('gnu/linux "xdg-open")))
(defun open-file (absolute-path)
(shell-command (format "%s \"%s\"" open-shell-command absolute-path)))
(defun dired-open-file-dwim ()
(interactive)
(dolist (file (dired-get-marked-files))
(open-file file)))
(use-package nix-mode
:ensure t
:demand t)
(define-key dired-mode-map (kbd "M-o") #'dired-open-file-dwim)
(push (expand-file-name "~/clockworklabs/SpacetimeDB/target/debug/")
exec-path)
(use-package direnv
:ensure t
:demand t
:config (direnv-mode))
(setf js-indent-level 2
typescript-indent-level 2)
;; I was having problems where `rustic' would hang or otherwise break
;; with the low default value of `max-lisp-eval-depth'.
;; This seems to go away when I set `max-lisp-eval-depth' to be suitably large.
(setf max-lisp-eval-depth 10000)
(provide 'misc-settings)