My personal emacs configuration.
- Clean up the mess that is my config.
- Eliminate the need for modifier keys. I should be able to do everything without the use of Ctrl
- Add key bind to traverse up in
vertico
while finding a file. - Change terminal to one that works well with
god-mode
.
Inspired by this blog post. Adds lexical scope to the configuration.
;; -*- coding: utf-8; lexical-binding: t -*-
Different functions to do common tasks.
; A function I can hook to different modes when I don't want line numbers.
(defun mjalen/remove_line_numbers ()
(interactive)
(display-line-numbers-mode 0))
Get rid of a bunch of UI, we don’t need it!
(setq inhibit-startup-screen t
use-package-always-ensure t
initial-scratch-message nil
sentence-end-double-space nil
ring-bell-function 'ignore
use-dialog-box nil
mark-even-if-inactive nil
default-directory "~"
display-line-numbers-mode 1
load-prefer-newer t)
(setq-default indent-tabs-mode nil)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(tooltip-mode -1)
(delete-selection-mode t)
(use-package exec-path-from-shell
:init (exec-path-from-shell-initialize))
(set-charset-priority 'unicode)
(prefer-coding-system 'utf-8-unix)
(use-package s)
(use-package dash)
(setq read-process-output-max (* 1024 1024))
(setq gc-cons-threshold 1000000000
create-lockfiles nil
make-backup-files nil
create-lockfiles nil
delete-by-moving-to-trash t)
(setq custom-file (make-temp-name "/tmp/")
custom-safe-themes t)
(use-package recentf
:config
(add-to-list 'recentf-exclude "\\elpa")
(add-to-list 'recentf-exclude "private/tmp")
(recentf-mode))
; remove whitespace
(add-hook 'before-save-hook #'delete-trailing-whitespace)
(setq require-final-newline t)
(global-display-line-numbers-mode)
(column-number-mode t)
(setq auto-fill-mode t
global-visual-fill-column-mode nil)
(global-visual-line-mode t)
(blink-cursor-mode t)
(set-display-table-slot standard-display-table 'wrap ?\ )
(require 'hl-line)
(use-package evil
:config
(evil-mode 1))
I had to switch over to the modus-vivendi
theme. It may be ugly, but my eyes feel much better. Future me: the theme has honestly grown on me. It is very pleasant to look at for long periods of time.
(load-theme 'modus-vivendi t)
(set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist '(alpha-background . 90))
(use-package all-the-icons)
(use-package all-the-icons-dired
:after all-the-icons
:hook (dired-mode . all-the-icons-dired-mode))
A nice modeline that cleans up the clutter.
(use-package diminish
:config
(diminish 'visual-line-mode))
(use-package mood-line
:config (mood-line-mode))
This essentially dims non-active buffers. Makes the current buffer more apparent.
(use-package dimmer
:custom (dimmer-fraction 0.3)
:config (dimmer-mode))
Make delimiters and parentheses easier to follow
(use-package paren
:config (show-paren-mode)
:custom (show-paren-style 'expression))
(use-package rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode)))
(add-to-list 'default-frame-alist '(font . "Victor Mono"))
(set-frame-font "Victor Mono")
(use-package highlight-indent-guides
:custom
(highlight-indent-guides-method 'bitmap)
:config
(set-face-background 'highlight-indent-guides-odd-face "ffffff")
(set-face-background 'highlight-indent-guides-even-face "ffffff")
(set-face-foreground 'highlight-indent-guides-character-face "ffffff")
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode))
;; first we unbind
(-map (lambda (x) (unbind-key x)) '("C-x C-d"
"M-o"
"<mouse-2>"
"<C-wheel-down>"
"<C-wheel-up>"
"s-n"
"C-x C-q"
"C-c C-k"))
(bind-key "C-c /" #'comment-dwim)
(bind-key "C-c C-'" #'org-edit-src-exit)
(use-package which-key
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 0.2)
(which-key-enable-god-mode-support))
I used to use Helm, but it doesn’t really work well with god-mode and was giving me RSI. So I am using vertico now since I can enter god-mode from within it :)
(use-package vertico :init (vertico-mode)) ; Vertical display of completion options.
(use-package orderless) ; Actual completion style.
(use-package marginalia :init (marginalia-mode)) ; Displays margin info to the right of completion options.
(setq read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
completion-styles '(orderless basic)
completion-category-defaults '((file (styles basic partial-completion))))
(use-package yasnippet
:custom
(yas-snippet-dirs
'("~/.emacs.d/snippets"))
:config
(yas-global-mode 1))
My org mode configuration, so I can live and breathe org.
(use-package org
:hook
((org-mode . variable-pitch-mode)
(org-mode . visual-line-mode)
(org-mode . mjalen/remove_line_numbers))
:bind
(:map org-mode-map
("C-c C-'" . #'org-edit-special)) ; For convenience with god mode. c' instead of c '.
:config
(setq org-ellipsis " ▾"
org-hide-emphasis-markers t
line-spacing 2
org-highlight-latex-and-related '(latex script entitles)
org-list-allow-alphabetical t
org-startup-indented t
org-pretty-entities t
org-use-sub-superscripts "{}"
org-startup-with-inline-images t
org-image-actual-width '(300)))
(use-package org-appear :hook (org-mode . org-appear-mode))
(use-package toc-org
:hook
((org-mode . toc-org-mode)
(markdown-mode . toc-org-mode)))
(use-package org-fragtog
:after org
:custom
(org-startup-with-latex-preview t)
:hook
(org-mode . org-fragtog-mode)
:custom
(org-format-latex-options
(plist-put org-format-latex-options :scale 0.8)
(plist-put org-format-latex-options :foreground 'auto)
(plist-put org-format-latex-options :background 'auto)))
(use-package org-superstar
:after org
:hook (org-mode . org-superstar-mode)
:custom
(org-superstar-remove-leading-stars t)
(org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
(use-package org-modern
:hook
(org-mode . global-org-modern-mode)
:custom
(org-modern-keyword nil)
(org-modern-checkbox nil)
(org-modern-table nil))
(use-package markdown-mode)
(setq TeX-auto-save t
Tex-parse-self t)
(setq-default TeX-master nil)
(use-package flyspell)
(add-hook 'TeX-mode-hook 'turn-on-reftex)
(use-package latex-pretty-symbols)
(add-hook 'term-mode-hook 'mjalen/remove_line_numbers)
(use-package nix-mode
:mode "\\.nix\\'")