Big emacs cleanup, nearly there.
This commit is contained in:
+1
-11
@@ -1,15 +1,5 @@
|
|||||||
config/emacs/backups/
|
|
||||||
config/emacs/eln-cache/
|
|
||||||
config/emacs/elpa/
|
|
||||||
config/emacs/auto-save/
|
|
||||||
config/emacs/auto-save-list/
|
|
||||||
config/emacs/custom.el
|
|
||||||
config/emacs/places.eld
|
|
||||||
config/emacs/projects.eld
|
|
||||||
config/emacs/recentf.eld
|
|
||||||
config/emacs/.ignore
|
config/emacs/.ignore
|
||||||
config/emacs/session*
|
config/emacs/var/
|
||||||
config/emacs/history
|
|
||||||
config/fish/conf.d
|
config/fish/conf.d
|
||||||
config/fish/functions
|
config/fish/functions
|
||||||
config/fish/fish_variables
|
config/fish/fish_variables
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(startup-redirect-eln-cache (expand-file-name "var/eln-cache/" user-emacs-directory))
|
||||||
|
(setq package-user-dir (expand-file-name "var/elpa/" user-emacs-directory))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Garbage Collection
|
;; Garbage Collection
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|||||||
+35
-45
@@ -5,16 +5,31 @@
|
|||||||
;; to the window on the left.
|
;; to the window on the left.
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;;;; 1. Basics
|
;;;; 1. Emac setup, files, packages and paths
|
||||||
(let ((bin (expand-file-name "~/.local/bin")))
|
(let ((bin (expand-file-name "~/.local/bin")))
|
||||||
(add-to-list 'exec-path bin)
|
(add-to-list 'exec-path bin)
|
||||||
(setenv "PATH" (concat bin path-separator (getenv "PATH"))))
|
(setenv "PATH" (concat bin path-separator (getenv "PATH"))))
|
||||||
|
|
||||||
;; Custom's output goes to its own file, not here.
|
;; all the emacs runtime files live in var/.
|
||||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
;; early-init.el redirects eln-cache and elpa.
|
||||||
|
(defvar my/var (locate-user-emacs-file "var/"))
|
||||||
|
(make-directory (concat my/var "transient/") t)
|
||||||
|
(setq savehist-file (concat my/var "history")
|
||||||
|
save-place-file (concat my/var "places.eld")
|
||||||
|
recentf-save-file (concat my/var "recentf.eld")
|
||||||
|
project-list-file (concat my/var "projects.eld")
|
||||||
|
transient-history-file (concat my/var "transient/history.el")
|
||||||
|
transient-levels-file (concat my/var "transient/levels.el")
|
||||||
|
transient-values-file (concat my/var "transient/values.el"))
|
||||||
|
|
||||||
|
;; Custom output goes to its own file, not here.
|
||||||
|
(setq custom-file (expand-file-name "var/custom.el" user-emacs-directory))
|
||||||
(load custom-file 'noerror 'nomessage)
|
(load custom-file 'noerror 'nomessage)
|
||||||
|
|
||||||
;; Package archives: GNU and NonGNU are built in, MELPA is added at lowest priority.
|
;; No session manager save: stops the empty session.* files.
|
||||||
|
(add-hook 'emacs-save-session-functions #'always)
|
||||||
|
|
||||||
|
;; Package GNU, NonGNU are built in melpa additional lowest priority.
|
||||||
(require 'package)
|
(require 'package)
|
||||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||||
(setq package-archive-priorities '(("gnu" . 3) ("nongnu" . 2) ("melpa" . 1)))
|
(setq package-archive-priorities '(("gnu" . 3) ("nongnu" . 2) ("melpa" . 1)))
|
||||||
@@ -23,7 +38,8 @@
|
|||||||
(require 'use-package)
|
(require 'use-package)
|
||||||
(setq use-package-always-ensure t)
|
(setq use-package-always-ensure t)
|
||||||
|
|
||||||
;;;; 2. UI
|
;;;; 2. Ui settings, theme setup and fonts
|
||||||
|
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
(tool-bar-mode -1)
|
(tool-bar-mode -1)
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
@@ -46,43 +62,29 @@
|
|||||||
(electric-pair-mode 1)
|
(electric-pair-mode 1)
|
||||||
(which-key-mode 1)
|
(which-key-mode 1)
|
||||||
|
|
||||||
;; Jellybeans theme.
|
|
||||||
(add-to-list 'warning-suppress-types '(files))
|
(add-to-list 'warning-suppress-types '(files))
|
||||||
(use-package jbeans-theme
|
(use-package jbeans-theme
|
||||||
:config
|
:config
|
||||||
(load-theme 'jbeans t))
|
(load-theme 'jbeans t))
|
||||||
|
|
||||||
;; Font, on a darker background than the theme's.
|
(set-face-attribute 'default nil :family "JetBrainsMono Nerd Font" :height 120)
|
||||||
(set-face-attribute 'default nil
|
(setq-default line-spacing '(4 . 4))
|
||||||
:family "JetBrainsMono Nerd Font"
|
|
||||||
:height 120
|
|
||||||
:background "#131313")
|
|
||||||
|
|
||||||
;; Mode line at the top of each window: the header line takes over its
|
;; set mode line at the top of each window
|
||||||
;; format and look, on the editor background.
|
|
||||||
(setq-default header-line-format mode-line-format mode-line-format nil)
|
(setq-default header-line-format mode-line-format mode-line-format nil)
|
||||||
(set-face-attribute 'header-line nil :inherit 'mode-line :background "#131313")
|
(set-face-attribute 'header-line nil :inherit 'mode-line :background "#131313")
|
||||||
|
|
||||||
(setq-default line-spacing '(4 . 4))
|
|
||||||
|
|
||||||
;; Command launcher.
|
;; Command launcher.
|
||||||
(keymap-global-set "C-S-p" #'execute-extended-command)
|
(keymap-global-set "C-S-p" #'execute-extended-command)
|
||||||
|
|
||||||
;; Escape cancels prompts. keyboard-quit can't leave the minibuffer, so there
|
;; Escape behaves like C-g
|
||||||
;; Escape runs abort-minibuffers, as C-g does.
|
|
||||||
(keymap-global-set "<escape>" #'keyboard-quit)
|
(keymap-global-set "<escape>" #'keyboard-quit)
|
||||||
(keymap-set minibuffer-local-map "<escape>" #'abort-minibuffers)
|
(keymap-set minibuffer-local-map "<escape>" #'abort-minibuffers)
|
||||||
|
|
||||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
|
||||||
|
|
||||||
;;;; 3. Files
|
;;;; 3. Files
|
||||||
(dolist (d '("backups/" "auto-save/"))
|
(setq make-backup-files nil
|
||||||
(make-directory (locate-user-emacs-file d) t))
|
auto-save-default nil
|
||||||
|
auto-save-list-file-prefix nil
|
||||||
(setq backup-directory-alist
|
|
||||||
`(("." . ,(locate-user-emacs-file "backups/")))
|
|
||||||
auto-save-file-name-transforms
|
|
||||||
`((".*" ,(locate-user-emacs-file "auto-save/") t))
|
|
||||||
create-lockfiles nil
|
create-lockfiles nil
|
||||||
confirm-kill-processes nil
|
confirm-kill-processes nil
|
||||||
vc-follow-symlinks t)
|
vc-follow-symlinks t)
|
||||||
@@ -93,8 +95,7 @@
|
|||||||
(global-auto-revert-mode 1)
|
(global-auto-revert-mode 1)
|
||||||
|
|
||||||
;;;; 4. Completion
|
;;;; 4. Completion
|
||||||
;; C-n/C-p move through candidates: Vertico remaps next-line/previous-line,
|
;; C-n/C-p navigates up and down, section 5 stops evil from overrriding
|
||||||
;; and section 5 stops Evil from taking those keys in the minibuffer.
|
|
||||||
(use-package vertico
|
(use-package vertico
|
||||||
:init
|
:init
|
||||||
(vertico-mode 1)
|
(vertico-mode 1)
|
||||||
@@ -117,7 +118,6 @@
|
|||||||
(vertico-posframe-mode 1))
|
(vertico-posframe-mode 1))
|
||||||
|
|
||||||
;;;; 5. Evil
|
;;;; 5. Evil
|
||||||
;; Evil 1.15.0 on Emacs 31 reads this legacy variable, which Emacs no longer defines.
|
|
||||||
(defvar evil-mode-buffers nil)
|
(defvar evil-mode-buffers nil)
|
||||||
|
|
||||||
(defun my/insert-tab ()
|
(defun my/insert-tab ()
|
||||||
@@ -127,8 +127,6 @@
|
|||||||
|
|
||||||
(use-package evil
|
(use-package evil
|
||||||
:init
|
:init
|
||||||
;; evil-want-keybinding: Evil Collection (below) supplies mode bindings instead
|
|
||||||
;; of Evil's small built-in set. It has to be set before Evil loads.
|
|
||||||
(setq evil-want-C-u-scroll t
|
(setq evil-want-C-u-scroll t
|
||||||
evil-undo-system 'undo-redo
|
evil-undo-system 'undo-redo
|
||||||
evil-want-keybinding nil)
|
evil-want-keybinding nil)
|
||||||
@@ -137,21 +135,16 @@
|
|||||||
(evil-mode 1)
|
(evil-mode 1)
|
||||||
|
|
||||||
(evil-define-key 'insert 'global
|
(evil-define-key 'insert 'global
|
||||||
;; Literal tab. <tab> as well, or a mode's own <tab> binding wins in GUI frames.
|
|
||||||
(kbd "TAB") #'my/insert-tab
|
(kbd "TAB") #'my/insert-tab
|
||||||
(kbd "<tab>") #'my/insert-tab
|
(kbd "<tab>") #'my/insert-tab
|
||||||
|
;; complete using the buffer's completion sources.
|
||||||
;; C-SPC: complete using the buffer's completion sources.
|
|
||||||
(kbd "C-SPC") #'completion-at-point
|
(kbd "C-SPC") #'completion-at-point
|
||||||
(kbd "C-@") #'completion-at-point)
|
(kbd "C-@") #'completion-at-point)
|
||||||
|
|
||||||
;; Global navigation.
|
|
||||||
;; C-p, C-f and C-b are assigned to Consult below.
|
;; C-p, C-f and C-b are assigned to Consult below.
|
||||||
(evil-define-key '(normal motion) 'global
|
(evil-define-key '(normal motion) 'global
|
||||||
(kbd "C-e") #'dired-jump))
|
(kbd "C-e") #'dired-jump))
|
||||||
|
|
||||||
;; Evil Collection: vim-style bindings for other packages, one mode at a time.
|
|
||||||
;; Info here (F1 i); Magit, Magit sections and commit messages in git.el.
|
|
||||||
(use-package evil-collection
|
(use-package evil-collection
|
||||||
:after evil
|
:after evil
|
||||||
:custom
|
:custom
|
||||||
@@ -172,13 +165,12 @@
|
|||||||
(kbd "<escape>") #'abort-minibuffers)
|
(kbd "<escape>") #'abort-minibuffers)
|
||||||
|
|
||||||
;; Window navigation (normal/motion state): Ctrl+hjkl move, Ctrl+` closes.
|
;; Window navigation (normal/motion state): Ctrl+hjkl move, Ctrl+` closes.
|
||||||
;; GUI only for C-`: terminals send it as C-@.
|
|
||||||
(evil-define-key '(normal motion) 'global
|
(evil-define-key '(normal motion) 'global
|
||||||
(kbd "C-h") #'windmove-left
|
(kbd "C-h") #'windmove-left
|
||||||
(kbd "C-j") #'windmove-down
|
(kbd "C-j") #'windmove-down
|
||||||
(kbd "C-k") #'windmove-up
|
(kbd "C-k") #'windmove-up
|
||||||
(kbd "C-l") #'windmove-right
|
(kbd "C-l") #'windmove-right
|
||||||
(kbd "C-`") #'delete-window)
|
(kbd "C-q") #'delete-window)
|
||||||
|
|
||||||
;; Result buffers: hjkl motions and RET to jump to a result.
|
;; Result buffers: hjkl motions and RET to jump to a result.
|
||||||
(dolist (m '(occur-mode grep-mode xref--xref-buffer-mode))
|
(dolist (m '(occur-mode grep-mode xref--xref-buffer-mode))
|
||||||
@@ -269,12 +261,10 @@
|
|||||||
(when-let* ((win (get-buffer-window (process-buffer proc))))
|
(when-let* ((win (get-buffer-window (process-buffer proc))))
|
||||||
(select-window win))))
|
(select-window win))))
|
||||||
|
|
||||||
;;;; 9. Languages
|
;;;; 9. Modules - additional functionality outside of the core init.el
|
||||||
|
;; Magit and the :git command live in modules/git.el.
|
||||||
|
(load (locate-user-emacs-file "modules/git.el") nil 'nomessage)
|
||||||
;; Setup for dev languages, modes, lsp and lsp keybinds.
|
;; Setup for dev languages, modes, lsp and lsp keybinds.
|
||||||
(load (locate-user-emacs-file "development.el") nil 'nomessage)
|
(load (locate-user-emacs-file "modules/development.el") nil 'nomessage)
|
||||||
|
|
||||||
;;;; 10. Git
|
|
||||||
;; Magit and the :git command live in git.el, next to this file.
|
|
||||||
(load (locate-user-emacs-file "git.el") nil 'nomessage)
|
|
||||||
|
|
||||||
;;; init.el ends here
|
;;; init.el ends here
|
||||||
|
|||||||
Reference in New Issue
Block a user