Refactor a bunch of things

This commit is contained in:
Alexander Rosenberg 2024-01-07 21:46:38 -08:00
parent 1a34528fbf
commit dd46b6edd6
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 162 additions and 160 deletions

126
disabled.el Normal file
View File

@ -0,0 +1,126 @@
;; icomplete
;; (use-package icomplete
;; :disable
;; :ensure nil
;; :demand t
;; :bind (:map icomplete-minibuffer-map
;; ("C-S-s" . kill-line)
;; ("C-j" . icomplete-forward-completions)
;; ("C-k" . icomplete-backward-completions)
;; ("DEL" . icomplete-fido-backward-updir)
;; ("M-DEL". delete-backward-char)
;; ("M-RET" . icomplete-force-complete-and-exit)
;; ("TAB" . icomplete-force-complete)
;; ("<escape>" . abort-recursive-edit)
;; ("C-;" . embark-dwim)
;; ("C-." . embark-act)
;; ("<left>" . backward-char)
;; ("<right>" . forward-char))
;; :hook (icomplete-minibuffer-setup . my/icomplete-setup-hook-func)
;; :init
;; (defun my/icomplete-setup-hook-func ()
;; (setq truncate-lines t))
;; (setq completion-ignore-case t
;; read-file-name-completion-ignore-case t
;; read-buffer-completion-ignore-case t
;; enable-recursive-minibuffers t
;; minibuffer-prompt-properties '(read-only t
;; cursor-intangible t
;; face minibuffer-prompt)
;; ;;completions-detailed t
;; icomplete-compute-delay 0
;; icomplete-scroll t)
;; (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)
;; (defun my/marginalia-trim-right (list)
;; (cl-loop for (cand prefix suffix) in list collect
;; (list cand prefix (string-trim-right suffix))))
;; (advice-add #'marginalia--align :filter-return #'my/marginalia-trim-right)
;; :config
;; (set-face-attribute 'icomplete-selected-match nil :inherit 'region)
;; (fido-mode 1)
;; (fido-vertical-mode 1))
;; flycheck
;; (use-package flycheck
;; :hook (emacs-lisp-mode . flycheck-mode)
;; :bind (:map flycheck-mode-map
;; ("C-c e" . my/flycheck-show-diagnostic-at-point))
;; :init
;; (setq flycheck-display-errors-function nil)
;; (defun my/flycheck-show-diagnostic-at-point ()
;; (interactive)
;; (if-let ((flycheck-mode)
;; (errors (flycheck-overlay-errors-at (point)))
;; (message (apply 'concat
;; (mapcar
;; (lambda (error)
;; (concat "•" (flycheck-error-message error) "\n"))
;; errors))))
;; (if (display-graphic-p)
;; (progn
;; (posframe-show " *flycheck-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 " *flycheck-error-posframe*"))
;; (popup-tip message)))))
;; (use-package consult-flycheck
;; :bind (:map flycheck-mode-map
;; ("C-c C-e" . consult-flycheck)))
;; lsp-mode
;; (use-package consult-lsp)
;; (use-package lsp-mode
;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
;; (lsp-mode . my/-setup-lsp-mode-buffer))
;; :init
;; (setq lsp-completion-provider :none
;; lsp-headerline-breadcrumb-enable nil
;; lsp-inlay-hint-enable nil
;; lsp-signature-doc-lines 1)
;; (defun my/-setup-lsp-mode-buffer ()
;; "Called by `lsp-mode-hook' to setup lsp-mode buffers."
;; (evil-define-key '(normal visual motion) 'local
;; "gR" #'lsp-rename
;; "gA" #'lsp-execute-code-action
;; "gs" #'consult-lsp-symbols)
;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
;; vterm
;; (use-package vterm
;; :hook (vterm-mode . with-editor-export-editor)
;; :init
;; (defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
;; "Hash table that maps project root dirs to vterm buffers.")
;; (defun my/project-vterm (prompt)
;; "Switch to or create a vterm buffer in the current projects root."
;; (interactive (list t))
;; (if-let ((proj (project-current prompt))
;; (default-directory (project-root proj)))
;; (if-let ((vterm-buff (gethash default-directory
;; my/project-vterm-hash-table))
;; ((buffer-live-p vterm-buff)))
;; (switch-to-buffer vterm-buff)
;; (puthash default-directory
;; (vterm (concat "*vterm for project " default-directory "*"))
;; my/project-vterm-hash-table))))
;; (defun my/project-vterm-or-default ()
;; "Open a vterm for the current project, otherwise, open a normal vterm."
;; (interactive)
;; (unless (my/project-vterm nil)
;; (if-let ((vterm-buff (gethash nil my/project-vterm-hash-table))
;; ((buffer-live-p vterm-buff)))
;; (switch-to-buffer vterm-buff)
;; (puthash nil (vterm vterm-buffer-name) my/project-vterm-hash-table)))))

196
init.el
View File

@ -64,11 +64,6 @@
(global-hl-line-mode 1) (global-hl-line-mode 1)
(blink-cursor-mode -1) (blink-cursor-mode -1)
;; Spell stuff
(setq ispell-program-name "hunspell"
flyspell-issue-message-flag nil
flyspell-issue-welcome-flag nil)
;; Enable all disabled stuff ;; Enable all disabled stuff
(setq disabled-command-function nil) (setq disabled-command-function nil)
@ -166,6 +161,15 @@
"go" #'ff-find-other-file "go" #'ff-find-other-file
"gO" #'ff-find-other-file-other-window)) "gO" #'ff-find-other-file-other-window))
;; 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))
;; recentf ;; recentf
(use-package recentf (use-package recentf
:init :init
@ -266,63 +270,16 @@ visual states."
(savehist-mode 1)) (savehist-mode 1))
;; vertico ;; vertico
;; (use-package vertico (use-package vertico
;; :bind (:map vertico-map :bind (:map vertico-map
;; ("C-S-k" . kill-line) ("C-S-k" . kill-line)
;; ("C-k" . vertico-previous) ("C-k" . vertico-previous)
;; ("C-j" . vertico-next) ("C-j" . vertico-next)
;; ("RET" . vertico-directory-enter) ("RET" . vertico-directory-enter)
;; ("DEL" . vertico-directory-delete-char) ("DEL" . vertico-directory-delete-char)
;; ("M-DEL" . vertico-directory-delete-word)) ("M-DEL" . vertico-directory-delete-word))
;; :hook (minibuffer-setup . cursor-intangible-mode) :hook (minibuffer-setup . cursor-intangible-mode)
;; :init
;; (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)
;; (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))
;; icomplete
(use-package icomplete
:ensure nil
:demand t
:bind (:map icomplete-minibuffer-map
("C-S-s" . kill-line)
("C-j" . icomplete-forward-completions)
("C-k" . icomplete-backward-completions)
("DEL" . icomplete-fido-backward-updir)
("M-DEL". delete-backward-char)
("M-RET" . icomplete-force-complete-and-exit)
("TAB" . icomplete-force-complete)
("<escape>" . abort-recursive-edit)
("C-;" . embark-dwim)
("C-." . embark-act)
("<left>" . backward-char)
("<right>" . forward-char))
:hook (icomplete-minibuffer-setup . my/icomplete-setup-hook-func)
:init :init
(defun my/icomplete-setup-hook-func ()
(setq truncate-lines t))
(setq completion-ignore-case t
read-file-name-completion-ignore-case t
read-buffer-completion-ignore-case t
enable-recursive-minibuffers t
minibuffer-prompt-properties '(read-only t
cursor-intangible t
face minibuffer-prompt)
;;completions-detailed t
icomplete-compute-delay 0
icomplete-scroll t)
(defun my/crm-indicator (args) (defun my/crm-indicator (args)
(cons (format "[CRM%s] %s" (cons (format "[CRM%s] %s"
(replace-regexp-in-string (replace-regexp-in-string
@ -331,14 +288,13 @@ visual states."
(car args)) (car args))
(cdr args))) (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'my/crm-indicator) (advice-add #'completing-read-multiple :filter-args #'my/crm-indicator)
(defun my/marginalia-trim-right (list) (setq vertico-cycle t
(cl-loop for (cand prefix suffix) in list collect enable-recursive-minibuffers t
(list cand prefix (string-trim-right suffix)))) read-extended-command-predicate #'command-completion-default-include-p
(advice-add #'marginalia--align :filter-return #'my/marginalia-trim-right) minibuffer-prompt-properties '(read-only t
:config cursor-intangible t
(set-face-attribute 'icomplete-selected-match nil :inherit 'region) face minibuffer-prompt))
(fido-mode 1) (vertico-mode 1))
(fido-vertical-mode 1))
;; orderless ;; orderless
(use-package orderless (use-package orderless
@ -349,18 +305,16 @@ visual states."
(setq-local completion-styles '(basic))) (setq-local completion-styles '(basic)))
(orderless-define-completion-style my/orderless-with-initialism (orderless-define-completion-style my/orderless-with-initialism
(orderless-matching-styles '(orderless-initialism (orderless-matching-styles '(orderless-initialism
orderless-literal
orderless-regexp))) orderless-regexp)))
(setq completion-styles '(orderless basic) (setq orderless-matching-styles '(orderless-regexp)
completion-styles '(orderless basic)
completion-category-defaults nil completion-category-defaults nil
completion-category-overrides '((file completion-category-overrides '((file
(styles basic partial-completion)) (styles basic partial-completion))
(command (command
(my/orderless-with-initialism basic)) (styles my/orderless-with-initialism basic)))))
(eglot
(orderless basic)))))
;; marginalia ; marginalia
(use-package marginalia (use-package marginalia
:bind (:map minibuffer-local-map :bind (:map minibuffer-local-map
("M-a" . marginalia-cycle)) ("M-a" . marginalia-cycle))
@ -369,12 +323,11 @@ visual states."
;; embark ;; embark
(use-package embark (use-package embark
:bind (("C-." . embark-act) :bind (("C-," . embark-act)
("C-;" . embark-dwim)) ("C-;" . embark-dwim)
:map help-map
("B" . embark-bindings))
:init :init
(evil-define-key '(normal visual motion operator insert replace) 'global
(kbd "M-e") #'embark-act
(kbd "M-E") #'embark-dwim)
(setq embark-quit-after-action nil) (setq embark-quit-after-action nil)
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
@ -427,7 +380,7 @@ visual states."
(setq corfu-cycle t (setq corfu-cycle t
corfu-auto t corfu-auto t
corfu-on-exact-match nil corfu-on-exact-match nil
completion-cycle-threshold 3) completion-cycle-threshold nil)
(global-corfu-mode 1) (global-corfu-mode 1)
(corfu-popupinfo-mode 1) (corfu-popupinfo-mode 1)
:config :config
@ -439,6 +392,7 @@ visual states."
;; cape (a bunch of capfs!) ;; cape (a bunch of capfs!)
(use-package cape (use-package cape
:bind (("C-c p" . cape-dabbrev) :bind (("C-c p" . cape-dabbrev)
([remap dabbrev-expand] . cape-dabbrev)
("C-c P" . cape-line)) ("C-c P" . cape-line))
:hook (text-mode . my/-cape-setup-text-mode) :hook (text-mode . my/-cape-setup-text-mode)
:init :init
@ -542,57 +496,6 @@ visual states."
"--header-insertion=never" "--pch-storage=memory" "--header-insertion=never" "--pch-storage=memory"
"--malloc-trim" "--function-arg-placeholders")))) "--malloc-trim" "--function-arg-placeholders"))))
;; flycheck
;; (use-package flycheck
;; :hook (emacs-lisp-mode . flycheck-mode)
;; :bind (:map flycheck-mode-map
;; ("C-c e" . my/flycheck-show-diagnostic-at-point))
;; :init
;; (setq flycheck-display-errors-function nil)
;; (defun my/flycheck-show-diagnostic-at-point ()
;; (interactive)
;; (if-let ((flycheck-mode)
;; (errors (flycheck-overlay-errors-at (point)))
;; (message (apply 'concat
;; (mapcar
;; (lambda (error)
;; (concat "•" (flycheck-error-message error) "\n"))
;; errors))))
;; (if (display-graphic-p)
;; (progn
;; (posframe-show " *flycheck-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 " *flycheck-error-posframe*"))
;; (popup-tip message)))))
;; (use-package consult-flycheck
;; :bind (:map flycheck-mode-map
;; ("C-c C-e" . consult-flycheck)))
;; lsp-mode
;; (use-package consult-lsp)
;; (use-package lsp-mode
;; :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode
;; latex-mode markdown-mode blueprint-ts-mode) . lsp-mode)
;; (lsp-mode . my/-setup-lsp-mode-buffer))
;; :init
;; (setq lsp-completion-provider :none
;; lsp-headerline-breadcrumb-enable nil
;; lsp-inlay-hint-enable nil
;; lsp-signature-doc-lines 1)
;; (defun my/-setup-lsp-mode-buffer ()
;; "Called by `lsp-mode-hook' to setup lsp-mode buffers."
;; (evil-define-key '(normal visual motion) 'local
;; "gR" #'lsp-rename
;; "gA" #'lsp-execute-code-action
;; "gs" #'consult-lsp-symbols)
;; (setq-local evil-lookup-func #'lsp-describe-thing-at-point)))
;; yasnippet ;; yasnippet
(use-package yasnippet (use-package yasnippet
:bind ("C-c s" . yas-expand) :bind ("C-c s" . yas-expand)
@ -796,33 +699,6 @@ Take directly from doom-modeline."
(doom-modeline-spc) (doom-modeline-spc)
"IAlg")))))))) "IAlg"))))))))
;; vterm
;; (use-package vterm
;; :hook (vterm-mode . with-editor-export-editor)
;; :init
;; (defvar my/project-vterm-hash-table (make-hash-table :test 'equal)
;; "Hash table that maps project root dirs to vterm buffers.")
;; (defun my/project-vterm (prompt)
;; "Switch to or create a vterm buffer in the current projects root."
;; (interactive (list t))
;; (if-let ((proj (project-current prompt))
;; (default-directory (project-root proj)))
;; (if-let ((vterm-buff (gethash default-directory
;; my/project-vterm-hash-table))
;; ((buffer-live-p vterm-buff)))
;; (switch-to-buffer vterm-buff)
;; (puthash default-directory
;; (vterm (concat "*vterm for project " default-directory "*"))
;; my/project-vterm-hash-table))))
;; (defun my/project-vterm-or-default ()
;; "Open a vterm for the current project, otherwise, open a normal vterm."
;; (interactive)
;; (unless (my/project-vterm nil)
;; (if-let ((vterm-buff (gethash nil my/project-vterm-hash-table))
;; ((buffer-live-p vterm-buff)))
;; (switch-to-buffer vterm-buff)
;; (puthash nil (vterm vterm-buffer-name) my/project-vterm-hash-table)))))
;; eat ;; eat
(use-package eat (use-package eat
:config :config
@ -840,7 +716,7 @@ Take directly from doom-modeline."
(let ((eat-buffer-name (concat "*eat for project " default-directory "*"))) (let ((eat-buffer-name (concat "*eat for project " default-directory "*")))
(puthash default-directory (puthash default-directory
(eat) (eat)
my/project-vterm-hash-table))))) my/project-eaeat-hash-table)))))
(defun my/project-eat-or-default () (defun my/project-eat-or-default ()
"Open an eat for the current project, otherwise, open a normal eat." "Open an eat for the current project, otherwise, open a normal eat."
(interactive) (interactive)