This commit is contained in:
Mars 2024-10-13 01:00:36 -04:00
parent 34fd407bf2
commit 983077017a
Signed by: pupbrained
GPG key ID: 874E22DF2F9DFCB5
2 changed files with 132 additions and 90 deletions

View file

@ -1,3 +1,5 @@
;; -*- lexical-binding: t; -*-
#+TITLE: Emacs Configuration #+TITLE: Emacs Configuration
#+AUTHOR: Mars (@pupbrained) #+AUTHOR: Mars (@pupbrained)
#+EMAIL: mars@pupbrained.xyz #+EMAIL: mars@pupbrained.xyz
@ -260,88 +262,88 @@
*** Eglot *** Eglot
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package markdown-mode (use-package markdown-mode
:ensure t :ensure t
:mode ("README\\.md\\'" . gfm-mode) :mode ("README\\.md\\'" . gfm-mode)
:init (setq markdown-command "multimarkdown") :init (setq markdown-command "multimarkdown")
:bind (:map markdown-mode-map :bind (:map markdown-mode-map
("C-c C-e" . markdown-do))) ("C-c C-e" . markdown-do)))
(use-package eglot-booster (use-package eglot-booster
:after eglot :after eglot
:ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster") :ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
:config (eglot-booster-mode)) :config (eglot-booster-mode))
(use-package eglot (use-package eglot
:ensure nil :ensure nil
:config :config
(defun my-eglot-rename (newname) (defun my-eglot-rename (newname)
"Rename the current symbol to NEWNAME with initial input a." "Rename the current symbol to NEWNAME with initial input a."
(interactive (interactive
(list (read-from-minibuffer (list (read-from-minibuffer
(format "Rename `%s' to: " (or (thing-at-point 'symbol t) (format "Rename `%s' to: " (or (thing-at-point 'symbol t)
(error "no symbol at point"))) (error "no symbol at point")))
(or (thing-at-point 'symbol t) "") nil nil nil (or (thing-at-point 'symbol t) "") nil nil nil
(symbol-name (symbol-at-point))))) (symbol-name (symbol-at-point)))))
(eglot--server-capable-or-lose :renameProvider) (eglot--server-capable-or-lose :renameProvider)
(eglot--apply-workspace-edit (eglot--apply-workspace-edit
(jsonrpc-request (eglot--current-server-or-lose) (jsonrpc-request (eglot--current-server-or-lose)
:textDocument/rename `(,@(eglot--TextDocumentPositionParams) :textDocument/rename `(,@(eglot--TextDocumentPositionParams)
:newName ,newname)) :newName ,newname))
current-prefix-arg)) current-prefix-arg))
(fset #'jsonrpc--log-event #'ignore) (fset #'jsonrpc--log-event #'ignore)
(setopt eglot-events-buffer-size 0) (setopt eglot-events-buffer-size 0)
(defun eglot-format-buffer-on-save () (defun eglot-format-buffer-on-save ()
(when (not (derived-mode-p 'python-ts-mode)) (when (not (derived-mode-p 'python-ts-mode))
(add-hook 'before-save-hook #'eglot-format-buffer -10 t))) (add-hook 'before-save-hook #'eglot-format-buffer -10 t)))
(add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save) (add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save)
(add-to-list 'eglot-server-programs '(nix-mode . ("nixd"))) (add-to-list 'eglot-server-programs
(add-to-list 'eglot-server-programs '(nix-mode . ("nixd"))
`(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))) `(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never")))
:hook :hook
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure) (rust-ts-mode . eglot-ensure)
(sh-script-mode . eglot-ensure) (sh-script-mode . eglot-ensure)
(python-mode . eglot-ensure) (python-mode . eglot-ensure)
(python-ts-mode . eglot-ensure) (python-ts-mode . eglot-ensure)
(json-mode . eglot-ensure) (json-mode . eglot-ensure)
(json-ts-mode . eglot-ensure) (json-ts-mode . eglot-ensure)
(nix-mode . eglot-ensure) (nix-mode . eglot-ensure)
(yaml-mode . eglot-ensure) (yaml-mode . eglot-ensure)
(yaml-ts-mode . eglot-ensure) (yaml-ts-mode . eglot-ensure)
(c-mode . eglot-ensure) (c-mode . eglot-ensure)
(c-ts-mode . eglot-ensure) (c-ts-mode . eglot-ensure)
(c++-mode . eglot-ensure) (c++-mode . eglot-ensure)
(c++-ts-mode . eglot-ensure) (c++-ts-mode . eglot-ensure)
(c3-ts-mode . eglot-ensure) (c3-ts-mode . eglot-ensure)
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(go-mode . eglot-ensure) (go-mode . eglot-ensure)
(go-ts-mode . eglot-ensure)) (go-ts-mode . eglot-ensure))
(use-package rust-mode (use-package rust-mode
:ensure t) :ensure t)
(use-package tuareg (use-package tuareg
:ensure t :ensure t
:mode ("\\.ml\\'" . tuareg-mode) :mode ("\\.ml\\'" . tuareg-mode)
:hook (tuareg-mode . eglot-ensure)) :hook (tuareg-mode . eglot-ensure))
(use-package merlin (use-package merlin
:ensure t :ensure t
:hook (tuareg-mode . merlin-mode)) :hook (tuareg-mode . merlin-mode))
(use-package glsl-mode (use-package glsl-mode
:ensure t :ensure t
:mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'")) :mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))
(use-package eldoc-box (use-package eldoc-box
:custom :custom
(eldoc-box-max-pixel-width 1024) (eldoc-box-max-pixel-width 1024)
:config :custom-face
(setq eldoc-message-function #'ignore) (eldoc-box-body ((t (:family "Iosevka Comfy Motion" :background "#181825" :foreground "#cdd6f4"))))
(setq eldoc-idle-delay 0) :config
(custom-set-faces (setq eldoc-message-function #'ignore
'(eldoc-box-body ((t (:family "Iosevka Comfy Motion" :height 140 :background "#181825" :foreground "#cdd6f4")))))) eldoc-idle-delay 0))
#+end_src #+end_src
*** Apheleia *** Apheleia
@ -351,12 +353,10 @@
:ensure t :ensure t
:config :config
(add-to-list 'apheleia-formatters (add-to-list 'apheleia-formatters
'(alejandra "alejandra" "--quiet" "-")) '(alejandra "alejandra" "--quiet" "-")
(add-to-list 'apheleia-formatters
'(clang-format "clang-format")) '(clang-format "clang-format"))
(add-to-list 'apheleia-mode-alist (add-to-list 'apheleia-mode-alist
'(nix-mode . alejandra)) '(nix-mode . alejandra)
(add-to-list 'apheleia-mode-alist
'(c-mode . clang-format)) '(c-mode . clang-format))
(add-to-list 'apheleia-mode-alist (add-to-list 'apheleia-mode-alist
'(c++-mode . clang-format)) '(c++-mode . clang-format))
@ -433,14 +433,6 @@
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)) (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
#+end_src #+end_src
** Disable Bars
#+begin_src emacs-lisp
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
#+end_src
** Line Numbers ** Line Numbers
#+begin_src emacs-lisp #+begin_src emacs-lisp

View file

@ -1,4 +1,54 @@
;; -*- lexical-binding: t; -*-
;;; early-init.el --- Emacs pre package.el & GUI configuration -*- lexical-binding: t; -*-
(setq package-enable-at-startup nil) (setq package-enable-at-startup nil)
(setq tab-always-indent 'complete) (setq inhibit-default-init nil)
(setq text-mode-ispell-word-completion nil)
(setq read-extended-command-predicate #'command-completion-default-include-p) (setq native-comp-async-report-warnings-errors nil)
(defvar default-file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
(setq gc-cons-threshold most-positive-fixnum
gc-cons-percentage 1)
(defun +gc-after-focus-change ()
"Run GC when frame loses focus."
(run-with-idle-timer
5 nil
(lambda () (unless (frame-focus-state) (garbage-collect)))))
(defun +reset-init-values ()
(run-with-idle-timer
1 nil
(lambda ()
(setq file-name-handler-alist default-file-name-handler-alist
gc-cons-percentage 0.1
gc-cons-threshold 100000000)
(message "gc-cons-threshold & file-name-handler-alist restored")
(when (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function #'+gc-after-focus-change)))))
(with-eval-after-load 'elpaca
(add-hook 'elpaca-after-init-hook '+reset-init-values))
(push '(menu-bar-lines . 0) default-frame-alist)
(push '(tool-bar-lines . 0) default-frame-alist)
(push '(vertical-scroll-bars) default-frame-alist)
(setq server-client-instructions nil)
(setq frame-inhibit-implied-resize t)
(push '(font . "Iosevka Comfy Motion") default-frame-alist)
(set-face-font 'default "Iosevka Comfy Motion")
(set-face-font 'variable-pitch "Iosevka Comfy Motion Duo")
(copy-face 'default 'fixed-pitch)
(advice-add #'x-apply-session-resources :override #'ignore)
(setq desktop-restore-forces-onscreen nil)
(setq ring-bell-function #'ignore
inhibit-startup-screen t)