summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--user/emacs/init.el31
1 files changed, 27 insertions, 4 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 6d66cbee..00a3598f 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -72,7 +72,18 @@
                     modus-themes-hl-line 'nil
                     modus-themes-region '(bg-only)
                     modus-themes-diffs 'desaturated)
-              (load-theme 'modus-operandi t)))
+              (let ((light-mode-theme 'modus-operandi)
+                    (dark-mode-theme 'modus-vivendi))
+                (defun my/set-dark-or-light-theme ()
+                  (let ((appearance (plist-get (mac-application-state) :appearance)))
+                    (cond ((equal appearance "NSAppearanceNameAqua")
+                           (load-theme light-mode-theme t))
+                          ((equal appearance "NSAppearanceNameDarkAqua")
+                           (load-theme dark-mode-theme t)))))
+                (add-hook 'mac-effective-appearance-change-hook #'my/set-dark-or-light-theme)
+                (if (boundp 'mac-effective-appearance-change-hook)
+                    (my/set-dark-or-light-theme)
+                  (load-theme light-mode-theme t)))))
   (if (eq window-system 'x)
       (setq-default line-spacing 0.2))
   (setq frame-background-mode 'light)
@@ -100,12 +111,24 @@
 
 (add-to-list 'default-frame-alist '(width . 100))
 (add-to-list 'default-frame-alist '(height . 40))
+(setq-default display-line-numbers 'relative
+              display-line-numbers-widen t)
+
+(defun noct-relative ()
+  "Show relative line numbers."
+  (setq-local display-line-numbers 'relative))
+
+(defun noct-absolute ()
+  "Show absolute line numbers."
+  (setq-local display-line-numbers t))
+
+(add-hook 'evil-insert-state-entry-hook #'noct-absolute)
+(add-hook 'evil-insert-state-exit-hook #'noct-relative)
 
 ;;; Encoding
 
-(setq bidi-paragraph-direction 'left-to-right)
-(when (version<= "27.1" emacs-version)
-  (setq bidi-inhibit-bpa t))
+(setq-default bidi-paragraph-direction 'left-to-right)
+(setq bidi-inhibit-bpa t)
 
 ;;; Dates & Times