Many changes to config from various variables to plugins

Using minimal emacs as something of a guide here, but keeping
previous customizations as well.
This commit is contained in:
James Dixon 2025-03-20 08:30:55 -04:00
parent 6c87d3fb23
commit 17d8a9ebfd
2 changed files with 218 additions and 12 deletions

4
.gitignore vendored
View File

@ -3,3 +3,7 @@
*lazy-lock.json*
# helix
config/helix/.config/helix/runtime
history
places
recentf
tree-sitter

View File

@ -11,17 +11,35 @@
;;; Code:
(setq inhibit-startup-message t) ; Don't show the splash screen
(setq inhibit-splash-screen t) ; Do not show splash screen
(setq visible-bell t) ; Flash when the bell rings
(setq frame-resize-pixelwise t) ; Yes, I would like to be able to **resize** emacs, thanks!
(setq visible-bell nil) ; Flash when the bell rings
(setq frame-resize-pixelwise t) ; Yes, I would like to be able to **resize** emacs frame, thanks!
(setq window-resize-pixelwise nil); Not for windows inside emacs though
(global-display-line-numbers-mode 1) ; Display line numbers
(column-number-mode -1) ; Toggle column number display in the mode line.
(global-goto-address-mode 1) ; Make links and addresses go-to able
(column-number-mode -1) ; Toggle column number display in the mode line.
(global-goto-address-mode 1) ; Make links and addresses go-to able
(tool-bar-mode -1) ; Disable tool bar
(scroll-bar-mode -1) ; Disable scroll bar
(transient-mark-mode 1) ; Easier starting of marks/regions
(delete-selection-mode 1) ; Easier deleting of marks/regions
(tool-bar-mode -1) ; Disable tool bar
(scroll-bar-mode -1) ; Disable scroll bar
(transient-mark-mode 1) ; Easier starting of marks/regions
(delete-selection-mode 1) ; Easier deleting of marks/regions
;; Allow for shorter responses: "y" for yes and "n" for no.
(setq read-answer-short t)
(if (boundp 'use-short-answers)
(setq use-short-answers t)
(advice-add 'yes-or-no-p :override #'y-or-n-p))
;; Show paren differently
(setq show-paren-delay 0.1
show-paren-highlight-openparen t
show-paren-when-point-inside-paren t
show-paren-when-point-in-periphery t)
;;; Undo/redo
(setq undo-limit (* 13 160000)
undo-strong-limit (* 13 240000)
undo-outer-limit (* 13 24000000))
;; Theme
(set-frame-font "Maple Mono 12" nil t)
@ -38,6 +56,84 @@
(setq auto-save-file-name-transforms `((".*" "~/.config/emacs/saves/" t)))
(set-register ?e (find-file (or user-init-file "")))
;; No duplicates in kill ring
(setq kill-do-not-save-duplicates t)
;; `recentf' is an that maintains a list of recently accessed files.
(setq recentf-max-saved-items 300) ; default is 20
(setq recentf-max-menu-items 15)
(setq recentf-auto-cleanup (if (daemonp) 300 'never))
;; `savehist-mode' is an Emacs feature that preserves the minibuffer history
;; between sessions.
(setq history-length 300)
(setq savehist-save-minibuffer-history t) ;; Default
(setq savehist-additional-variables
'(kill-ring ; clipboard
register-alist ; macros
mark-ring global-mark-ring ; marks
search-ring regexp-search-ring)) ; searches
;; Enable `auto-save-mode' to prevent data loss. Use `recover-file' or
;; `recover-session' to restore unsaved changes.
(setq auto-save-default t)
(setq auto-save-interval 300)
(setq auto-save-timeout 30)
(setq auto-save-visited-interval 10)
(auto-save-visited-mode 1)
;; Comments
(setq comment-multi-line t)
(setq comment-empty-lines t)
(setq-default fill-column 80)
;; 4 space tabs
(setq-default indent-tabs-mode nil
tab-width 4)
;; Enable indentation and completion using the TAB key
(setq-default tab-always-indent nil)
(setq python-indent-guess-indent-offset-verbose nil)
(setq sh-indent-after-continuation 'always)
;; Perf: Reduce command completion overhead.
(setq read-extended-command-predicate #'command-completion-default-include-p)
;; Ediff
;; Configure Ediff to use a single frame and split windows horizontally
(setq ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally)
;; Auto-revert in Emacs is a feature that automatically updates buffer to reflect
;; changes on disk
(add-hook 'after-init-hook #'global-auto-revert-mode)
;; recentf maintains a list of recently accessed files
(add-hook 'after-init-hook #'(lambda()
(let ((inhibit-message t))
(recentf-mode 1))))
;; savehist is an Emacs feature that preserves the minibuffer history between sessions
(add-hook 'after-init-hook #'savehist-mode)
;; save-place-mode enables Emacs to remember the last location within a file
(add-hook 'after-init-hook #'save-place-mode)
;; Eglot
(setq eglot-sync-connect 1
eglot-autoshutdown t)
;; Activate Eglot in cross-referenced non-project files
(setq eglot-extend-to-xref t)
;; https://stackoverflow.com/questions/6286579/emacs-shell-mode-how-to-send-region-to-shell/7053298#7053298
(defun shell-region (start end)
"Execute region START to END in an inferior shell."
(interactive "r")
(shell-command (buffer-substring-no-properties start end)))
;; Package Manager
;; bootstrap straight.el package manager
(defvar bootstrap-version)
(let ((bootstrap-file
@ -61,16 +157,19 @@
(setq evil-want-C-u-scroll t)
(setq evil-want-keybinding nil)
(require 'evil)
(evil-mode 1)
(evil-mode -1)
(use-package evil-collection
:straight t
:after evil
:defer t
:init
(evil-collection-init))
(use-package evil-surround
:straight t
:after evil
:defer t
:config
(global-evil-surround-mode 1))
;; end evil
@ -100,11 +199,39 @@
:init
(vertico-mode))
(use-package marginalia
:after vertico
(use-package orderless
;; Vertico leverages Orderless' flexible matching capabilities, allowing users
;; to input multiple patterns separated by spaces, which Orderless then
;; matches in any order against the candidates.
:straight t
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
(use-package embark
:straight t
:defer t
:commands (embark-act
embark-dwim
embark-export
embark-collect
embark-bindings
embark-prefix-help-command)
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
(marginalia-mode))
(setq prefix-help-command #'embark-prefix-help-command)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package emmet-mode
:straight t
@ -123,4 +250,79 @@
:straight t
:init (global-flycheck-mode))
(use-package corfu
:straight t
:defer t
:commands (corfu-mode global-corfu-mode)
:hook ((prog-mode . corfu-mode)
(shell-mode . corfu-mode)
(eshell-mode . corfu-mode))
:custom
;; Hide commands in M-x which do not apply to the current mode.
(read-extended-command-predicate #'command-completion-default-include-p)
;; Disable Ispell completion function. As an alternative try `cape-dict'.
(text-mode-ispell-word-completion nil)
(tab-always-indent 'complete)
;; Enable Corfu
:config
(global-corfu-mode))
;; Cape Competion
(use-package cape
:straight t
:defer t
:commands (cape-dabbrev cape-file cape-elisp-block)
:bind ("C-c p" . cape-prefix-map)
:init
;; Add to the global default value of `completion-at-point-functions' which is
;; used by `completion-at-point'.
(add-hook 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'completion-at-point-functions #'cape-file)
(add-hook 'completion-at-point-functions #'cape-elisp-block))
;; Tree Sitter auto config
(use-package treesit-auto
:straight t
:config
(global-treesit-auto-mode))
(setq treesit-auto-install 'prompt)
(setq treesit-auto-langs '(python rust go))
;;; Go Support
(unless (package-installed-p 'go-mode)
(package-install 'go-mode))
;;; Lua Support
(unless (package-installed-p 'lua-mode)
(package-install 'lua-mode))
;;; Typescript Support
(unless (package-installed-p 'typescript-mode)
(package-install 'typescript-mode))
;;; Rust Support
(unless (package-installed-p 'rust-mode)
(package-install 'rust-mode))
;;; YAML Support
(unless (package-installed-p 'yaml-mode)
(package-install 'yaml-mode))
;;; JSON Support
(unless (package-installed-p 'json-mode)
(package-install 'json-mode))
(setq-default major-mode
(lambda () ; guess major mode from file name
(unless buffer-file-name
(let ((buffer-file-name (buffer-name)))
(set-auto-mode)))))
(setq confirm-kill-emacs #'yes-or-no-p)
(defalias 'yes-or-no #'y-or-n-p)
;;; init.el ends here