update for niri and noctalia

This commit is contained in:
Michael Thomson
2026-02-24 07:35:35 -05:00
parent 26ea1efd54
commit 81dc5807d7
16 changed files with 1955 additions and 143 deletions

View File

@@ -1,27 +1,10 @@
;; -*- lexical-binding: t; -*-
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024 4))
(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))
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;; BUILT INS
(use-package emacs
:straight (:type built-in)
:ensure nil
:custom ;; Set custom variables to configure Emacs behavior.
(auto-save-default nil) ;; Disable automatic saving of buffers.
(column-number-mode t) ;; Display the column number in the mode line.
@@ -48,6 +31,8 @@
(use-dialog-box nil) ;; Disable dialog boxes in favor of minibuffer prompts.
(use-short-answers t) ;; Use short answers in prompts for quicker responses (y instead of yes)
(warning-minimum-level :emergency) ;; Set the minimum level of warnings to display.
(context-menu-mode t)
(enable-recursive-minibuffers t)
:hook ;; Add hooks to enable specific features in certain modes.
(prog-mode . display-line-numbers-mode) ;; Enable line numbers in programming modes.
@@ -67,7 +52,7 @@
(menu-bar-mode -1) ;; Disable the menu bar for a more streamlined look.
(when scroll-bar-mode
(scroll-bar-mode -1)) ;; Disable the scroll bar if it is active.
(global-hl-line-mode -1) ;; Disable highlight of the current line
(global-hl-line-mode 1) ;; Disable highlight of the current line
(global-auto-revert-mode 1) ;; Enable global auto-revert mode to keep buffers up to date with their corresponding files.
(recentf-mode 1) ;; Enable tracking of recently opened files.
(savehist-mode 1) ;; Enable saving of command history.
@@ -77,59 +62,47 @@
(file-name-shadow-mode 1) ;; Enable shadowing of filenames for clarity.
(modify-coding-system-alist 'file "" 'utf-8))
(use-package dired
:straight (:type built-in) ;; This is built-in, no need to fetch it.
:custom
(dired-listing-switches "-lah --group-directories-first") ;; Display files in a human-readable format and group directories first.
(dired-dwim-target t) ;; Enable "do what I mean" for target directories.
(dired-kill-when-opening-new-dired-buffer t)) ;; Close the previous buffer when opening a new `dired' instance.
(use-package eldoc
:straight (:type built-in) ;; This is built-in, no need to fetch it.
:ensure nil
:config
(setq eldoc-idle-delay 0) ;; Automatically fetch doc help
(setq eldoc-echo-area-use-multiline-p nil) ;; We use the "K" floating help instead
;; set to t if you want docs on the echo area
(setq eldoc-echo-area-display-truncation-message nil)
(setq eldoc-idle-delay 0)
:init
(global-eldoc-mode))
(use-package flymake
:straight (:type built-in) ;; This is built-in, no need to fetch it.
:defer t
:hook (prog-mode . flymake-mode)
:custom
(flymake-margin-indicators-string
'((error "" compilation-error) (warning "»" compilation-warning) (note "»" compilation-info))))
:ensure nil
:hook (prog-mode . flymake-mode))
(use-package which-key
:straight (:type built-in) ;; This is built-in, no need to fetch it.
:defer t ;; Defer loading Which-Key until after init.
:hook
(after-init . which-key-mode)) ;; Enable which-key mode after initialization.
:ensure nil
:config
(which-key-mode))
;; MINAD STACK
(use-package vertico
:hook
(after-init . vertico-mode) ;; Enable vertico after Emacs has initialized.
:ensure t
:init
(vertico-mode)
:custom
(vertico-count 10) ;; Number of candidates to display in the completion list.
(vertico-resize nil) ;; Disable resizing of the vertico minibuffer.
(vertico-cycle nil)) ;; Do not cycle through candidates when reaching the end of the list.
(vertico-count 20)
(vertico-resize t)
(vertico-cycle t))
(use-package orderless
:defer t ;; Load Orderless on demand.
:after vertico ;; Ensure Vertico is loaded before Orderless.
:init
(setq completion-styles '(orderless basic) ;; Set the completion styles.
completion-category-defaults nil ;; Clear default category settings.
completion-category-overrides '((file (styles partial-completion))))) ;; Customize file completion styles.
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles partial-completion))))
(completion-category-defaults nil)
(completion-pcm-leading-wildcard t)) ;; Emacs 31: partial-completion behaves like substring
(use-package marginalia
:hook
(after-init . marginalia-mode))
:ensure t
:init
(marginalia-mode))
(use-package consult
:defer t
:ensure t
:init
;; Enhance register preview with thin lines and no mode line.
(advice-add #'register-preview :override #'consult-register-window)
@@ -139,39 +112,47 @@
xref-show-definitions-function #'consult-xref))
(use-package embark
:defer t)
:ensure t)
(use-package embark-consult
:ensure t
:hook
(embark-collect-mode . consult-preview-at-point-mode)) ;; Enable preview in Embark collect mode.
(use-package treesit-auto
:after emacs
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode t))
(use-package corfu
:defer t
:ensure t
:init
(global-corfu-mode)
(corfu-popupinfo-mode)
:custom
(corfu-cycle t)
(corfu-auto t) ;; Only completes when hitting TAB
(corfu-auto-delay 0) ;; Delay before popup (enable if corfu-auto is t)
(corfu-auto-prefix 1) ;; Trigger completion after typing 1 character
(corfu-quit-no-match t) ;; Quit popup if no match
(corfu-scroll-margin 5) ;; Margin when scrolling completions
(corfu-max-width 50) ;; Maximum width of completion popup
(corfu-min-width 50) ;; Minimum width of completion popup
(corfu-popupinfo-delay 0.5) ;; Delay before showing documentation popup
(completion-ignore-case t)
:config
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)
(global-corfu-mode)
(corfu-popupinfo-mode t))
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package nerd-icons-corfu
:defer t
:ensure t
:after (:all corfu))
(use-package treesit-auto
:ensure t
:after emacs
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode t))
(use-package yasnippet ; Snippets
:ensure t
:config
(yas-global-mode))
;; LSP BOOSTER
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
@@ -205,7 +186,7 @@
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(use-package lsp-mode
:defer t
:ensure t
:hook (;; Replace XXX-mode with concrete major mode (e.g. python-mode)
(lsp-mode . lsp-enable-which-key-integration) ;; Integrate with Which Key
((js-mode ;; Enable LSP for JavaScript
@@ -215,6 +196,8 @@
go-ts-mode ;; Enable LSP for Go
js-ts-mode ;; Enable LSP for JavaScript (TS mode)
nix-ts-mode
rust-ts-mode
haskell-mode
web-mode) . lsp-deferred)) ;; Enable LSP for Web (HTML)
:commands lsp
:custom
@@ -223,7 +206,7 @@
(lsp-completion-provider :none) ;; Disable the default completion provider.
(lsp-session-file (locate-user-emacs-file ".lsp-session")) ;; Specify session file location.
(lsp-log-io nil) ;; Disable IO logging for speed.
(lsp-idle-delay 0.5) ;; Set the delay for LSP to 0 (debouncing).
(lsp-idle-delay 0) ;; Set the delay for LSP to 0 (debouncing).
(lsp-keep-workspace-alive nil) ;; Disable keeping the workspace alive.
;; Core settings
(lsp-enable-xref t) ;; Enable cross-references.
@@ -233,7 +216,7 @@
(lsp-enable-file-watchers nil) ;; Disable file watchers.
(lsp-enable-folding nil) ;; Disable folding.
(lsp-enable-imenu t) ;; Enable Imenu support.
(lsp-enable-indentation nil) ;; Disable indentation.
(lsp-enable-indentation t) ;; Disable indentation.
(lsp-enable-on-type-formatting nil) ;; Disable on-type formatting.
(lsp-enable-suggest-server-download t) ;; Enable server download suggestion.
(lsp-enable-symbol-highlighting t) ;; Enable symbol highlighting.
@@ -247,7 +230,7 @@
;; Completion settings
(lsp-completion-enable t) ;; Enable completion.
(lsp-completion-enable-additional-text-edit t) ;; Enable additional text edits for completions.
(lsp-enable-snippet nil) ;; Disable snippets
(lsp-enable-snippet t)
(lsp-completion-show-kind t) ;; Show kind in completions.
;; Lens settings
(lsp-lens-enable t) ;; Enable lens support.
@@ -262,13 +245,20 @@
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\node_modules\\'"))
(use-package nix-ts-mode
:ensure t
:mode "\\.nix\\'")
(use-package haskell-mode
:ensure t)
(use-package lsp-haskell
:ensure t)
(use-package eldoc-box
:defer t)
:ensure t)
(use-package diff-hl
:defer t
:ensure t
:hook
(find-file . (lambda ()
(global-diff-hl-mode) ;; Enable Diff-HL mode for all files.
@@ -278,12 +268,12 @@
(diff-hl-side 'left))
(use-package magit
:ensure t
:config
(setopt magit-format-file-function #'magit-format-file-nerd-icons) ;; Turns on magit nerd-icons
:defer t)
(setopt magit-format-file-function #'magit-format-file-nerd-icons)) ;; Turns on magit nerd-icons
(use-package evil
:defer t
:ensure t
:hook
(after-init . evil-mode)
:init
@@ -299,7 +289,7 @@
(use-package evil-collection
:defer t
:ensure t
:custom
(evil-collection-want-find-usages-bindings t)
:hook
@@ -307,17 +297,20 @@
(use-package evil-surround
:ensure t
:after evil-collection
:config
(global-evil-surround-mode 1))
(use-package evil-matchit
:ensure t
:after evil-collection
:config
(global-evil-matchit-mode 1))
(use-package general
:ensure t
:after (evil evil-collection)
:init
(setq general-override-states '(insert
@@ -339,6 +332,10 @@
"g r" '(lsp-find-references :wk "Goto references")
"K" '(eldoc-box-help-at-point :wk "Describe"))
(general-define-key
:states 'insert
"C-y" '(corfu-complete :wk "Complete"))
(general-create-definer my-leader-def
:states '(normal insert visual motion emacs)
:keymaps 'override
@@ -390,7 +387,7 @@
"u" '(undo-tree-visualize :wk "Undo-tree")))
(use-package undo-tree
:defer t
:ensure t
:hook
(after-init . global-undo-tree-mode)
:init
@@ -403,10 +400,10 @@
(setq undo-tree-history-directory-alist '(("." . "~/.config/emacs/.cache/undo"))))
(use-package dotenv-mode
:defer t)
:ensure t)
(use-package doom-modeline
:defer t
:ensure t
:custom
(doom-modeline-buffer-file-name-style 'buffer-name) ;; Set the buffer file name style to just the buffer name (without path).
(doom-modeline-project-detection 'project) ;; Enable project detection for displaying the project name.
@@ -418,36 +415,38 @@
(after-init . doom-modeline-mode))
(use-package nerd-icons
:defer t)
:ensure t)
(use-package nerd-icons-dired
:defer t ;; Load the package only when needed to improve startup time.
:ensure t
:hook
(dired-mode . nerd-icons-dired-mode))
(use-package nerd-icons-completion
:after (:all nerd-icons marginalia) ;; Load after `nerd-icons' and `marginalia' to ensure proper integration.
:ensure t
:config
(nerd-icons-completion-mode) ;; Activate nerd icons for completion interfaces.
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)) ;; Setup icons in the marginalia mode for enhanced completion display.
(use-package exec-path-from-shell
:ensure t
:config
(exec-path-from-shell-initialize))
(use-package envrc
:ensure t
:init
(setq envrc-show-summary-in-minibuffer nil)
:hook
(after-init . envrc-global-mode))
(use-package modus-themes
:ensure t
:config
(load-theme 'modus-vivendi t))
(load-theme 'modus-operandi t))
(use-package org
:straight (:type built-in)
:defer t
:ensure nil
:custom
(org-tags-column 0)
(org-return-follows-link t)
@@ -486,6 +485,7 @@
(require 'org-tempo))
(use-package org-roam
:ensure t
:custom
(org-roam-directory "~/org")
:bind (("C-c n l" . org-roam-buffer-toggle)
@@ -495,6 +495,7 @@
(org-roam-setup))
(use-package mu4e
:ensure t
:config
(setq mu4e-get-mail-command (concat (executable-find "mbsync") " -a"))
(setq mu4e-update-interval 300)
@@ -524,3 +525,6 @@
(mu4e-refile-folder . "/personal/Archive")
(mu4e-sent-folder . "/personal/Sent")
(mu4e-trash-folder . "/personal/Trash"))))))
(use-package pdf-tools
:ensure t)