emacs-config/init.el

1208 lines
41 KiB
EmacsLisp
Raw Normal View History

2023-09-18 13:05:09 -07:00
;;; init.el --- Configuration entry point -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
2023-09-23 16:48:22 -07:00
;; Some other config files
2023-09-27 04:07:01 -07:00
(add-to-list 'load-path "~/.emacs.d/elisp")
2023-09-23 16:48:22 -07:00
2023-09-18 13:05:09 -07:00
;; Set package dir to follow no-littering conventions
(setq package-user-dir "~/.emacs.d/var/elpa")
;; Use melpa
(require 'package)
2023-09-20 00:50:34 -07:00
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
2023-09-18 13:05:09 -07:00
(package-initialize)
;; Ensure use-package is installed
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; use-package
(eval-when-compile
2023-09-20 16:13:29 -07:00
(setq use-package-always-ensure t
package-user-dir "~/.emacs.d/var/elpa")
2023-09-18 13:05:09 -07:00
(require 'use-package))
;; no-littering
(use-package no-littering
2023-09-29 12:53:49 -07:00
:autoload (no-littering-theme-backups
no-littering-expand-etc-file-name)
:init
2023-09-18 13:05:09 -07:00
(no-littering-theme-backups)
(setq custom-file (no-littering-expand-etc-file-name "custom.el")))
;; diminish
(use-package diminish
:config
2023-09-21 03:20:43 -07:00
(diminish 'visual-line-mode)
2023-09-18 13:05:09 -07:00
(diminish 'abbrev-mode))
;; basic stuff
(use-package emacs
2023-09-20 00:50:34 -07:00
:hook ((emacs-lisp-mode . my/-emacs-lisp-mode-setup-evil-lookup)
2023-10-10 02:50:48 -07:00
(prog-mode . electric-pair-local-mode)
((text-mode message-mode tex-mode) . flyspell-mode)
2023-12-13 01:28:49 -08:00
((text-mode message-mode tex-mode) . auto-fill-mode)
2023-10-10 02:50:48 -07:00
(prog-mode . flyspell-prog-mode))
2023-09-18 13:05:09 -07:00
:init
2023-09-20 00:50:34 -07:00
(defun my/-emacs-lisp-mode-setup-evil-lookup ()
(setq-local evil-lookup-func
#'my/describe-symbol-at-point))
2023-09-18 13:05:09 -07:00
(defun my/describe-symbol-at-point ()
"Calls `describe-symbol' on the return value of `form-at-point'."
(interactive)
2023-09-20 00:50:34 -07:00
(let ((form (form-at-point)))
(if (consp form)
(describe-symbol (cadr form))
(describe-symbol form))))
2023-09-18 13:05:09 -07:00
2023-09-20 03:57:16 -07:00
;; Terminal mouse support
(xterm-mouse-mode 1)
2023-12-27 12:19:44 -08:00
;; Make cursor more visible
(global-hl-line-mode 1)
(blink-cursor-mode -1)
2023-12-27 12:19:44 -08:00
2023-10-16 05:02:57 -07:00
;; Enable all disabled stuff
(setq disabled-command-function nil)
2023-10-10 02:50:48 -07:00
2023-09-27 04:07:01 -07:00
;; Better scrolling
(setq mouse-scroll-delay 0
scroll-conservatively 10
scroll-margin 2
scroll-preserve-screen-position t)
2023-09-22 02:50:19 -07:00
2023-09-18 13:05:09 -07:00
;; Make show paren instant
(setq show-paren-delay 0)
(show-paren-mode 1)
;; Display line numbers
(global-display-line-numbers-mode 1)
;; Allow the frame to be any size
(setq frame-resize-pixelwise t)
2023-10-23 15:49:47 -07:00
;; Don't use a gtk file picker
(setq use-file-dialog nil)
2023-09-18 13:05:09 -07:00
;; Disable startup screen
2023-12-26 04:48:49 -08:00
(setq inhibit-startup-screen t
server-client-instructions nil)
2023-09-18 13:05:09 -07:00
2023-09-20 00:50:34 -07:00
;; show column numbers
(column-number-mode 1)
2023-09-18 13:05:09 -07:00
;; Disable the menu and tool bars
(menu-bar-mode -1)
(tool-bar-mode -1)
;; No scroll bars
(scroll-bar-mode -1)
2023-09-20 14:55:12 -07:00
;; Visual line mode
(global-visual-line-mode 1)
2023-09-18 13:05:09 -07:00
;; Set fonts
(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12"))
2023-09-20 00:50:34 -07:00
;; Some settings for programming
(setq-default indent-tabs-mode nil
2023-09-21 03:20:43 -07:00
tab-width 4)
2023-09-20 00:50:34 -07:00
2023-09-18 13:05:09 -07:00
;; Tree sitter download locations
(setq treesit-language-source-alist
2023-09-20 00:50:34 -07:00
'((c "https://github.com/tree-sitter/tree-sitter-c")
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
(java "https://github.com/tree-sitter/tree-sitter-java")
(python "https://github.com/tree-sitter/tree-sitter-python")
2023-09-21 16:02:36 -07:00
(rust "https://github.com/tree-sitter/tree-sitter-rust")
(json "https://github.com/tree-sitter/tree-sitter-json")
(css "https://github.com/tree-sitter/tree-sitter-css")
(go "https://github.com/tree-sitter/tree-sitter-go")
(js "https://github.com/tree-sitter/tree-sitter-javascript")
(bash "https://github.com/tree-sitter/tree-sitter-bash")
2023-10-20 02:23:52 -07:00
(cmake "https://github.com/uyha/tree-sitter-cmake")
(blueprint "https://github.com/huanie/tree-sitter-blueprint")))
2023-09-20 00:50:34 -07:00
;; Tree sitter major mode conversions
(setq major-mode-remap-alist
'((c-mode . c-ts-mode)
2023-09-21 03:20:43 -07:00
(c++-mode . c++-ts-mode)
(c-or-c++-mode . c-or-c++-ts-mode)
2023-10-15 18:44:41 -07:00
(python-mode . python-ts-mode)
2023-09-20 00:50:34 -07:00
(java-mode . java-ts-mode)
2023-09-21 16:02:36 -07:00
(rust-mode . rust-ts-mode)
(json-mode . json-ts-mode)
(css-mode . css-ts-mode)
(js-mode . js-ts-mode)
(cmake-mode . cmake-ts-mode))))
2023-09-18 13:05:09 -07:00
2023-11-23 15:55:25 -08:00
(use-package tab-bar
:ensure nil
:init
(setq tab-bar-show 1
tab-bar-tab-hints t
icon-preference '(symbol text image emoji))
(tab-bar-mode 1))
2024-01-07 21:46:38 -08:00
;; flyspell
(use-package flyspell
:config
(setq ispell-program-name "hunspell"
flyspell-issue-message-flag nil
flyspell-issue-welcome-flag nil)
(define-key flyspell-mode-map (kbd "C-;") nil t)
(define-key flyspell-mode-map (kbd "C-,") nil t))
2023-09-21 03:20:43 -07:00
;; recentf
2023-09-18 13:05:09 -07:00
(use-package recentf
2023-09-27 04:07:01 -07:00
:init
2023-12-27 22:43:15 -08:00
(setq recentf-exclude `("^/tmp/.*"
2023-10-30 01:34:55 -07:00
"^~/.mail/[^/]/Drafts/.*"
2023-12-27 22:43:15 -08:00
,(format "^%svar/elpa/.*" user-emacs-directory)
,(format "^%svar/gnus/.*" user-emacs-directory)
,(format "^%setc/gnus/.*" user-emacs-directory)))
2023-10-24 01:08:15 -07:00
:bind ("C-c r" . recentf)
2023-09-18 13:05:09 -07:00
:config
(recentf-mode 1))
2023-10-05 00:44:19 -07:00
;; kitty keyboard protocol
(use-package kkp
:config
(global-kkp-mode 1))
2023-09-18 13:05:09 -07:00
;; evil
(use-package evil
:init
(setq evil-want-integration t
2024-01-08 16:26:25 -08:00
evil-want-C-d-scroll nil
2023-09-18 13:05:09 -07:00
evil-want-keybinding nil
evil-undo-system 'undo-redo
2023-10-31 00:39:11 -07:00
evil-search-module 'isearch
evil-respect-visual-line-mode t)
2023-09-18 13:05:09 -07:00
:config
(evil-mode 1)
(evil-define-key '(normal visual motion) proced-mode-map
2023-09-21 03:20:43 -07:00
"u" #'proced-unmark)
2023-09-18 13:05:09 -07:00
(evil-define-key '(normal visual motion) dired-mode-map
2023-09-21 03:20:43 -07:00
"u" #'dired-unmark))
2023-09-18 13:05:09 -07:00
(use-package evil-collection
2023-09-22 02:50:19 -07:00
:after evil
2023-09-18 13:05:09 -07:00
:diminish evil-collection-unimpaired-mode
:config
(evil-collection-init))
(use-package evil-surround
2023-09-22 02:50:19 -07:00
:after evil
2023-09-18 13:05:09 -07:00
:config
2023-09-21 03:20:43 -07:00
(evil-define-key 'operator evil-surround-mode-map
"z" #'evil-surround-edit
2023-10-30 01:34:55 -07:00
"Z" #'evil-Surround-edit)
2023-09-21 03:20:43 -07:00
(evil-define-key 'visual evil-surround-mode-map
2023-10-15 15:32:42 -07:00
"gz" #'evil-surround-region
"gZ" #'evil-Surround-region)
2023-09-18 13:05:09 -07:00
(global-evil-surround-mode 1))
2023-09-21 03:20:43 -07:00
(use-package evil-terminal-cursor-changer
2023-09-22 02:50:19 -07:00
:after evil
2023-09-20 03:57:16 -07:00
:config
(evil-terminal-cursor-changer-activate))
2023-10-24 01:08:15 -07:00
;; allow copy from termainl
(use-package xclip
:config
(xclip-mode 1))
2023-09-18 13:05:09 -07:00
;; which-key
(use-package which-key
:diminish which-key-mode
:config
(which-key-mode 1))
;; avy
(use-package avy
2023-09-20 00:50:34 -07:00
:bind (("C-c C-j" . avy-resume)
("M-s s" . evil-avy-goto-char-2)
("M-s S" . evil-avy-goto-line))
2023-09-18 13:05:09 -07:00
:init
(define-minor-mode my/evil-avy-mode
2023-09-20 00:50:34 -07:00
"A minor mode for binding avy commands to s and S in evil's normal and
visual states."
2023-09-18 13:05:09 -07:00
:keymap (make-sparse-keymap))
(evil-define-key '(normal visual operator motion) my/evil-avy-mode-map
2023-09-21 03:20:43 -07:00
"s" #'evil-avy-goto-char-2
"S" #'evil-avy-goto-line)
2023-09-20 00:50:34 -07:00
(define-globalized-minor-mode my/evil-avy-global-mode my/evil-avy-mode
(lambda () (my/evil-avy-mode 1))
2023-10-03 13:04:37 -07:00
:predicate '((not magit-mode dired-mode
proced-mode mu4e-main-mode
2023-10-20 02:50:07 -07:00
mu4e-view-mode mu4e-headers-mode
2023-12-27 22:43:15 -08:00
ibuffer-mode calc-mode calc-trail-mode
gnus-group-mode) t))
2023-09-20 00:50:34 -07:00
(my/evil-avy-global-mode 1)
2023-09-18 13:05:09 -07:00
:config
(avy-setup-default))
;; ace-window
(use-package ace-window
:diminish ace-window-mode
:bind ("M-o" . ace-window)
:init
(setq aw-scope 'frame
aw-minibuffer-flag t))
;; savehist
(use-package savehist
:config
(savehist-mode 1))
;; vertico
2024-01-07 21:46:38 -08:00
(use-package vertico
:bind (:map vertico-map
("C-S-k" . kill-line)
("C-k" . vertico-previous)
("C-j" . vertico-next)
("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-char)
("M-DEL" . vertico-directory-delete-word))
:hook (minibuffer-setup . cursor-intangible-mode)
2023-09-18 13:05:09 -07:00
:init
2023-12-27 22:43:15 -08:00
(defun my/crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'my/crm-indicator)
2024-01-07 21:46:38 -08:00
(setq vertico-cycle t
enable-recursive-minibuffers t
read-extended-command-predicate #'command-completion-default-include-p
minibuffer-prompt-properties '(read-only t
cursor-intangible t
face minibuffer-prompt))
(vertico-mode 1))
2023-09-18 13:05:09 -07:00
;; orderless
(use-package orderless
:autoload orderless-define-completion-style
2023-09-20 00:50:34 -07:00
:hook (text-mode . my/-setup-text-mode-completion-styles)
2023-09-18 13:05:09 -07:00
:init
2023-09-20 00:50:34 -07:00
(defun my/-setup-text-mode-completion-styles ()
(setq-local completion-styles '(basic)))
2023-09-18 13:05:09 -07:00
(orderless-define-completion-style my/orderless-with-initialism
(orderless-matching-styles '(orderless-initialism
orderless-regexp)))
2024-01-07 21:46:38 -08:00
(setq orderless-matching-styles '(orderless-regexp)
completion-styles '(orderless basic)
2023-09-18 13:05:09 -07:00
completion-category-defaults nil
completion-category-overrides '((file
2023-09-20 00:50:34 -07:00
(styles basic partial-completion))
2023-09-18 13:05:09 -07:00
(command
2024-01-07 21:46:38 -08:00
(styles my/orderless-with-initialism basic)))))
2023-09-18 13:05:09 -07:00
2024-01-07 21:46:38 -08:00
; marginalia
2023-09-18 13:05:09 -07:00
(use-package marginalia
:bind (:map minibuffer-local-map
2023-09-21 03:20:43 -07:00
("M-a" . marginalia-cycle))
2023-09-18 13:05:09 -07:00
:init
(marginalia-mode 1))
;; embark
(use-package embark
2024-01-07 21:46:38 -08:00
:bind (("C-," . embark-act)
("C-;" . embark-dwim)
:map help-map
("B" . embark-bindings))
2023-09-20 00:50:34 -07:00
:init
(setq embark-quit-after-action nil)
(add-to-list 'display-buffer-alist
2023-09-21 03:20:43 -07:00
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
2023-09-18 13:05:09 -07:00
;; consult
(use-package consult
:bind (("C-s" . consult-line)
("C-x b" . consult-buffer)
("C-S-s" . consult-ripgrep)
("C-x C-S-f" . consult-fd)
("C-x c k" . consult-keep-lines)
("C-x c f" . consult-focus-lines)
("C-x c r" . consult-recent-file)
("C-x c b" . consult-bookmark)
2023-09-22 02:50:19 -07:00
("C-x c d" . consult-fd)
("C-x c g" . consult-ripgrep)
2023-09-20 00:50:34 -07:00
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
2023-10-12 20:24:53 -07:00
("M-g r" . consult-imenu-multi)
:map help-map
("TAB". consult-info)
("C-m" . consult-man))
2023-09-21 03:20:43 -07:00
:hook (minibuffer-setup . my/consult-setup-minibuffer-completion)
2023-09-18 13:05:09 -07:00
:init
2023-09-21 03:20:43 -07:00
(defun my/consult-setup-minibuffer-completion ()
(setq-local completion-in-region-function #'consult-completion-in-region))
2023-09-18 13:05:09 -07:00
(evil-declare-motion #'consult-line))
2023-11-27 15:53:58 -08:00
(use-package consult-eglot
:commands consult-eglot-symbols)
2023-09-18 13:05:09 -07:00
;; integration for embark and consult
(use-package embark-consult
:hook (embark-collect-mode . consult-preview-at-point-mode))
;; corfu (autocomplete)
(use-package corfu
2023-09-20 00:50:34 -07:00
:bind (("M-<tab>" . completion-at-point)
:map corfu-map
("M-SPC" . corfu-insert-separator)
("M-m" . my/corfu-move-to-minibuffer))
2023-09-18 13:05:09 -07:00
:init
2023-09-20 00:50:34 -07:00
(defun my/corfu-move-to-minibuffer ()
(interactive)
(when completion-in-region--data
(let ((completion-extra-properties corfu--extra)
completion-cycle-threshold completion-cycling)
(apply #'consult-completion-in-region completion-in-region--data))))
2023-09-18 13:05:09 -07:00
(setq corfu-cycle t
2023-09-20 00:50:34 -07:00
corfu-auto t
corfu-on-exact-match nil
2024-01-07 21:46:38 -08:00
completion-cycle-threshold nil)
2023-09-20 00:50:34 -07:00
(global-corfu-mode 1)
(corfu-popupinfo-mode 1)
:config
(add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer))
2023-09-20 00:50:34 -07:00
(use-package corfu-terminal
:init
(corfu-terminal-mode 1))
;; cape (a bunch of capfs!)
(use-package cape
2023-10-10 02:50:48 -07:00
:bind (("C-c p" . cape-dabbrev)
2024-01-07 21:46:38 -08:00
([remap dabbrev-expand] . cape-dabbrev)
2023-10-10 02:50:48 -07:00
("C-c P" . cape-line))
2023-09-20 00:50:34 -07:00
:hook (text-mode . my/-cape-setup-text-mode)
:init
(defun my/-cape-setup-text-mode ()
(setq-local completion-at-point-functions
2023-09-27 04:07:01 -07:00
'(cape-dict cape-dabbrev)
corfu-auto nil))
2023-09-20 00:50:34 -07:00
(add-to-list 'completion-at-point-functions #'cape-file))
2023-09-18 13:05:09 -07:00
;; xref
(use-package xref
:init
(evil-define-key '(normal motion) 'global
2023-09-21 03:20:43 -07:00
"gr" #'xref-find-references)
2023-09-18 13:05:09 -07:00
(setq xref-show-xrefs-function #'consult-xref
2023-09-21 03:20:43 -07:00
xref-show-definitions-function #'consult-xref))
2023-09-18 13:05:09 -07:00
2023-09-20 03:57:16 -07:00
;; popup.el
(use-package popup)
2023-11-03 23:04:36 -07:00
;; posframe
(use-package posframe)
2023-09-18 13:05:09 -07:00
;; flymake
2023-11-27 15:53:58 -08:00
(use-package flymake
:bind (:map flymake-mode-map
("C-c e" . my/flymake-show-diagnostic-at-point)
("C-c C-e" . consult-flymake))
:hook (emacs-lisp-mode . flymake-mode)
:init
(defun my/flymake-show-diagnostic-at-point ()
(interactive)
(if-let ((pos (point))
(diag (and flymake-mode
(get-char-property pos 'flymake-diagnostic)))
(message (flymake--diag-text diag)))
(if (display-graphic-p)
(progn
(posframe-show " *flymake-error-posframe*"
:string message
:position (point)
:max-width 80
:border-width 2
:border-color "white")
(clear-this-command-keys)
(push (read-event) unread-command-events)
(posframe-hide " *flymake-error-posframe*"))
(popup-tip message)))))
2023-09-18 13:05:09 -07:00
;; eldoc
(use-package eldoc
:diminish eldoc-mode
:init
2024-01-04 00:14:49 -08:00
(setq-default eldoc-echo-area-use-multiline-p nil))
2023-09-18 13:05:09 -07:00
2023-09-20 00:50:34 -07:00
;; eglot
2023-11-27 15:53:58 -08:00
(use-package eglot
:demand t
2024-01-09 01:35:55 -08:00
:hook (eglot-managed-mode . my/-eglot-setup)
2023-09-20 00:50:34 -07:00
:init
2023-11-27 15:53:58 -08:00
(defvar my/-eglot-documentation-buffer nil
"Buffer for showing documentation for `my/eglot-documentation-at-point'.")
(defun my/eglot-documentation-at-point ()
"Show documentation for a symbol at point."
2023-10-05 21:43:36 -07:00
(interactive)
2023-11-27 15:53:58 -08:00
(if-let (server (eglot-current-server))
(progn
(if-let* (((not (buffer-live-p my/-eglot-documentation-buffer)))
(name (generate-new-buffer-name "*eglot documentation*")))
(setq my/-eglot-documentation-buffer (generate-new-buffer name)))
(eglot-hover-eldoc-function
(lambda (info _ _)
(if-let (((not (seq-empty-p info)))
(buff (current-buffer)))
(with-current-buffer my/-eglot-documentation-buffer
(read-only-mode -1)
(erase-buffer)
(insert info)
(special-mode)
(read-only-mode 1)
(when (not (get-buffer-window my/-eglot-documentation-buffer nil))
(switch-to-buffer-other-window my/-eglot-documentation-buffer t)
(switch-to-buffer-other-window buff t)))))))))
(defun my/-eglot-setup ()
"Setup eldoc variables for `eglot-managed-mode-hook'."
2024-01-04 00:14:49 -08:00
(setq-local evil-lookup-func #'my/eglot-documentation-at-point)
2023-11-27 15:53:58 -08:00
(evil-define-key '(normal motion) 'local
"K" #'evil-lookup
"gR" #'eglot-rename
"gA" #'eglot-code-actions
"gs" #'consult-eglot-symbols)
(eglot-inlay-hints-mode -1))
(setq eglot-autoshutdown t)
:config
(add-to-list 'eglot-server-programs
(cons '(c-mode c-ts-mode c++-mode c++-ts-mode objc-mode)
'("clangd" "--all-scopes-completion" "--background-index"
"--clang-tidy" "--completion-style=detailed"
"--header-insertion=never" "--pch-storage=memory"
"--malloc-trim" "--function-arg-placeholders"))))
2024-01-08 21:32:05 -08:00
;; realgud
2024-01-08 16:26:25 -08:00
(use-package realgud
:hook (realgud-short-key-mode . my/-realgud-setup-shortkey-mode)
:bind (:map realgud:shortkey-mode-map
("a" . realgud:cmd-frame))
:init
(setq realgud-srcbuf-lock t
realgud-short-key-on-tracing? t)
(defun my/-realgud-setup-shortkey-mode ()
(when realgud-short-key-mode
(keymap-local-set "C-d" realgud:shortkey-mode-map))))
2024-01-08 21:32:05 -08:00
;; dumb-jump
(use-package dumb-jump
:init
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate))
2023-10-12 15:08:13 -07:00
;; yasnippet
(use-package yasnippet
:bind ("C-c s" . yas-expand)
:init
(yas-global-mode 1))
;; project.el
(use-package project
2023-11-07 03:19:30 -08:00
:bind (("C-c v" . my/project-eshell-or-default)
2023-10-12 16:56:14 -07:00
:map project-prefix-map
2023-11-07 03:19:30 -08:00
("s" . my/project-eshell)
2023-09-30 21:41:19 -07:00
("u" . my/project-run))
:init
2023-11-07 03:19:30 -08:00
(defvar eshell-buffer-name)
(defun my/project-eshell (prompt &optional arg)
"Switch to or create an eshell buffer in the current projects root."
(interactive (list t current-prefix-arg))
2023-10-12 16:56:14 -07:00
(if-let ((proj (project-current prompt))
2023-11-07 03:19:30 -08:00
(default-directory (project-root proj))
(eshell-buffer-name
(concat "*eshell for project " default-directory "*")))
2023-11-17 16:28:59 -08:00
(eshell arg)))
2023-11-07 03:19:30 -08:00
(defun my/project-eshell-or-default (&optional arg)
"Open an eshell for the current project, otherwise, open a normal eshell."
(interactive "P")
(unless (my/project-eshell nil arg)
(eshell arg)))
(defvar my/project-run-command nil
"Command to run with `my/project-run'.")
(put 'my/project-run-command 'safe-local-variable (lambda (val)
(stringp val)))
2023-10-10 02:50:48 -07:00
(defvar my/project-run-dir nil
"Directory to run project in with `my/project-run'.")
(put 'my/project-run-dir 'safe-local-variable (lambda (val)
(stringp val)))
(defvar my/-project-run-history '()
"Commands previously run with `my/project-run'")
2023-11-02 21:38:31 -07:00
(defvar my/project-root-marker ".project-root"
"Marker file to look for in non-vc backed projects.")
2023-10-10 02:50:48 -07:00
(defun my/project-get-root-dir ()
"Get the root dir for the current project"
2023-10-20 02:29:29 -07:00
(let* ((proj (project-current nil))
(default-directory (if proj
(project-root proj)
default-directory)))
(if my/project-run-dir
(expand-file-name my/project-run-dir)
default-directory)))
(defun my/project-run (command comint)
"Like `project-compile', but for running a project.
COMMAND and COMINT are like `compile'."
2023-10-10 14:14:30 -07:00
(interactive
(list
(let ((default-directory (my/project-get-root-dir)))
(read-shell-command "Run Command: "
(or my/project-run-command
(car my/-project-run-history))
(if (and my/project-run-command
(equal my/project-run-command
(car-safe my/-project-run-history)))
'(my/-project-run-history . 1)
'my/-project-run-history)))
(consp current-prefix-arg)))
2023-10-10 02:50:48 -07:00
(let* ((default-directory (my/project-get-root-dir))
(compilation-buffer-name-function (lambda (_)
(progn "*run project*")))
(compilation-directory default-directory)
2023-10-10 14:14:30 -07:00
(compile-history nil)
(compile-command nil))
(compile command comint)
(when (not my/project-run-command)
2023-11-02 21:38:31 -07:00
(setq my/project-run-command command))))
:config
(defun my/project-try-dotfile (dir)
(if-let (root (locate-dominating-file dir my/project-root-marker))
(list 'vc nil root)))
(add-hook 'project-find-functions #'my/project-try-dotfile))
2023-10-20 14:21:20 -07:00
;; nxml
(use-package nxml-mode
:ensure nil
:hook (nxml-mode . my/-nxml-setup)
:init
(defun my/-nxml-setup ()
"Setup `nxml-mode'."
(sgml-electric-tag-pair-mode 1)
(setq-local completion-at-point-functions
2023-10-20 15:27:19 -07:00
'(rng-completion-at-point cape-file)))
(add-to-list 'auto-mode-alist
`(,(concat
(regexp-opt '("gschema" "gresource" "ui")) "\\'") . nxml-mode)))
2024-01-09 01:35:55 -08:00
;; (La)TeX
(use-package tex-mode
:hook (latex-mode . eglot-ensure))
2023-10-20 15:27:19 -07:00
;; blueprint
(use-package blueprint-ts-mode
2024-01-09 01:35:55 -08:00
:hook (blueprint-ts-mode . eglot-ensure)
2023-10-20 15:27:19 -07:00
:after eglot)
2023-10-20 14:21:20 -07:00
2024-01-09 01:35:55 -08:00
;; python-ts-mode
(use-package python-ts-mode
:ensure nil
:hook (python-ts-mode . eglot-ensure))
;; java-ts-mode
(use-package java-ts-mode
:hook (java-ts-mode . eglot-ensure))
2024-01-08 16:26:25 -08:00
;; c-ts-mode
(use-package c-ts-mode
:after evil
2024-01-09 01:35:55 -08:00
:hook ((c-ts-mode c++-ts-mode) . eglot-ensure)
2024-01-08 16:26:25 -08:00
:bind (:map c-ts-mode-map
("C-c d" . realgud:gdb)
:map c++-ts-mode-map
("C-c d" . realgud:gdb)
:map objc-mode-map
("C-c d" . realgud:gdb))
:init
(setq-default c-ts-mode-indent-offset 4)
:config
(evil-define-key 'normal 'c-ts-mode-map
"go" #'ff-find-other-file
"gO" #'ff-find-other-file-other-window)
(evil-define-key 'normal 'c++-ts-mode-map
"go" #'ff-find-other-file
"gO" #'ff-find-other-file-other-window)
(evil-define-key 'normal 'objc-mode-map
"go" #'ff-find-other-file
"gO" #'ff-find-other-file-other-window))
2024-01-09 01:35:55 -08:00
;; php-mode
(use-package php-mode
:hook (php-mode . eglot-ensure))
;; web-mode
(use-package web-mode
:hook (web-mode . eglot-ensure)
:init
(add-to-list 'eglot-server-programs
'(web-mode . ("vscode-html-language-server" "--stdio"))))
;; Polymode
(use-package polymode
:config
(define-hostmode my/poly-web-hostmode
:mode 'web-mode)
(define-innermode my/poly-php-innermode
:mode 'php-mode
:head-matcher "\<\?php"
:tail-matcher "\?\>"
:head-mode 'body
:tail-mode 'body)
(define-polymode my/poly-web-mode
:hostmode 'my/poly-web-hostmode
:innermodes '(my/poly-php-innermode))
(add-to-list 'auto-mode-alist '("\\.php\\|\\.phtml\\'" . my/poly-web-mode)))
2023-09-20 00:50:34 -07:00
;; rust
(use-package rust-mode)
2024-01-09 01:35:55 -08:00
(use-package rust-ts-mode
:ensure nil
:hook (rust-ts-mode . eglot-ensure))
2023-09-20 00:50:34 -07:00
;; markdown
2023-12-13 01:28:49 -08:00
(use-package markdown-mode
2024-01-09 01:35:55 -08:00
:hook ((markdown-mode . auto-fill-mode)
(markdown-mode . eglot-ensure)))
2023-12-01 13:15:13 -08:00
;; groovy
(use-package groovy-mode)
;; cmake
2023-11-27 15:53:58 -08:00
(require 'cmake-mode)
(with-eval-after-load 'cmake-mode
(defun my/setup-cmake-ts-mode ()
"Setup `cmake-ts-mode' buffers."
2023-11-27 15:53:58 -08:00
(setq-local indent-line-function #'cmake-indent))
(add-hook 'cmake-ts-mode-hook #'my/setup-cmake-ts-mode))
2023-09-20 00:50:34 -07:00
;; json
(use-package json-mode)
2023-10-13 11:41:29 -07:00
;; firejail
(require 'firejail-mode)
2023-09-23 16:48:22 -07:00
;; yaml
(use-package yaml-mode)
2023-10-10 14:14:30 -07:00
;; yuck (config language for eww)
(use-package yuck-mode)
2023-09-21 16:02:36 -07:00
;; sly
(use-package sly
:hook (lisp-mode . my/common-lisp-autoconnect-sly)
:autoload sly-connected-p
:init
(defun my/common-lisp-autoconnect-sly ()
(unless (sly-connected-p)
(save-excursion (sly))))
(setq inferior-lisp-program "/usr/bin/sbcl"))
2023-12-24 04:58:55 -08:00
;; pdf-tools
(use-package pdf-tools
:hook (pdf-view-mode . my/setup-pdf-view-mode)
:init
(defun my/setup-pdf-view-mode ()
(display-line-numbers-mode -1)
(setq-local cursor-type nil))
2024-01-02 23:45:05 -08:00
(pdf-tools-install))
2023-12-24 04:58:55 -08:00
;; calc
(use-package calc
:ensure nil
:bind (:map calc-mode-map
("M-<tab>" . calc-roll-up)
("M-TAB" . calc-roll-up))
:hook ((calc-mode calc-trail-mode) . my/setup-calc-calc-trail-mode)
:init
(defun my/setup-calc-calc-trail-mode ()
(setq-local doom-modeline-percent-position '()
truncate-partial-width-windows nil)
(visual-line-mode -1)
(display-line-numbers-mode -1)
(line-number-mode -1)
(column-number-mode -1)
(toggle-truncate-lines 1))
:config
(evil-define-key '(normal visual motion) calc-edit-mode-map
(kbd "RET") 'calc-edit-return
(kbd "<return>") 'calc-edit-return)
(defun my/-calc-float-mode-string ()
(cl-destructuring-bind (mode prec) calc-float-format
(concat
(upcase-initials (symbol-name mode))
(unless (zerop prec)
(concat ": " (number-to-string prec))))))
(doom-modeline-def-segment calc
"Display calculator icons and info.
Take directly from doom-modeline."
(concat
(doom-modeline-spc)
(when-let ((icon (doom-modeline-icon 'faicon "nf-fa-calculator" "🖩" "")))
(concat
(doom-modeline-display-icon icon)
(doom-modeline-vspc)))
(doom-modeline--buffer-simple-name)
(when (eq major-mode 'calc-mode)
(concat
(doom-modeline-spc)
(number-to-string calc-internal-prec)
(doom-modeline-spc)
(upcase-initials (symbol-name calc-angle-mode))
(doom-modeline-spc)
(my/-calc-float-mode-string)
(when calc-prefer-frac
(concat
(doom-modeline-spc)
"Frac"))
(cond
(calc-algebraic-mode
(concat
(doom-modeline-spc)
"Alg"))
(calc-incomplete-algebraic-mode
(concat
(doom-modeline-spc)
"IAlg"))))))))
2023-12-27 22:43:15 -08:00
;; eat
(use-package eat
:config
(defvar my/project-eat-hash-table (make-hash-table :test 'equal)
"Hash table that maps project root dirs to eat buffers.")
(defun my/project-eat (prompt)
"Switch to or create a eat buffer in the current projects root."
2023-11-07 03:19:30 -08:00
(interactive (list t))
(if-let ((proj (project-current prompt))
(default-directory (project-root proj)))
2023-12-27 22:43:15 -08:00
(if-let ((eat-buff (gethash default-directory
my/project-eat-hash-table))
((buffer-live-p eat-buff)))
(switch-to-buffer eat-buff)
(let ((eat-buffer-name (concat "*eat for project " default-directory "*")))
(puthash default-directory
(eat)
2024-01-07 21:46:38 -08:00
my/project-eaeat-hash-table)))))
2023-12-27 22:43:15 -08:00
(defun my/project-eat-or-default ()
"Open an eat for the current project, otherwise, open a normal eat."
2023-11-07 03:19:30 -08:00
(interactive)
2023-12-27 22:43:15 -08:00
(unless (my/project-eat nil)
(if-let ((eat-buff (gethash nil my/project-eat-hash-table))
((buffer-live-p eat-buff)))
(switch-to-buffer eat-buff)
(puthash nil (eat) my/project-eat-hash-table)))))
2023-11-06 02:34:54 -08:00
;; eshell stuff
(use-package eshell
:ensure nil
:defer nil
2023-11-07 03:19:30 -08:00
:hook ((eshell-load . eat-eshell-visual-command-mode)
(eshell-load . eat-eshell-mode)
(eshell-mode . my/-eshell-mode-setup))
2023-11-06 02:34:54 -08:00
:init
2023-11-07 03:19:30 -08:00
(defun my/-eshell-mode-setup ()
"Setup function run from `eshell-mode-hook'"
(setq-local corfu-auto nil))
2023-11-06 02:34:54 -08:00
(setq-default eshell-command-aliases-list
2023-11-07 03:19:30 -08:00
'(("clear" "clear t")
("e" "find-file $1")
("n" "find-file $1")
("emacs" "find-file $1")
("nvim" "find-file $1")
("ls" "eza --git -F $*")
("la" "ls -a $*")
("l" "ls -l $*")
("ll" "la -l $*")
("gt" "git status $*")
("gp" "git push $*")
("gu" "git pull $*")
("gf" "git fetch $*")
("ga" "git add $*")
2023-11-07 19:46:14 -08:00
("gcm" "git commit -m ${string-join $* \" \"}")
2023-11-27 21:45:25 -08:00
("ldg" "ledger -f \"$HOME/docs/finance/finances.ledger\" $*")
("tp" "trash-put $*")
("trr" "trash-restore $*")
("tre" "trash-empty $*")
("tre" "trash-empty $*")
("trm" "trash-rm $*")
2023-12-24 04:58:55 -08:00
("rm" "echo 'rm: I''m unsafe! Don''t use me.'; false")
("\\rm" "eshell/rm")))
2023-11-07 03:19:30 -08:00
(defun eshell/bm (&optional name)
"Change to directory of bookmark NAME.
If no name is given, list all bookmarks instead."
(if name
(eshell/cd (bookmark-get-filename name))
(eshell-print (string-join (bookmark-all-names) " "))))
(defun my/-replace-home-with-tilda (path)
(let ((home (getenv "HOME")))
(if (equal home path)
"~"
(setq home (file-name-as-directory home))
(if (string-prefix-p home path)
(concat "~/" (seq-subseq path (length home)))
path))))
(defun my/-eshell-prompt-cut-path (num path)
"Cut PATH down to NUM components."
(let ((parts (string-split path "/" t nil)))
(concat
(when (and (file-name-absolute-p path)
(not (equal "~" (car parts)))
(<= (length parts) num))
"/")
(string-join (last parts num) "/"))))
(defun my/-eshell-prompt-get-dir ()
"Get dir for `my/-eshell-prompt-function'"
2023-12-27 22:43:15 -08:00
(my/-eshell-prompt-cut-path 3
(if-let ((worktree (vc-root-dir))
(parent (file-name-parent-directory worktree)))
(file-relative-name default-directory parent)
(my/-replace-home-with-tilda default-directory))))
2023-11-07 03:19:30 -08:00
(defun my/-eshell-prompt-status-char-for-branch (branch remote)
"Get the status char representing the relation between BRANCH and REMOTE."
(let ((lines (process-lines vc-git-program
"rev-list"
"--left-right"
(concat branch "..." remote)))
(to-remote nil)
(to-local nil))
(dolist (line lines)
(if-let (((not (string-empty-p line)))
(dir-char (aref line 0)))
(if (= dir-char ?<)
2023-11-07 19:47:29 -08:00
(setq to-remote t)
(setq to-local t))))
2023-11-07 03:19:30 -08:00
(cond
((and to-remote to-local) ?󰹺)
(to-remote ?󰜷)
(to-local ?󰜮))))
2023-12-27 22:43:15 -08:00
(defun my/-eshell-prompt-current-branch-status ()
"Get the status char for the current branch and its remote."
(let ((refs (process-lines vc-git-program
"for-each-ref"
"--format=%(HEAD)%00%(refname:short)%00%(upstream:short)"
"refs/heads")))
(catch 'break
(dolist (ref refs)
(if-let ((split-ref (split-string ref "\0" nil nil))
((equal (car split-ref) "*")))
(throw 'break (my/-eshell-prompt-status-char-for-branch
(cadr split-ref)
(caddr split-ref))))))))
(defun my/-eshell-prompt-git-state-chars ()
"Get chars, like + and ✘ for `my/-eshell-prompt-function'."
(let ((lines (process-lines vc-git-program "status" "--porcelain=v1"))
(branch-status (my/-eshell-prompt-current-branch-status))
(status-arr))
(dolist (line lines)
(cl-loop with fields = (string-split line " " t " *")
with status-str = (car-safe fields)
for status-char across status-str
do
(cond ((or (= status-char ?M) (= status-char ?T))
(add-to-list 'status-arr ?!))
((= status-char ??)
(add-to-list 'status-arr ??))
((or (= status-char ?A) (= status-char ?C))
(add-to-list 'status-arr ?+))
((= status-char ?D)
(add-to-list 'status-arr ?))
((= status-char ?R)
(add-to-list 'status-arr )))))
(sort status-arr #'<)
(when branch-status
(push branch-status status-arr))
(apply 'string status-arr)))
(defun my/-eshell-prompt-git-get-operation ()
"Return the current git operation. For example, a revert."
(let ((git-dir (expand-file-name ".git" (vc-git-root default-directory))))
(cond
((file-exists-p (expand-file-name "REVERT_HEAD" git-dir))
"REVERTING"))))
2023-12-27 22:43:15 -08:00
(defun my/-eshell-prompt-git-status ()
"Get git status for `my/-eshell-prompt-function'"
(let ((branch (car (vc-git-branches)))
(state (my/-eshell-prompt-git-state-chars))
(operation (my/-eshell-prompt-git-get-operation)))
2023-12-27 22:43:15 -08:00
(concat
(propertize (concat " 󰊢 " branch) 'face '(:foreground "medium purple"))
(unless (string-empty-p state)
(propertize (concat " [" state "]") 'face '(:foreground "red")))
(when operation
(concat " (" (propertize operation 'face
'(:weight 'bold :foreground "yellow")) ")")))))
2023-12-27 22:43:15 -08:00
(defun my/-eshell-prompt-vc-status ()
"Get vc status for `my/-eshell-prompt-function'."
(if-let (backend (vc-responsible-backend default-directory t))
(if (eq backend 'Git)
(my/-eshell-prompt-git-status)
(my/-eshell-prompt-set-face-color
(concat "" (downcase (symbol-name backend)))
"purple"))))
(defvar-local my/-eshell-prompt-last-start-time nil
"Start time of last eshell command.")
(defun my/-eshell-prompt-timer-pre-cmd ()
"Command run before each eshell program to record the time."
(setq my/-eshell-prompt-last-start-time (current-time)))
(add-hook 'eshell-pre-command-hook #'my/-eshell-prompt-timer-pre-cmd)
(defun my/-eshell-prompt-format-span (span)
"Format SPAN as \"XhXms.\""
(let* ((hours (/ span 3600))
(mins (% (/ span 60) 60))
(secs (% span 60)))
(concat (unless (= hours 0)
(format "%dh" hours))
(unless (= mins 0)
(format "%dm" mins))
(format "%ds" secs))))
(defun my/-eshell-prompt-last-command-time (end-time)
"Return the prompt component for the time of the last command."
(if-let ((my/-eshell-prompt-last-start-time)
(len (time-subtract end-time
my/-eshell-prompt-last-start-time))
(float-len (float-time len))
((< 3 float-len))
(int-len (round float-len)))
(concat " time "
(propertize (my/-eshell-prompt-format-span int-len)
'face '(:foreground "gold1")))))
(defun my/-eshell-prompt-function ()
"Function for `eshell-prompt-function'"
(let* ((end-time (current-time))
(dir (my/-eshell-prompt-get-dir))
(prompt (concat
"\n"
(propertize dir 'face '(:foreground "dark turquoise"))
(unless (file-writable-p dir)
"")
(my/-eshell-prompt-vc-status)
(my/-eshell-prompt-last-command-time end-time)
(propertize "\n" 'read-only t 'rear-nonsticky t)
(propertize
" " 'face `(:foreground
,(if (= eshell-last-command-status 0)
"lime green"
"red"))
'rear-nonsticky t))))
(setq my/-eshell-prompt-last-start-time nil)
prompt))
(setq eshell-prompt-function #'my/-eshell-prompt-function
eshell-prompt-regexp "^ "
eshell-highlight-prompt nil))
2023-11-06 02:34:54 -08:00
(use-package esh-help
:hook (eshell-mode . my/-setup-eshell-help-func)
:init
(defun my/-setup-eshell-help-func ()
(eldoc-mode 1)
(setq-local evil-lookup-func #'esh-help-run-help))
(setup-esh-help-eldoc))
(use-package eshell-syntax-highlighting
:init
(eshell-syntax-highlighting-global-mode 1))
2023-09-18 15:06:41 -07:00
;; proced
(use-package proced
2023-09-27 04:07:01 -07:00
:bind ("C-x j" . proced)
2023-09-18 15:06:41 -07:00
:init
(setq proced-auto-update-flag t
2023-09-20 00:50:34 -07:00
proced-auto-update-interval 1))
2023-09-18 15:06:41 -07:00
;; dired
(use-package dired
:ensure nil
:init
2023-10-30 22:57:54 -07:00
(setq-default dired-kill-when-opening-new-dired-buffer t)
2024-01-06 22:39:55 -08:00
(setq delete-by-moving-to-trash t
dired-recursive-copies 'always
dired-recursive-deletes 'always
dired-dwim-target t
dired-create-destination-dirs 'ask
dired-create-destination-dirs-on-trailing-dirsep t
dired-isearch-filenames 'dwim
dired-do-revert-buffer (lambda (dir)
(not (file-remote-p dir)))
dired-clean-up-buffers-too t
dired-clean-confirm-killing-deleted-buffers t)
2023-09-18 15:06:41 -07:00
(evil-define-key '(normal visual motion) dired-mode-map
2023-09-21 03:20:43 -07:00
"u" #'dired-unmark
"U" #'dired-unmark-all-marks))
2023-09-18 15:06:41 -07:00
2023-09-22 02:53:16 -07:00
;; ibuffer
(use-package ibuffer
:bind ("C-x C-b" . ibuffer))
2023-09-18 15:06:41 -07:00
;; magit
2023-12-27 22:49:30 -08:00
(use-package magit
:init
(evil-define-key '(normal visual motion) magit-mode-map
"s" #'magit-stage-file
"S" #'magit-stage-modified))
2023-09-20 00:50:34 -07:00
2023-09-27 04:07:01 -07:00
;; org-mode
(use-package org
:bind (("C-c c" . org-capture)
("C-c a" . org-agenda)
("C-c l" . org-store-link)
:map org-mode-map
("C-c t" . org-table-create))
:init
(setq org-directory "~/org"
org-agenda-files '("~/org/")
org-log-into-drawer t
org-log-done 'time
org-log-redeadline 'time
org-log-reschedule 'time))
(use-package evil-org
:after org
2023-09-30 21:41:19 -07:00
:hook (org-mode . evil-org-mode)
2023-09-27 04:07:01 -07:00
:init
(require 'evil-org-agenda)
(evil-org-agenda-set-keys))
2023-11-07 19:36:39 -08:00
;; ledger
(use-package ledger-mode)
(use-package flycheck-ledger
:hook (ledger-mode . flycheck-mode))
2023-09-27 04:07:01 -07:00
;; khard contacts
(require 'khard)
2023-09-22 02:50:19 -07:00
;; mu4e
2023-09-23 16:48:22 -07:00
(require 'auth-source-pass)
(auth-source-pass-enable)
(use-package mu4e
:ensure nil
:defer nil
2023-10-19 01:30:50 -07:00
:hook ((mu4e-index-updated . my/-mu4e-enable-index-messages)
2024-01-04 00:14:49 -08:00
(mu4e-main-mode . my/-mu4e-setup-main-mode)
(mu4e-view-mode . my/-mu4e-setup-view-mode))
:bind (("C-x C-m" . mu4e)
("C-x m" . mu4e-compose-new)
:map message-mode-map
("C-c k" . khard-insert-email-contact))
:init
(require 'mu4e)
(evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer)
2024-01-04 00:14:49 -08:00
(defun my/-mu4e-setup-view-mode ()
(setq-local global-hl-line-mode nil))
2023-10-19 01:30:50 -07:00
(defun my/-mu4e-setup-main-mode ()
(setq-local default-directory "~/"))
(defun my/-mu4e-enable-index-messages ()
(setq mu4e-hide-index-messages nil))
(defun my/mu4e-update-mail-and-index-silent ()
"Run `mu4e-update-mail-and-index' without any messages in the background."
(setq mu4e-hide-index-messages t)
(mu4e-update-mail-and-index t))
(setq message-kill-buffer-on-exit t
message-send-mail-function 'sendmail-send-it
mu4e-change-filenames-when-moving t
mu4e-context-policy 'pick-first
mu4e-index-update-error-warning nil
mu4e-get-mail-command "mbsync protonmail"
mu4e-completing-read-function #'completing-read-default
2023-11-17 16:33:53 -08:00
mu4e-compose-context-policy 'ask-if-none
mu4e-contexts
`(,(make-mu4e-context
:name "Personal"
:enter-func (lambda () (mu4e-message "Entered personal context"))
:match-func (lambda (msg)
(when msg
(string-match-p "^/protonmail/"
(mu4e-message-field msg
:maildir))))
:vars `((user-mail-address . ,(auth-source-pass-get "email" "emacs/mu4e-protonmail"))
(user-full-name . ,(auth-source-pass-get "name" "emacs/mu4e-protonmail"))
(message-signature nil)
(mu4e-refile-folder . "/protonmail/Archive")
(mu4e-sent-folder . "/protonmail/Sent")
(mu4e-drafts-folder . "/protonmail/Drafts")
(mu4e-trash-folder . "/protonmail/Trash")
(mu4e-bookmarks . ((:name "Inbox"
:query "maildir:/protonmail/Inbox"
:key ?i)
(:name "Unread"
:query "flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam"
:key ?u))))))))
2023-09-22 02:50:19 -07:00
(use-package mu4e-alert
:after mu4e
:hook (after-init . mu4e-alert-enable-notifications)
2023-09-23 16:48:22 -07:00
:init
2023-11-17 16:33:53 -08:00
(setq mu4e-alert-set-window-urgency nil
mu4e-alert-interesting-mail-query
"flag:unread AND NOT flag:trashed AND NOT maildir:/protonmail/Spam")
2023-09-22 02:50:19 -07:00
:config
(mu4e-alert-set-default-style 'libnotify))
2023-09-27 04:07:01 -07:00
(mu4e t)
(mu4e-context-switch nil "Personal")
2023-09-22 02:50:19 -07:00
2024-01-08 21:02:11 -08:00
;; rainbow-delimiters
2023-09-20 00:50:34 -07:00
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
2023-09-18 13:05:09 -07:00
2024-01-08 21:02:11 -08:00
;; auto-highlight-symbol
(use-package auto-highlight-symbol
:hook (lisp-data-mode . auto-highlight-symbol-mode)
:init
(setq ahs-face 'bold
ahs-face-unfocused 'bold
2024-01-08 21:32:05 -08:00
ahs-definition-face 'bold
ahs-definition-face-unfocused 'bold
2024-01-08 21:02:11 -08:00
ahs-plugin-default-face 'bold
ahs-plugin-default-face-unfocused 'bold))
2023-09-18 13:05:09 -07:00
;; Theme (doom-themes)
(use-package doom-themes
:config
(load-theme 'doom-molokai t)
(doom-themes-org-config))
;; solaire-mode
(use-package solaire-mode
:config
(solaire-global-mode 1))
2023-09-21 03:20:43 -07:00
;; icons
(use-package nerd-icons)
(use-package nerd-icons-completion
:config
(nerd-icons-completion-mode))
(use-package nerd-icons-dired
:hook (dired-mode . nerd-icons-dired-mode))
(use-package kind-icon
:after corfu
:init
(setq kind-icon-default-face 'corfu-default
kind-icon-default-style
'(:padding -1 :stroke 0 :margin 0 :radius 0 :height 0.5 :scale 1))
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
;; modeline (doom-modeline)
(use-package doom-modeline
:init
(setq doom-modeline-support-imenu t)
(doom-modeline-mode 1))
2023-09-27 04:07:01 -07:00
2023-09-29 23:13:35 -07:00
;; dashboard.el
(use-package dashboard
:config
(dashboard-setup-startup-hook)
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))
2024-01-07 02:56:59 -08:00
dashboard-force-refresh t
2023-09-29 23:13:35 -07:00
dashboard-display-icons-p t
dashboard-icon-type 'nerd-icons
dashboard-set-file-icons t
dashboard-projects-backend 'project-el
2023-09-29 23:13:35 -07:00
dashboard-items '((recents . 5)
(projects . 5)
2023-09-29 23:13:35 -07:00
(bookmarks . 5))))
2023-10-24 01:14:38 -07:00
;; page break lines
(use-package page-break-lines
:config
(global-page-break-lines-mode 1))
2023-09-27 04:07:01 -07:00
;;; init.el ends here