Files
emacs-dotfiles/post-init.el

105 lines
3.4 KiB
EmacsLisp

;;; post-init.el --- This file is loaded after init.el. -*- no-byte-compile: t; lexical-binding: t; -*-
(load-theme 'modus-operandi)
(set-face-attribute 'default nil :height 110 :font "Iosevka Nerd Font" :weight 'normal)
(setq initial-frame-alist
'((width . 100) (height . 25)))
;; Use straight.el for package management, integrate with use-package.
(setq straight-use-package-by-default t)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(unless (memq 'use-package-autoloads features)
(straight-use-package 'use-package))
;; This should be loaded as early as possible
(use-package compile-angel
:demand t
:custom
(compile-angel-verbose nil)
:config
(compile-angel-on-load-mode)
(add-hook 'emacs-lisp-mode-hook #'compile-angel-on-save-local-mode))
;; Minibuffers and stuff
(setq enable-recursive-minibuffers t)
(which-key-mode t)
;; Modeline
(display-time-mode)
(setq display-time-24hr-format t)
(use-package diminish
:ensure t)
;; Since diminish was loaded after compile-angel, we cannot use the use-package
;; integration to diminish it. So, we do it manually here. Also, built-in modes.1
(diminish 'compile-angel-on-save-local-mode)
(diminish 'compile-angel-on-load-mode)
(diminish 'eldoc-mode)
(diminish 'which-key-mode)
;; Avoid backups or lockfiles to prevent creating world-readable copies of files
(setq create-lockfiles nil)
(setq make-backup-files nil)
(setq backup-directory-alist
`((".*" . ,(expand-file-name "backup" user-emacs-directory))))
(setq tramp-backup-directory-alist backup-directory-alist)
(setq backup-by-copying-when-linked t)
(setq backup-by-copying t) ; Backup by copying rather renaming
(setq delete-old-versions t) ; Delete excess backup versions silently
(setq version-control t) ; Use version numbers for backup files
(setq kept-new-versions 5)
(setq kept-old-versions 5)
;; Syntax highlights
(setq treesit-font-lock-level 4)
;; NixOS Specific
(if (functionp 'nix--profile-paths)
(progn
(unless (memq 'nix-ts-mode features)
(load "nix-ts-mode" t)
(unless (memq 'nix-ts-mode features)
(warn "Failed to load nix-ts-mode. It is probably not installed."))))
(progn
(message "Not on NixOS. Will try to install packages usually managed by it through use-package.")
(use-package vterm
:defer t
:ensure t)
(use-package nix-ts-mode
:defer t
:ensure t)))
;; LSP and stuff
(add-hook 'nix-ts-mode-hook 'eglot-ensure)
(add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-ts-mode))
;; Load the configs from plug-in files.
(let ((config-dir (concat minimal-emacs-user-directory ".config.d")))
(if (not (file-exists-p config-dir))
(make-directory config-dir))
(dolist (lisp-file (directory-files config-dir t directory-files-no-dot-files-regexp))
(load lisp-file nil 'nomessage)))
;;; post-init.el ends here