refactor(emacs): more improvements

This commit is contained in:
Price Hiller 2024-05-07 22:53:43 -05:00
parent 792f5b03c4
commit e3898adcab
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
8 changed files with 88 additions and 55 deletions

View File

@ -1,5 +1,7 @@
* *
!.gitignore !.gitignore
!init.el !init.el
!lisp
!early-init.el !early-init.el
!config
!config/*
!config/**/*

View File

@ -0,0 +1,9 @@
(use-package flymake
:ensure nil
:init
(define-globalized-minor-mode global-flymake-mode flymake-mode
(lambda () (flymake-mode t)))
:custom
(flymake-show-diagnostics-at-end-of-line t)
:config
(global-flymake-mode))

View File

@ -0,0 +1,16 @@
(use-package indent-bars
:ensure (:host github
:depth 1
:repo "jdtsmith/indent-bars")
:init
(define-globalized-minor-mode global-indent-bars-mode indent-bars-mode
(lambda () (indent-bars-mode t)))
:custom
(indent-bars-starting-column 0)
(indent-bars-pad-frac 0.2)
(indent-bars-treesit-support t)
(indent-bars-pattern ".")
(indent-bars-display-on-blank-lines nil)
(indent-bars-width-frace 0.2)
:config
(global-indent-bars-mode t))

View File

@ -0,0 +1,6 @@
(use-package indent-bars
:ensure (:host github
:depth 1
:repo "jdtsmith/indent-bars")
:custom
(indent-bars-width-frace 0.2))

View File

@ -0,0 +1,20 @@
;;; -*- lexical-binding: t -*-
;;; Colorize color names and delims
;; Set background colors for color codes
(use-package rainbow-mode
:init
(define-globalized-minor-mode global-rainbow-mode rainbow-mode
(lambda () (rainbow-mode t)))
:config
(global-rainbow-mode t))
(use-package rainbow-delimiters
:init
(define-globalized-minor-mode global-rainbow-delimiters-mode rainbow-delimiters-mode
(lambda () (rainbow-delimiters-mode t)))
:config
(global-rainbow-delimiters-mode t))

View File

@ -1,3 +1,4 @@
;;; -*- lexical-binding: t -*-
(set-face-attribute 'default nil :family "Fira Code" :height 120) (set-face-attribute 'default nil :family "Fira Code" :height 120)
(set-face-attribute 'fixed-pitch nil :family "Fira Code":height 130) (set-face-attribute 'fixed-pitch nil :family "Fira Code":height 130)
(set-face-attribute 'variable-pitch nil :family "Fira Code":height 130) (set-face-attribute 'variable-pitch nil :family "Fira Code":height 130)

View File

@ -56,14 +56,9 @@
(elpaca-wait) (elpaca-wait)
(general-create-definer key-leader (general-create-definer key-leader
:states 'normal :states '(normal override)
:prefix "SPC") :prefix "SPC")
(general-create-definer key-local-leader
:states 'normal
:prefix ";")
(key-leader (key-leader
:states 'normal :states 'normal
"/" '(comment-line :which-key "Comment: Toggle Current Line") "/" '(comment-line :which-key "Comment: Toggle Current Line")
@ -123,6 +118,8 @@
'(custom-safe-themes '(custom-safe-themes
'("d445c7b530713eac282ecdeea07a8fa59692c83045bf84dd112dd738c7bcad1d" '("d445c7b530713eac282ecdeea07a8fa59692c83045bf84dd112dd738c7bcad1d"
default)) default))
'(doom-modeline-check-simple-format t nil nil "Customized with use-package doom-modeline")
'(indent-bars-width-frac 0.05)
'(tool-bar-mode nil)) '(tool-bar-mode nil))
;; Doom Themes ;; Doom Themes
@ -165,9 +162,7 @@
:hook (ibuffer-mode . nerd-icons-ibuffer-mode)) :hook (ibuffer-mode . nerd-icons-ibuffer-mode))
(use-package nerd-icons-dired (use-package nerd-icons-dired
:after nerd-icons :after nerd-icons)
:init
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
(use-package treemacs (use-package treemacs
:defer t :defer t
@ -343,11 +338,14 @@
(corfu-min-width 60) (corfu-min-width 60)
(corfu-max-width corfu-min-width) (corfu-max-width corfu-min-width)
(corfu-cycle t) (corfu-cycle t)
(corfu-auto t)
(corfu-auto-prefix 1)
(corfu-on-exact-match nil)
(corfu-preselect 'prompt) (corfu-preselect 'prompt)
(corfu-separator ?\s)
(tab-always-indent 'complete) (tab-always-indent 'complete)
(corfu-scroll-margin 5) (corfu-scroll-margin 5)
(corfu-popupinfo-delay 0.1) (corfu-popupinfo-delay 0.1)
(corfu-separator ?\s)
:general :general
(:keymaps 'corfu-map (:keymaps 'corfu-map
:states 'insert :states 'insert
@ -362,6 +360,7 @@
"M-d" #'corfu-show-location) "M-d" #'corfu-show-location)
:init :init
(global-corfu-mode) (global-corfu-mode)
(corfu-history-mode)
(corfu-popupinfo-mode)) (corfu-popupinfo-mode))
;; Add extensions ;; Add extensions
@ -474,7 +473,6 @@
'(("flyspell-correct-*" grid reverse) '(("flyspell-correct-*" grid reverse)
(org-refile grid reverse indexed) (org-refile grid reverse indexed)
(consult-yank-pop indexed) (consult-yank-pop indexed)
(consult-flycheck)
(consult-lsp-diagnostics) (consult-lsp-diagnostics)
)) ))
:init :init
@ -587,10 +585,6 @@
:config :config
(undo-fu-session-global-mode)) (undo-fu-session-global-mode))
;; Set background colors for color codes
(use-package rainbow-mode
:config
(rainbow-mode t))
;; Setup Language Servers ;; Setup Language Servers
@ -598,14 +592,13 @@
:general :general
(key-leader (key-leader
:states 'visual :states 'visual
"l f r" '(lsp-format-buffer :which-key "LSP Format: Region")) "l f" '(lsp-format-buffer :which-key "LSP Format: Region"))
(key-leader (key-leader
:states 'normal :states 'normal
"k" '(lsp-ui-doc-glance :which-key "LSP: Glance Symbol") "k" '(lsp-ui-doc-glance :which-key "LSP: Glance Symbol")
"K" '(lsp-describe-thing-at-point :which-key "LSP: Full Doc") "K" '(lsp-describe-thing-at-point :which-key "LSP: Full Doc")
"l" '(nil :which-key "LSP") "l" '(nil :which-key "LSP")
"l f" '(nil :which-key "LSP Format") "l f" '(lsp-format-buffer :which-key "LSP Format: Buffer")
"l f f" '(lsp-format-buffer :which-key "LSP Format: Buffer")
"l i" '(lsp-treemacs-implementations :which-key "LSP: Implementation") "l i" '(lsp-treemacs-implementations :which-key "LSP: Implementation")
"l r" '(lsp-treemacs-references :which-key "LSP: Refrences") "l r" '(lsp-treemacs-references :which-key "LSP: Refrences")
"l n" '(lsp-rename :which-key "LSP: Rename") "l n" '(lsp-rename :which-key "LSP: Rename")
@ -621,6 +614,8 @@
:custom :custom
(lsp-keymap-prefix "M-l") (lsp-keymap-prefix "M-l")
(lsp-auto-execute-action 'nil) (lsp-auto-execute-action 'nil)
(lsp-auto-guess-root t)
(lsp-enable-which-key-integration t)
:hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
;; (XXX-mode . lsp) ;; (XXX-mode . lsp)
;; if you want which-key integration ;; if you want which-key integration
@ -661,45 +656,30 @@
(use-package rustic (use-package rustic
:general :general
(key-leader (key-leader
:states 'normal 'rustic-mode :states '(normal rustic-mode)
"f r" '(rustic-cargo-run :which-key "Cargo: Run")) "f r" '(rustic-cargo-run :which-key "Cargo: Run"))
:config :config
(rustic-mode)) (rustic-mode))
;;; Org Mode Appearance ------------------------------------ ;;; Org Mode Appearance ------------------------------------
(use-package org-bullets (require 'files)
:hook (org-mode-hook . (lambda () (use-package org
(org-bullets-mode 1) :hook (org-mode . org-indent-mode)
(org-toggle-pretty-entities)))) :general
(key-leader
:states 'normal
"o" '(nil :which-key "Org"))
:custom
(org-agenda-files '("~/Notes" "~/Git/College"))
(org-hide-emphasis-markers t))
;; Load org-faces to make sure we can set appropriate faces (use-package org-modern
(require 'org-faces) :after org
:config
(global-org-modern-mode))
;; Hide emphasis markers on formatted text ;; Emacs Settings
(setq org-hide-emphasis-markers t) (electric-pair-mode)
;; Resize Org headings
(dolist (face '((org-level-1 . 1.45)
(org-level-2 . 1.35)
(org-level-3 . 1.3)
(org-level-4 . 1.25)
(org-level-5 . 1.2)
(org-level-6 . 1.15)
(org-level-7 . 1.1)
(org-level-8 . 1.1)))
(set-face-attribute (car face) nil :font "Fira Code" :weight 'medium :height (cdr face)))
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
;; Misc settings
(menu-bar-mode -1) ; Disable menubar (menu-bar-mode -1) ; Disable menubar
(scroll-bar-mode -1) ; Disable visible scrollbar (scroll-bar-mode -1) ; Disable visible scrollbar
(tool-bar-mode -1) ; Disable toolbar (tool-bar-mode -1) ; Disable toolbar
@ -717,7 +697,6 @@
(recentf-mode t) (recentf-mode t)
(fset 'yes-or-no-p 'y-or-n-p) (fset 'yes-or-no-p 'y-or-n-p)
(save-place-mode 1) (save-place-mode 1)
(setq custom-file (locate-user-emacs-file "custom-vars.el"))
(load custom-file 'noerror 'nomessage) (mapc 'load (file-expand-wildcards (expand-file-name "./config/*.el" user-emacs-directory)))
(set-frame-parameter nil 'alpha-background 85) (mapc 'load (file-expand-wildcards (expand-file-name "./config/**/*.el" user-emacs-directory)))
(add-to-list 'default-frame-alist '(alpha-background . 85))