 ;; Not necessarily only for lisp languages but main use case is for lisp
 ;; languages where this really helps.
 (use-package rainbow-delimiters
-  :config
-  ;; Default rainbow delimiters colours do not differentiate themselves enough.
-  (unless custom-enabled-themes
-    (set-face-foreground 'rainbow-delimiters-depth-1-face "dark orange")
-    (set-face-foreground 'rainbow-delimiters-depth-2-face "deep pink")
-    (set-face-foreground 'rainbow-delimiters-depth-3-face "chartreuse")
-    (set-face-foreground 'rainbow-delimiters-depth-4-face "deep sky blue")
-    (set-face-foreground 'rainbow-delimiters-depth-5-face "goldenrod")
-    (set-face-foreground 'rainbow-delimiters-depth-6-face "orchid")
-    (set-face-foreground 'rainbow-delimiters-depth-7-face "spring green")
-    (set-face-foreground 'rainbow-delimiters-depth-8-face "sienna")
-    (set-face-foreground 'rainbow-delimiters-depth-9-face "red"))
-
-  ;; Always bold delimiters regardless of theme, as they are easier to see and
-  ;; identify for me.
-  (set-face-bold 'rainbow-delimiters-depth-1-face t)
-  (set-face-bold 'rainbow-delimiters-depth-2-face t)
-  (set-face-bold 'rainbow-delimiters-depth-3-face t)
-  (set-face-bold 'rainbow-delimiters-depth-4-face t)
-  (set-face-bold 'rainbow-delimiters-depth-5-face t)
-  (set-face-bold 'rainbow-delimiters-depth-6-face t)
-  (set-face-bold 'rainbow-delimiters-depth-7-face t)
-  (set-face-bold 'rainbow-delimiters-depth-8-face t)
-  (set-face-bold 'rainbow-delimiters-depth-9-face t))
-
-;; Text and Prog Mode Hooks
-;; ========================
-;;
-;; I find this a little cleaner and more 'declarative' than having multiple
-;; `add-hook's around in various places.
-;;
-;; The idea is taken from: https://emacs.stackexchange.com/a/5384
-
-(defun my/text-mode-hook ()
-  (hl-line-mode)
-  (visual-line-mode)
-  (whitespace-mode))
-
-(defun my/prog-mode-hook ()
-  (my/text-mode-hook)
-  (aggressive-indent-mode)
-  (rainbow-delimiters-mode))
-
-(add-hook 'text-mode-hook 'my/text-mode-hook)
-(add-hook 'prog-mode-hook 'my/prog-mode-hook)
+  :ghook
+  'prog-mode-hook
+  :config
+  (defun my/rainbow-delimiters-default-faces (&rest _)
+    ;; Default rainbow delimiters colours do not differentiate themselves
+    ;; enough.
+    (unless custom-enabled-themes
+      (set-face-foreground 'rainbow-delimiters-depth-1-face "dark orange")
+      (set-face-foreground 'rainbow-delimiters-depth-2-face "deep pink")
+      (set-face-foreground 'rainbow-delimiters-depth-3-face "chartreuse")
+      (set-face-foreground 'rainbow-delimiters-depth-4-face "deep sky blue")
+      (set-face-foreground 'rainbow-delimiters-depth-5-face "goldenrod")
+      (set-face-foreground 'rainbow-delimiters-depth-6-face "orchid")
+      (set-face-foreground 'rainbow-delimiters-depth-7-face "spring green")
+      (set-face-foreground 'rainbow-delimiters-depth-8-face "sienna")
+      (set-face-foreground 'rainbow-delimiters-depth-9-face "red")))
+
+  (defun my/rainbow-delimiters-faces (&rest _)
+    ;; Always bold delimiters regardless of theme, as they are easier to see and
+    ;; identify for me.
+    (set-face-bold 'rainbow-delimiters-depth-1-face t)
+    (set-face-bold 'rainbow-delimiters-depth-2-face t)
+    (set-face-bold 'rainbow-delimiters-depth-3-face t)
+    (set-face-bold 'rainbow-delimiters-depth-4-face t)
+    (set-face-bold 'rainbow-delimiters-depth-5-face t)
+    (set-face-bold 'rainbow-delimiters-depth-6-face t)
+    (set-face-bold 'rainbow-delimiters-depth-7-face t)
+    (set-face-bold 'rainbow-delimiters-depth-8-face t)
+    (set-face-bold 'rainbow-delimiters-depth-9-face t))
+
+  (general-add-advice 'disable-theme
+                      :after #'my/rainbow-delimiters-default-faces)
+  (general-add-advice 'load-theme :after #'my/rainbow-delimiters-faces)
+  (my/rainbow-delimiters-default-faces)
+  (my/rainbow-delimiters-faces))
 
 ;; Theme
 ;; =====

(mouse-avoidance-mode 'banish)
(show-paren-mode)

;; Keybinding Related
;; ==================
(use-package defrepeater :demand t)

(use-package evil
  ;; :preface
  ;; (defun my/insert-two-spaces ()
  ;;   (interactive)
  ;;   (insert "  "))

  :init
  (gsetq evil-cross-lines t
         evil-overriding-maps nil

  (evil-mode)

  :config
  ;; (defun my/insert-two-spaces ()
  ;;   (interactive)
  ;;   (insert "  "))

  (defun my/edit-init-file ()
    (interactive)
    (find-file (expand-file-name "init.el" user-emacs-directory)))

  ;; Move up one line when doing q: and q/.
  (general-add-advice 'evil-command-window-ex :after #'evil-previous-line)
  (general-add-advice 'evil-command-window-search-forward
                      :after #'evil-previous-line)

  ;; Set normal state as default state.
  ;; In :config as it references evil mode variables.
