summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2019-09-23 22:14:01 +0200
committerAlan Pearce2019-09-23 22:14:12 +0200
commitcf28f2ee2baad8fec85d388362ac409b1f456506 (patch)
tree44dd689596acba092587d292996ce7d3f3ef99b3
parentee1c22c202ea5b82dbda40028266de27b228cad4 (diff)
downloadnixfiles-cf28f2ee2baad8fec85d388362ac409b1f456506.tar.lz
nixfiles-cf28f2ee2baad8fec85d388362ac409b1f456506.tar.zst
nixfiles-cf28f2ee2baad8fec85d388362ac409b1f456506.zip
Emacs: optimise startup time
-rw-r--r--emacs/.emacs.d/main.el53
1 files changed, 39 insertions, 14 deletions
diff --git a/emacs/.emacs.d/main.el b/emacs/.emacs.d/main.el
index ffafd39d..2e8caa4a 100644
--- a/emacs/.emacs.d/main.el
+++ b/emacs/.emacs.d/main.el
@@ -22,6 +22,7 @@
 (load custom-file :noerror :nomessage)
 
 (use-package crux
+  :defer 1
   :custom ((crux-reopen-as-root-mode nil)))
 
 ;;; Styles
@@ -137,7 +138,6 @@ With two prefix arguments, write out the day and month name."
    '(mac-right-command-modifier 'left)
    '(mac-function-modifier 'hyper)))
 
-
 (use-package general
   :functions (general-unbind general-define-key)
   :config (progn
@@ -155,6 +155,7 @@ With two prefix arguments, write out the day and month name."
 ;; Popup keybindings following a prefix automatically.
 
 (use-package which-key
+  :defer 5
   :custom ((which-key-mode +1))
   :config (progn
             (which-key-setup-side-window-right-bottom)))
@@ -162,6 +163,7 @@ With two prefix arguments, write out the day and month name."
 ;;; Modeline
 
 (use-package relative-buffers
+  :defer 2
   :custom ((global-relative-buffers-mode t)))
 
 ;;; Minibuffer
@@ -169,14 +171,16 @@ With two prefix arguments, write out the day and month name."
 (setq enable-recursive-minibuffers t)
 (minibuffer-depth-indicate-mode t)
 
-(use-package hydra)
+(use-package hydra
+  :defer 2)
 (use-package ivy
   :config (progn
             (ivy-mode +1)))
-(use-package ivy-hydra)
+(use-package ivy-hydra
+  :defer 2)
 
 (use-package smerge-mode
-  :after hydra
+  :after magit
   :config
   (defhydra unpackaged/smerge-hydra
     (:color pink :hint nil :post (smerge-auto-leave))
@@ -267,6 +271,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 (use-package winner
   :after evil
+  :defer 8
   :custom ((winner-mode t)
            (winner-boring-buffers '("*Completions*" "*Help*" "*Apropos*" "*Buffer List*" "*info*" "*Compile-Log*")))
   :general (:keymaps 'evil-window-map
@@ -294,6 +299,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 (use-package evil-collection
   :after (evil)
+  :defer 3
   :demand t
   :commands (evil-collection-init)
   :custom ((evil-collection-company-use-tng nil))
@@ -312,14 +318,16 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 (use-package evil-surround
   :after evil
+  :defer 2
   :custom ((global-evil-surround-mode t)))
 
 (use-package evil-commentary
   :after evil
+  :defer 2
   :custom ((evil-commentary-mode t)))
 
 (use-package evil-magit
-  :after (evil magit)
+  :after magit
   :custom ((evil-magit-use-y-for-yank nil)))
 
 (use-package evil-quickscope
@@ -329,18 +337,19 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :custom ((global-evil-quickscope-mode t)))
 
 (use-package evil-org
-  :after evil
+  :after org
   :commands (evil-org-set-key-theme)
   :ghook ('org-mode-hook #'evil-org-mode)
   :gfhook #'evil-org-set-key-theme)
 
 (use-package evil-org-agenda
-  :after evil
+  :after org
   :ghook ('org-agenda-mode-hook #'evil-org-agenda-set-keys))
 
 ;;; Projects
 
 (use-package projectile
+  :defer 1
   :defines projectile-command-map
   :custom ((projectile-mode +1)
            (projectile-completion-system 'ivy))
@@ -358,6 +367,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
               (evil-ex-define-cmd "pesh[ell]" #'projectile-run-eshell))))
 
 (use-package counsel-projectile
+  :defer 1
   :commands (counsel-projectile-switch-project
 	     counsel-projectile-rg
 	     counsel-projectile-switch-to-buffer
@@ -374,20 +384,24 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 	      (evil-ex-define-cmd "psw[itch]" #'counsel-projectile-switch-project))))
 
 (use-package magit
+  :defer 10
   :commands (magit-status magit-dispatch)
-  :custom ((global-magit-file-mode +1)
+  :custom ((magit-auto-revert-mode nil)
            (magit-section-visibility-indicator nil)
            (magit-diff-refine-hunk 'all)
            (magit-display-buffer-function #'display-buffer)
            (magit-completing-read-function #'ivy-completing-read))
   :config (progn
+            (global-magit-file-mode +1)
             (remove-hook 'magit-section-highlight-hook 'magit-section-highlight)
             (remove-hook 'magit-section-highlight-hook 'magit-section-highlight-selection)
             (remove-hook 'magit-section-highlight-hook 'magit-diff-highlight)))
 
 (eval-when-compile (require 'fringe-helper))
-(use-package git-gutter)
+(use-package git-gutter
+  :defer t)
 (use-package git-gutter-fringe
+  :defer 5
   :config (progn
             (global-git-gutter-mode 1)
             ;; places the git gutter outside the margins.
@@ -403,12 +417,14 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 (use-package git-messenger
   :commands (git-messenger:popup-message)
-  :defer 5
+  :defer 10
   :custom ((git-messenger:use-magit-popup t)))
 
-(use-package git-timemachine)
+(use-package git-timemachine
+  :command (git-timemachine))
 
 (use-package editorconfig
+  :defer 2
   :init (progn
           (unless (executable-find "editorconfig")
             (warn "Missing `editorconfig' executable.")))
@@ -417,6 +433,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 ;;; Completion
 
 (use-package company
+  :defer 2
   :commands (company-explicit-action-p)
   :custom ((global-company-mode +1)
            (company-idle-delay 0)
@@ -429,7 +446,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :general (:states 'insert
                     "TAB" #'company-indent-or-complete-common))
 
-(use-package all-the-icons)
+;; (use-package all-the-icons)
 
 (eval-when-compile (require 'subr-x))
 (eval-and-compile
@@ -440,7 +457,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :commands (company-tabnine)
   :after (company)
   :load-path (lambda () (list (company-tabnine-load-path)))
-  :custom ((company-tabnine-binaries-folder "~/.TabNine"))
+  :custom ((company-tabnine-binaries-folder "~/.local/tabnine"))
   :general ("<M-tab>" #'company-tabnine-call-other-backends
             "<C-tab>" #'company-tabnine-call-other-backends)
   :init (progn
@@ -449,6 +466,7 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 ;;; Documentation
 
 (use-package eldoc
+  :defer 5
   :custom ((global-eldoc-mode +1)
            (eldoc-idle-delay 0.5)))
 
@@ -457,7 +475,8 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :custom ((eldoc-box-hover-mode +1)
            (eldoc-box-hover-at-point-mode +1)))
 
-(use-package ehelp)
+(use-package ehelp
+  :defer 15)
 
 (use-package helpful
   :after ehelp
@@ -524,9 +543,12 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
            (eshell-cmpl-cycle-completions nil)))
 
 (use-package eshell-toggle
+  :after projectile
+  :commands (eshell-toggle)
   :custom ((eshell-toggle-use-projectile-root t)))
 
 (use-package esh-autosuggest
+  :after eshell
   :ghook ('eshell-mode-hook))
 
 (declare-function eshell-push-command "esh-buf-stack" (CMD))
@@ -556,16 +578,19 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :config (setup-esh-help-eldoc))
 
 (use-package eshell-fringe-status
+  :after eshell
   :ghook '(eshell-mode-hook))
 
 (use-package eshell-up
   :after (eshell))
 
 (use-package shell
+  :defer t
   :general (:keymaps 'shell-mode-map
                      "C-d" #'comint-delchar-or-maybe-eof))
 
 (use-package comint
+  :defer t
   :general (:keymaps 'comint-mode-map
                      "C-c C-l" #'counsel-shell-history))