Overall cleanup for emacs, trimmed alot to get to basics.

This commit is contained in:
2026-10-28 08:03:32 +02:00
parent 15ef206732
commit f3f9f56e41
4 changed files with 53 additions and 198 deletions
+3 -11
View File
@@ -34,6 +34,9 @@
:mode "\\.odin\\'"
:hook (odin-mode . eglot-ensure))
;; OLS built-in definitions.
(setenv "OLS_BUILTIN_FOLDER" "/home/jason/ThirdParty/ols/builtin")
;;;; Go
;; Emacs started from the desktop doesn't inherit fish env.
(dolist (d '("/usr/local/go/bin" "/home/jason/.go/bin"))
@@ -77,17 +80,6 @@
(:name "vendor"
:path "/home/jason/.odin/vendor")])))))
;; OLS built-in definitions.
(setenv "OLS_BUILTIN_FOLDER" "/home/jason/ThirdParty/ols/builtin")
;;;; Code navigation
;; Vim-style code navigation.
(evil-define-key '(normal motion) 'global
"gd" #'xref-find-definitions
"gD" #'xref-find-references
"K" #'eldoc
(kbd "C-t") #'xref-go-back)
;; ESC closes any open eldoc window.
(defun my/eldoc-close (&rest _)
"Quit every window showing an *eldoc* buffer."
+15 -25
View File
@@ -1,19 +1,18 @@
;;; git.el --- Magit, set up for Evil -*- lexical-binding: t; -*-
;;; git.el --- Magit, minimal Evil -*- lexical-binding: t; -*-
;;; Commentary:
;; Loaded from init.el, which must set `evil-want-keybinding' to nil before
;; Evil loads (Evil Collection needs it).
;; Loaded from init.el after evil.el.
;;
;; :git Magit status for the current repo, full frame.
;; q puts your previous window layout back.
;; :git ARGS Run `git ARGS' from the repo root, e.g. :git log --oneline
;;
;; In Magit (Evil Collection layout):
;; j/k move, TAB folds, s stage, u unstage, x discard, c c commit,
;; p push, F pull, l log, d diff, b branch, z stash, gr refresh, q quit,
;; ? lists every command.
;; Commit message: opens in insert state; ZZ or C-c C-c commits,
;; ZQ or C-c C-k cancels.
;; Ctrl+hjkl, C-f and C-b keep their global meaning in Magit buffers.
;; Magit buffers use Evil's emacs state, so every Magit key is native
;; (s stage, u unstage, c c commit, P push, F pull, l log, d diff, b branch,
;; z stash, g refresh, n/p sections, TAB folds, ? lists every command),
;; except j/k, which move by line. That shadows Magit's own j (jump to
;; section) and k (discard): use M-x magit-status-jump / magit-discard.
;; If ESC drops you into normal state, C-z toggles emacs state back.
;; Commit message: opens in insert state; C-c C-c commits, C-c C-k cancels.
;;; Code:
(use-package magit
@@ -23,22 +22,13 @@
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
(magit-bury-buffer-function #'magit-restore-window-configuration))
;; Vim-style keys for Magit, its section folding, and the commit message buffer.
;; (magit magit-submodule) is the form Evil Collection's own default list uses.
(with-eval-after-load 'evil-collection
;; Evil Collection puts section jumps on C-j/C-k and page scrolling on C-f/C-b.
;; Unbind them so your window and Consult keys show through. Sibling sections
;; are still on ] and [, and scrolling on C-d/C-u.
(add-hook 'evil-collection-setup-hook
(lambda (mode &rest _)
(when (eq mode 'magit)
(evil-define-key 'normal magit-mode-map
(kbd "C-j") nil
(kbd "C-k") nil
(kbd "C-f") nil
(kbd "C-b") nil))))
;; All Magit buffers derive from magit-mode.
(evil-set-initial-state 'magit-mode 'emacs)
(evil-collection-init '((magit magit-submodule) magit-section with-editor)))
(with-eval-after-load 'magit-mode
(evil-define-key 'emacs magit-mode-map
"j" #'next-line
"k" #'previous-line))
;; Commit messages start in insert state. Added after git-commit loads so its
;; default hook functions are kept.
+2 -13
View File
@@ -2,8 +2,8 @@
;;; Code:
;; Styled stars, bullets, tags, tables and blocks.
(use-package org-modern
:hook (org-mode . org-modern-mode))
;; (use-package org-modern
;; :hook (org-mode . org-modern-mode))
(setq org-directory "~/Projects/notebook")
(setq org-startup-indented t ; visual indent per level, no real spaces
@@ -29,17 +29,6 @@
(add-hook 'org-mode-hook #'visual-line-mode) ; wrap at window edge
(add-hook 'org-mode-hook (lambda () (display-line-numbers-mode -1))) ; prose reads better without
;; doom-themes' own Org fontification fixes (blocks, headings).
(doom-themes-org-config)
;; Heading sizes; 'user survives theme reloads, same as in init.el.
(doom-themes-set-faces 'user
'(org-document-title :height 1.3 :weight 'bold)
'(org-level-1 :height 1.2 :weight 'bold)
'(org-level-2 :height 1.15 :weight 'bold)
'(org-level-3 :height 1.1 :weight 'bold)
'(org-level-4 :height 1.0 :weight 'bold))
(defun my/notes-index ()
"Open the notes index."
(interactive)