···88Clone this repository:
991010```sh
1111-git clone https://tangled.org/nesv.ca/emacs.d ~/.emacs.d
1212-```
1313-1414-or if you prefer [jj]:
1515-1616-```sh
1717-jj git clone https://tangled.org/nesv.ca/emacs.d ~/.emacs.d
1111+git clone https://git.sr.ht/~nesv/emacs.d ~/.emacs.d
1812```
19132014The next time you start emacs(1), everything should be installed
2115automatically.
2222-2323-[jj]: https://docs.jj-vcs.dev/latest/
2424-
+76
early-init.el
···11+;;; early-init -- Early emacs initialization
22+;;; Commentary:
33+;;; Code:
44+55+(defvar nesv/tiling-window-manager-regexp "bspwm\\|herbstluftwm\\|i3\\|hyprland"
66+ "Regexp to match the name of tiling window managers.")
77+88+(defmacro nesv/with-desktop-session (&rest body)
99+ "Expand BODY if desktop is *not* a tiling window manager."
1010+ (declare (indent 0))
1111+ `(when-let ((session (getenv "DESKTOP_SESSION"))
1212+ ((not (string-match-p session nesv/tiling-window-manager-regexp))))
1313+ ,@body))
1414+1515+(defun nesv/add-to-list (list element)
1616+ "Add ELEMENT to LIST. A simplified version of ADD-TO-LIST."
1717+ (set list (cons element (symbol-value list))))
1818+1919+;; Set the window size on non-tiling window managers.
2020+;;
2121+;; INITIAL-FRAME-ALIST is the first frame that is produced when starting emacs.
2222+;; DEFAULT-FRAME-ALIST is all other frames.
2323+(nesv/with-desktop-session
2424+ (mapc
2525+ (lambda (var)
2626+ (nesv/add-to-list var '(width . (text-pixels . 800)))
2727+ (nesv/add-to-list var '(height . (text-pixels . 900)))
2828+ (nesv/add-to-list var '(scroll-bar-width . 10)))
2929+ '(default-frame-alist initial-frame-alist)))
3030+3131+(setq frame-resize-pixelwise t
3232+ frame-inhibit-implied-resize t
3333+ frame-title-format '("%b")
3434+ ring-bell-function 'ignore
3535+ use-dialog-box t
3636+ use-file-dialog nil
3737+ use-short-answers t
3838+ inhibit-splash-screen t
3939+ inhibit-startup-screen t
4040+ inhibit-x-resources t
4141+ inhibit-startup-echo-area-message user-login-name
4242+ inhibit-startup-buffer-menu t)
4343+4444+;; Disable useless graphical elements like the menu bar, the scroll bar, and
4545+;; the tool bar.
4646+(menu-bar-mode -1)
4747+(scroll-bar-mode -1)
4848+(tool-bar-mode -1)
4949+5050+;; Temporarily increase the garbage collection threshold.
5151+;; This should shave about 0.5s off startup time.
5252+(setq gc-cons-threshold most-positive-fixnum
5353+ gc-cons-percentage 0.5)
5454+5555+;; More startup optimizations.
5656+(defvar nesv/file-name-handler-alist file-name-handler-alist)
5757+(defvar nesv/vc-handled-backends vc-handled-backends)
5858+5959+(setq file-name-handler-alist nil
6060+ vc-handled-backends nil)
6161+6262+(add-hook 'emacs-startup-hook
6363+ (lambda ()
6464+ (setq gc-cons-threshold (* 1000 1000 8)
6565+ gc-cons-percentage 0.1
6666+ file-name-handler-alist nesv/file-name-handler-alist
6767+ vc-handled-backends nesv/vc-handled-backends)))
6868+6969+;; Name the default frame.
7070+(add-hook 'after-init-hook (lambda () (set-frame-name "nesv")))
7171+7272+;; Inititalize install packages early.
7373+(setq package-enable-at-startup t)
7474+7575+(provide 'early-init)
7676+;;; early-init.el ends here
+90-224
init.el
···22;;; Commentary:
33;;; Code:
4455+;; Define a new group for customizations.
66+;; This will basically allow someone else to use this configuration,
77+;; but tweak it to their own liking by setting custom vars.
88+(defgroup nesv-emacs nil
99+ "User options for nesv's Emacs.
1010+Put the customizations in a file called ~/.emacs.d/nesv-emacs-pre-custom.el."
1111+ :group 'file)
1212+1313+;; Load extras for minibuffer completion.
1414+(defcustom nesv-emacs-completion-extras t
1515+ "When non-nil, load extras for minibuffer completion (e.g. `consult', `embark')."
1616+ :group 'nesv-emacs
1717+ :type 'boolean)
1818+1919+;; User option to load extra stuff for tree-sitter.
2020+(defcustom nesv-emacs-tree-sitter-extras t
2121+ "When non-nil, load extras for tree-sitter integration (e.g. `expreg')."
2222+ :group 'nesv-emacs
2323+ :type 'boolean)
2424+2525+(defcustom nesv-emacs-load-which-key nil
2626+ "When non-nil, display keybinding hints after a short delay."
2727+ :group 'nesv-emacs
2828+ :type 'boolean)
2929+3030+(defcustom nesv-emacs-load-nerd-icons nil
3131+ "When non-nil, enable nerd icons."
3232+ :group 'nesv-emacs
3333+ :type 'boolean)
3434+3535+(defcustom nesv-emacs-load-theme 'ef
3636+ "Load the specified colour theme."
3737+ :group 'nesv-emacs
3838+ :type '(choice :tag "Theme to load" :value ef
3939+ (const :tag "`ef-themes'" ef)
4040+ (const :tag "`modus-themes'" modus)
4141+ (const :tag "Jonathan Blow style" naysayer)
4242+ (const :tag "Do not load a theme" nil)))
4343+4444+(defcustom nesv-emacs-font "Source Code Pro"
4545+ "Set the specific font face when loading Emacs in GUI mode."
4646+ :group 'nesv-emacs
4747+ :type '(choice :tag "Font to use" :value "Source Code Pro"
4848+ (const :tag "MonoLisa" "MonoLisa")
4949+ (const :tag "Berkeley Mono" "Berkeley Mono")))
5050+551;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
652;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
753;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
···5298 (global-set-key [f8] 'neotree-toggle)
5399 (if (display-graphic-p) (setq neo-theme 'icons) (setq neo-theme 'arrows)))
541005555-5656-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
5757-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
5858-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
5959-;; When running in GUI mode, load in our $PATH as though we were running from
6060-;; a terminal.
6161-(use-package exec-path-from-shell
6262- :ensure t
6363- :config
6464- (when (display-graphic-p)
6565- (exec-path-from-shell-initialize)))
6666-67101;; โโโโโโโโโโโโโโโโโโโโโโโโ
68102;; โโโโโโโโโโโโโโโโโโโโโโโโ
69103;; โโโโโโโโโโโโโโโโโโโโโโโโ
···72106 :config
73107 (direnv-mode))
741087575-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
7676-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
7777-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
7878-;; A recreation of Jonathan Blow's emacs theme.
7979-(use-package naysayer-theme
8080- :ensure t
8181- :config (load-theme 'naysayer t))
8282-;;
8383-;; EF-THEMES (https://protesilaos.com/emacs/ef-themes)
8484-;; (use-package ef-themes
8585-;; :ensure t
8686-;; :config
8787-;; (load-theme 'ef-duo-light t))
8888-;;
8989-;; MODUS THEMES (https://protesilaos.com/emacs/modus-themes)
9090-;; (use-package modus-themes
9191-;; :ensure t
9292-;; :config
9393-;; (load-theme 'modus-operandi t))
9494-95109;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
96110;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
97111;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
···107121(menu-bar-mode -1) ; Disable the menubar.
108122(tool-bar-mode -1) ; Disable the toolbar.
109123(setq ring-bell-function 'ignore) ; Disable the damn bell.
110110-(setq make-backup-files nil) ; Do not create backup files.
111124(setq auto-save-default nil) ; Disable auto save.
112125(global-auto-revert-mode t) ; Auto-reload buffers when the backing file on disk changes.
113126(global-hl-line-mode t) ; Highlight the current line.
···115128(setq column-number-mode t) ; Display column numbers.
116129(set-default 'truncate-lines t) ; Let long lines flow off-screen.
117130131131+;; Disable backup files, and lock files.
132132+(setq make-backup-files nil)
133133+(setq backup-inhibited nil)
134134+(setq create-lockfiles nil)
135135+136136+;; Silence native compilation (`nativecomp').
137137+(when (native-comp-available-p)
138138+ (setq native-comp-async-report-warnings-errors 'silent)
139139+ (setq native-compile-prune-cache t))
140140+141141+;; By default, Emacs writes persistent customizations to the end of the user's
142142+;; init.el.
143143+;; Disable it.
144144+(setq custom-file (make-temp-file "emacs-custom-"))
145145+118146;; Draw a ruler at the 80-character column.
119147(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
120148(add-hook 'text-mode-hook #'display-fill-column-indicator-mode)
···123151(setq-default fill-column 80)
124152(add-hook 'text-mode-hook #'auto-fill-mode)
125153126126-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
127127-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
128128-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
129129-(when (display-graphic-p)
130130- ;; Disable the scroll bar.
131131- (scroll-bar-mode -1)
132132-133133- ;; Set the default window width, height, and font.
134134- (add-to-list 'default-frame-alist '(width . 200))
135135- (add-to-list 'default-frame-alist '(height . 60))
136136- (add-to-list 'default-frame-alist '(font . "MonoLisa-11")))
137137-138138-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
139139-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
140140-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
141141-(use-package flycheck
142142- :ensure t
143143- :init (global-flycheck-mode))
144144-145145-;; โโโโโโโโโโโโโโโโโโโโ
146146-;; โโโโโโโโโโโโโโโโโโโโ
147147-;; โโโโโโโโโโโโโโโโโโโโ
148148-(use-package eglot
149149- :ensure t)
150150-151151-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
152152-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
153153-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
154154-(use-package nerd-icons
155155- :ensure t)
156156-157157-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
158158-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
159159-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
160160-(setq-default mono-lisa-v2-ligatures '(;; coding ligatures
161161- "<!---" "--->" "|||>" "<!--" "<|||" "<==>" "-->" "->>" "-<<" "..=" "!=="
162162- "#_(" "/==" "||>" "||=" "|->" "===" "==>" "=>>" "=<<" "=/=" ">->" ">=>"
163163- ">>-" ">>=" "<--" "<->" "<-<" "<||" "<|>" "<=" "<==" "<=>" "<=<" "<<-"
164164- "<<=" "<~>" "<~~" "~~>" ">&-" "<&-" "&>>" "&>" "->" "-<" "-~" ".=" "!="
165165- "#_" "/=" "|=" "|>" "==" "=>" ">-" ">=" "<-" "<|" "<~" "~-" "~@" "~="
166166- "~>" "~~"
167167- ;; whitespace ligatures
168168- "---" "'''" "\"\"\"" "..." "..<" "{|" "[|" ".?" "::" ":::" "::=" ":="
169169- ":>" ":<" "\;\;" "!!" "!!." "!!!" "?." "?:" "??" "?=" "**" "***" "*>"
170170- "*/" "--" "#:" "#!" "#?" "##" "###" "####" "#=" "/*" "/>" "//" "/**"
171171- "///" "$(" ">&" "<&" "&&" "|}" "|]" "$>" ".." "++" "+++" "+>" "=:="
172172- "=!=" ">:" ">>" ">>>" "<:" "<*" "<*>" "<$" "<$>" "<+" "<+>" "<>" "<<"
173173- "<<<" "</" "</>" "^=" "%%")
174174- berkeley-mono-ligatures '(;; Group A
175175- ".." ".=" "..." "..<" "::" ":::" ":=" "::=" ";;" ";;;" "??" "???"
176176- ".?" "?." ":?" "?:" "?=" "**" "***" "/*" "*/" "/**"
177177- ;; Group B
178178- "<-" "->" "-<" ">-" "<--" "-->" "<<-" "->>" "-<<" ">>-" "<-<" ">->"
179179- "<-|" "|->" "-|" "|-" "||-" "<!--" "<#--" "<=" "=>" ">=" "<==" "==>"
180180- "<<=" "=>>" "=<<" ">>=" "<=<" ">=>" "<=|" "|=>" "<=>" "<==>" "||="
181181- "|=" "//=" "/="
182182- ;; Group C
183183- "<<" ">>" "<<<" ">>>" "<>" "<$" "$>" "<$>" "<+" "+>" "<+>" "<:" ":<"
184184- "<:<" ">:" ":>" "<~" "~>" "<~>" "<<~" "<~~" "~~>" "~~" "<|" "|>"
185185- "<|>" "<||" "||>" "<|||" "|||>" "</" "/>" "</>" "<*" "*>" "<*>" ":?>"
186186- ;; Group D
187187- "#(" "#{" "#[" "]#" "#!" "#?" "#=" "#_" "#_(" "##" "###" "####"
188188- ;; Group E
189189- "[|" "|]" "[<" ">]" "{!!" "!!}" "{|" "|}" "{{" "}}" "{{--" "--}}"
190190- "{!--" "//" "///" "!!"
191191- ;; Group F
192192- "www" "@_" "&&" "&&&" "&=" "~@" "++" "+++" "/\\" "\\/" "_|_" "||"
193193- ;; Group G
194194- "=:" "=:=" "=!=" "==" "===" "=/=" "=~" "~-" "^=" "__" "!=" "!==" "-~"
195195- "--" "---"))
154154+;; Enable these commands.
155155+(mapc
156156+ (lambda (command) (put command 'disabled nil))
157157+ '(list-timers narrow-to-region narrow-to-page upcase-region downcase-region))
196158197197-(use-package ligature
198198- :ensure t
199199- :config (when (display-graphic-p)
200200- (ligature-set-ligatures 'prog-mode mono-lisa-v2-ligatures)
201201- (global-ligature-mode t)))
159159+;; Disable these commands.
160160+(mapc
161161+ (lambda (command) (put command 'disabled t))
162162+ '(eshell project-eshell overwrite-mode iconify-frame diary))
202163203203-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
204204-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
205205-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
206206-(use-package magit
207207- :ensure t
208208- :hook (after-save-hook . magit-after-save-refresh-status))
164164+;; Always start with the *scratch* buffer.
165165+(setq initial-buffer-choice t)
209166210210-;; โโโโโโโโ
211211-;; โโโโโโโโ
212212-;; โโโโโโโโ
213213-(use-package jjdescription
214214- :ensure t)
167167+;; By default, Emacs inserts tabs in place of multiple spaces when formatting
168168+;; a region.
169169+;; Turn this off.
170170+(setq-default indent-tabs-mode nil)
215171216216-(use-package vc-jj
217217- :ensure t)
172172+;; Add directories containing my custom `.el' files to Emacs' load-path.
173173+(mapc
174174+ (lambda (string) (add-to-list 'load-path (locate-user-emacs-file string)))
175175+ '("nesv"))
218176219219-;; Git Gutter -- Shows git status in the sidebar
220220-(use-package git-gutter
221221- :ensure t
222222- :hook (prog-mode . git-gutter-mode)
223223- :config
224224- (setq git-gutter:update-interval 0.2))
225225-(use-package git-gutter-fringe
226226- :ensure t
227227- :config
228228- (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated))
229229- (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated))
230230- (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom))
231231-232232-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
233233-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
234234-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
235235-;; ...because it's pretty cool.
236236-(use-package tree-sitter
237237- :ensure t)
238238-(use-package tree-sitter-langs
239239- :ensure t
240240- :hook (tree-sitter-after-on-hook . tree-sitter-hl-mode)
241241- :config
242242- (global-tree-sitter-mode))
243243-244244-;; indent-mode helps with indenting, moving around, and acting on
245245-;; whitespace-sensitive code, like YAML and Python.
246246-(use-package indent-tools
247247- :ensure t)
248248-249249-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
250250-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
251251-;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
252252-;; Bazel, Starlark, Tilt, etc.
253253-(use-package bazel :ensure t
254254- :mode ("Tiltfile.\\'" . bazel-mode))
255255-256256-;; CUE -- https://cuelang.org
257257-(use-package cue-mode :ensure t)
258258-259259-(use-package dockerfile-mode :ensure t)
260260-261261-(use-package go-mode
262262- :ensure t
263263- :hook ((go-mode . lsp-deferred)
264264- (before-save . gofmt-before-save))
265265- :config
266266- (setq gofmt-command "~/go/bin/gofumpt"))
267267-268268-;; HashiCorp Configuration Language
269269-(use-package hcl-mode :ensure t)
270270-(use-package terraform-mode
271271- :ensure t
272272- :hook (terraform-mode . outline-minor-mode))
273273-274274-;; Just -- https://just.systems
275275-(use-package just-mode :ensure t)
276276-277277-(use-package markdown-mode
278278- :ensure t
279279- :mode ("README\\.md\\'" . gfm-mode)
280280- :hook (markdown-mode . auto-fill-mode)
281281- :init (setq markdown-command "multimarkdown"))
282282-283283-(use-package protobuf-mode :ensure t)
284284-285285-(use-package rust-mode
286286- :ensure t
287287- :hook (rust-mode-hook . eglot-ensure)
288288- :init
289289- (add-hook 'rust-mode-hook (lambda () (setq indent-tabs-mode nil)))
290290- :config
291291- (setq rust-format-on-save t))
292292-293293-(use-package yaml-mode :ensure t)
294294-(use-package flycheck-yamllint :ensure t)
295295-296296-;; Zig -- https://ziglang.org
297297-(use-package zig-mode :ensure t)
177177+(require 'nesv-theme)
178178+(require 'nesv-cursor)
179179+(require 'nesv-fonts)
180180+(require 'nesv-which-key)
181181+(require 'nesv-tree-sitter)
182182+(require 'nesv-lsp)
183183+(require 'nesv-programming)
184184+(when nesv-emacs-load-nerd-icons
185185+ (require 'nesv-icons))
186186+(require 'nesv-slime)
187187+(require 'nesv-gnus)
298188299189;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
300190;; โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
···316206;;
317207;; (which-key-add-keymap-based-replacements nesv-prefix-map
318208;; "b" `("Buffer" . ,nesv-buffer-prefix-map))
319319-320320-;; โโโโโโโโโโโโโโโโโโโโ
321321-;; โโโโโโโโโโโโโโโโโโโโ
322322-;; โโโโโโโโโโโโโโโโโโโโ
323323-(setq inferior-lisp-program "sbcl")
324209325210(provide 'init)
326211;;; init.el ends here
327327-328328-(custom-set-variables
329329- ;; custom-set-variables was added by Custom.
330330- ;; If you edit it by hand, you could mess it up, so be careful.
331331- ;; Your init file should contain only one such instance.
332332- ;; If there is more than one, they won't work right.
333333- '(package-selected-packages
334334- '(all-the-icons bazel cue-mode direnv dockerfile-mode exec-path-from-shell
335335- flycheck-yamllint git-gutter-fringe go-mode indent-tools
336336- jjdescription just-mode ligature magit markdown-mode
337337- naysayer-theme neotree nerd-icons protobuf-mode rust-mode
338338- solaire-mode terraform-mode tree-sitter-langs yaml-mode
339339- zig-mode)))
340340-(custom-set-faces
341341- ;; custom-set-faces was added by Custom.
342342- ;; If you edit it by hand, you could mess it up, so be careful.
343343- ;; Your init file should contain only one such instance.
344344- ;; If there is more than one, they won't work right.
345345- )