My attempt to optimize my emacs load time <1 second
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

500 lines
15 KiB

;;; custom-packages --- Provide all the use-package declarations
;;; Commentary:
;;
;; See https://github.com/jwiegley/use-package for help
;; USE PACKAGE help
;; (use-package package-here
;; :commands (cmd cmd-all cmd-etc) ;; List commands used to ":defer" the package
;; :bind-keymap
;; ("M-q" . package-here-keymap) ;; Setup an entire keymap using Prefix "M-q"
;; :bind
;; (("M-s" . cmd) ;; Available Globally
;; :map here-mode-map
;; ("C-t" . cmd-all) ;; Available only in "here-mode"
;; ("C-e" . cmd-etc)) ;; Available only in "here-mode"
;; :init
;; (setq stuff t) ;; declar vars etc...
;; :config
;; (here-mode 1) ;; eval stuff here after the init
;;
;; (use-package ruby-mode
;; :mode "\\.rb\\'"
;; :interpreter "ruby"
;;
;; ;; OR when the package name isn't the same as the =mode=
;; (use-package python
;; :mode ("\\.py\\'" . python-mode)
;; :interpreter ("python" . python-mode))
;;
;; USE ":defer" when you aren't using either :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, :interpreter, or :hook
;; (use-package deferred-package
;; :defer t)
;;; Code:
;; https://github.com/jwiegley/use-package/blob/master/bind-key.el
(use-package bind-key
:ensure t
:bind
("C-<tab>" . leo/tidy)
("C-;" . leo/comment-or-uncomment-region-or-line)
("C-c e" . leo/find-user-init-file)
("M-q" . leo/kill-this-buffer-unless-scratch)
("C-c d" . leo/duplicate-thing)
("M-n" . leo/jump-to-next-symbol)
("M-p" . leo/jump-to-prev-symbol)
("M-u" . upcase-dwim)
("M-c" . capitalize-dwim)
("M-l" . downcase-dwim)
)
;; https://github.com/myrjola/diminish.el
(use-package diminish
:ensure t
:demand t)
;; https://github.com/winterTTr/ace-jump-mode
(use-package ace-jump-mode
:bind
(("C-c SPC" . just-one-space)
("M-SPC" . ace-jump-mode)))
;; https://github.com/abo-abo/ace-window
(use-package ace-window
:ensure t
:bind
([remap other-window] . ace-window)
:init
(setq aw-keys '(?a ?s ?h ?t ?g ?y ?n ?e ?o ?i)))
;; https://github.com/hlissner/emacs-doom-themes
(use-package doom-themes
:ensure t
:config
(load-theme 'doom-one t))
;; https://github.com/belak/base16-emacs
(use-package base16-theme
:disabled
:ensure t
:config
(load-theme 'base16-onedark t))
;; https://github.com/Malabarba/beacon
(use-package beacon
:ensure t
:commands beacon-mode
:demand t
:init
(setq beacon-size 30
beacon-color "#5B6268"
beacon-blink-delay 0.2
beacon-blink-duration 0.5
beacon-blink-when-focused t)
(beacon-mode 1))
;; https://github.com/iqbalansari/emacs-emojify
(use-package emojify
:ensure t
:defer 15
:config
(global-emojify-mode 1))
;; https://github.com/hrs/engine-mode
(use-package engine-mode
:ensure t
:defer 5
:commands (engine/get-query engine/execute-search)
:config
(defengine google "https://www.google.com/search?q=%s"
:keybinding "g")
(defengine duckduckgo "https://duckduckgo.com/?q=%s"
:keybinding "d")
(engine-mode 1))
;; https://github.com/coldnew/linum-relative
(use-package linum-relative
:ensure t
:config
(linum-relative-mode))
;; https://github.com/Fanael/rainbow-delimiters
(use-package rainbow-delimiters
:ensure t
:hook (prog-mode . rainbow-delimiters-mode))
;; M-x all-the-icons-install-fonts
(use-package all-the-icons
:ensure t)
;; https://github.com/tarsius/minions
(use-package minions
:ensure t
:config
(minions-mode 1))
(use-package doom-modeline
:ensure t
:after (all-the-icons minions)
:hook (after-init . doom-modeline-mode)
:commands (doom-modeline-def-modeline doom-modeline-set-modeline)
:init
(setq doom-modeline-height 40)
(setq doom-modeline-bar-width 6)
(setq doom-modeline-checker-simple-format nil)
(setq doom-modeline-minor-modes (featurep 'minions))
:config
(doom-modeline-def-modeline 'leo/custom-modeline
'(bar matches buffer-info remote-host buffer-position parrot selection-info)
'(misc-info minor-modes input-method buffer-encoding major-mode process vcs checker " "))
(defun leo/setup-custom-doom-modeline ()
(doom-modeline-set-modeline 'leo/custom-modeline 'default))
(add-hook 'doom-modeline-mode-hook 'leo/setup-custom-doom-modeline)
)
(use-package dashboard
:ensure t
:preface
(defvar show-week-agenda-p)
:init
(setq dashboard-items '((recents . 6)
(bookmarks . 5)
;; (projects . 5)
(agenda . 5)))
(setq dashboard-center-content t)
(setq dashboard-banner-logo-title "Let's begin...")
(setq dashboard-startup-banner 1)
(setq dashboard-show-shortcuts t)
(setq show-week-agenda-p t)
(setq dashboard-org-agenda-categories '("work" "tasks"))
:config
(dashboard-setup-startup-hook))
(use-package helm
:ensure t
:commands (helm-M-x helm-buffers-list helm-find-files helm-candidate-number-at-point)
:demand t
:bind
("M-x" . helm-M-x)
("C-c b" . helm-buffers-list)
("C-x C-f" . helm-find-files)
:config
(declare-function helm-candidate-number-at-point "helm.el")
)
;; https://github.com/emacsorphanage/helm-swoop
(use-package helm-swoop
:ensure t
:after (helm)
:bind
("C-s" . helm-swoop)
:config
;; If you prefer fuzzy matching
(setq helm-swoop-use-fuzzy-match t))
;; https://github.com/syohex/emacs-helm-ag
(use-package helm-ag
:ensure t
:after (helm)
:bind
("C-c k" . helm-ag))
;; https://github.com/magnars/expand-region.el
(use-package expand-region
:ensure t
:bind
("C-@" . er/expand-region)
("C-#" . er/contract-region))
;; https://github.com/magnars/multiple-cursors.el
(use-package multiple-cursors
:ensure t
:bind
("C-}" . mc/mark-next-like-this)
("C-)" . mc/unmark-next-like-this)
("C-{" . mc/mark-previous-like-this)
("C-(" . mc/unmark-previous-like-this))
;; https://github.com/joodland/bm
(use-package bm
:ensure t
:demand t
:bind (("C-x b b" . bm-toggle)
("C-x b n" . bm-next)
("C-x b p" . bm-previous))
:commands (bm-repository-load
bm-repository-save
bm-buffer-save
bm-buffer-save-all
bm-buffer-restore)
:preface
(setq left-fringe-width 6)
(setq right-fringe-width 0)
(defface bm-face '((t nil)) "Specify face used to highlight the current line" :group 'bm)
(defface bm-fringe-face '((t (:background "DarkOrange1" :foreground "DarkOrange1"))) "Specify face used to highlight the fringe" :group 'bm)
(defface bm-fringe-persistent-face '((t (:background "DarkOrange1" :foreground "DarkOrange1"))) "Specify face used to highlight the fringe for persistant bookmarks" :group 'bm)
(defface bm-persistent-face '((t nil)) "Specify face used to highlight the current line for persistant bookmarks" :group 'bm)
(defface fringe '((t nil)) "Specify face used for the fringe" :group 'basic-faces :group 'frames)
:init
(setq bm-restore-repository-on-load t)
:config
(setq bm-cycle-all-buffers t)
(setq bm-repository-file (concat user-emacs-directory "bookmark-repo"))
(setq-default bm-buffer-persistence t)
(setq bm-highlight-style 'bm-highlight-only-fringe)
(add-hook 'after-init-hook 'bm-repository-load)
(add-hook 'find-file-hooks 'bm-buffer-restore)
(add-hook 'after-revert-hook #'bm-buffer-restore)
(add-hook 'kill-buffer-hook #'bm-buffer-save)
(add-hook 'after-save-hook #'bm-buffer-save)
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
(add-hook 'kill-emacs-hook #'(lambda nil
(bm-buffer-save-all)
(bm-repository-save))))
;; link
(use-package elfeed
:ensure t
:commands (elfeed)
:bind ("C-x C-l e" . elfeed)
:init
(setq elfeed-feeds
'(
("http://telescoper.wordpress.com/feed/" daily)
("http://xkcd.com/rss.xml" daily)
("http://timharford.com/feed/" daily)
("http://understandinguncertainty.org/rss.xml" daily)
("http://pragmaticemacs.com/feed/" emacs)
("http://www.reddit.com/r/emacs/.rss" emacs)
("http://planet.emacsen.org/atom.xml" emacs)
("http://feeds.feedburner.com/XahsEmacsBlog" emacs)
("http://emacs.stackexchange.com/feeds" emacs)
)))
;; https://github.com/rmuslimov/browse-at-remote
(use-package browse-at-remote
:bind ("C-c B" . browse-at-remote))
;; https://github.com/justbur/emacs-which-key
(use-package which-key
:ensure t
:config
(which-key-setup-minibuffer)
(which-key-mode))
;; https://github.com/lewang/fic-mode
(use-package fic-mode
:ensure t
:hook prog-mode
:init
(defface fic-face '((t :foreground "red" :weight bold)) "Specify face used for fic-mode highlighting" :group 'basic-faces)
(defface fic-author-face '((t :foreground "red" :underline t)) "Specify face used for fic-mode highlighting" :group 'basic-faces)
)
;; https://github.com/joaotavora/yasnippet
(use-package yasnippet
:ensure t
:commands (yas-reload-all)
:hook (prog-mode . yas-minor-mode)
:init
(setq yas-snippet-dirs (list (concat user-emacs-directory "snippets")))
:config
(yas-reload-all))
;; https://company-mode.github.io/
(use-package company
:ensure t
:defer 5
:commands (company-mode)
:hook (prog-mode . company-mode))
;; https://github.com/pashky/restclient.el
(use-package restclient
:ensure t
:mode ("\\.rest\\'" . restclient-mode))
;; https://github.com/iquiw/company-restclient
(use-package company-restclient
:ensure t
:after (company restclient))
;; https://github.com/magit/magit
(use-package magit
:commands magit-status
:ensure t
:init
(setq magit-completing-read-function 'helm-completing-read-default-handler)
:bind
("C-x g" . magit-status)
("C-c g" . magit-status))
;; https://github.com/bbatsov/projectile
(use-package projectile
:ensure t
:bind-keymap
("C-c p" . projectile-command-map)
)
;; https://github.com/magit/git-modes
(use-package gitignore-mode
:ensure t)
;; https://github.com/magit/git-modes
(use-package gitconfig-mode
:ensure t)
;; http://web-mode.org/
(use-package web-mode
:ensure t
:mode "\\.html?\\'")
;; https://github.com/joshwnj/json-mode
(use-package json-mode
:ensure t
:mode "\\.json\\'")
;; https://github.com/antonj/scss-mode
(use-package scss-mode
:ensure t
:mode ("\\.s?css\\'" . scss-mode))
;; https://elpa.gnu.org/packages/csv-mode.html
(use-package csv-mode
:disabled
:ensure t
:mode ("\\.csv\\'" . csv-mode))
;; https://github.com/kwrooijen/cargo.el
(use-package cargo
:hook (rust-mode . cargo-minor-mode))
;; https://github.com/andre-r/centered-cursor-mode.el
(use-package centered-cursor-mode
:disabled
:commands centered-cursor-mode
:hook prog-mode)
;; https://github.com/flycheck/flycheck
(use-package flycheck
:ensure t
:preface
(defvar flycheck-emacs-lisp-load-path)
:init
(setq flycheck-emacs-lisp-load-path 'inherit)
(global-flycheck-mode))
;; https://orgmode.org/elpa.html
(use-package org
:commands (org-cycle-agenda-files org-capture)
:ensure org-plus-contrib
:mode ("\\.org\\'" . org-mode)
:bind (
("C-," . org-cycle-agenda-files)
("C-c C-d" . org-capture)
:map org-mode-map
("M-RET" . org-insert-todo-heading)
)
:preface
(defvar org-html-validation-link)
(defvar org-html-text-markup-alist)
:init
(setq org-agenda-files '("~/Dropbox/Org/todo.org"
"~/Dropbox/Org/archive.org"
"~/Dropbox/Org/diary/eaglecrk.org"))
(setq org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)")
(sequence "BUG(b)" "INPROGRESS(i)" "|" "FIXED(f)")
(sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)")
(sequence "|" "CANCELED(c)")
(sequence "|" "NEEDCLARIFICATION(n)")
(sequence "|" "PROVIDEUPDATE(p)")
(sequence "|" "WAITING(w)"))
org-refile-targets '((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3))
org-directory "~/Dropbox/Org"
org-default-notes-file (concat org-directory "/todo.org")
org-startup-folded t
org-startup-indented t
org-startup-align-all-tables t
org-startup-with-inline-images t
org-startup-with-latex-preview t
org-src-tab-acts-natively t
org-confirm-babel-evaluate nil
org-log-done t
org-log-done-with-time t
org-log-into-drawer t
org-hide-leading-stars t
org-pretty-entities t
org-use-property-inheritance t
org-html-validation-link nil
org-html-text-markup-alist '((bold . "<b>%s</b>")
(code . "<code>%s</code>")
(italic . "<i>%s</i>")
(strike-through . "<del>%s</del>")
(underline . "<span class=\"underline\">%s</span>")
(verbatim . "<code class=\"verbatim\">%s</code>"))
)
:config
(org-babel-do-load-languages 'org-babel-load-languages '((js . t)
(shell . t)
(emacs-lisp . t)))
(add-to-list 'org-structure-template-alist
(list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n"
"\n"
"#+END_SRC")))
(add-to-list 'org-structure-template-alist
(list "j" (concat "#+BEGIN_SRC js :cmd \"/usr/local/bin/babel-node\" :results output code\n"
"\n"
"#+END_SRC")))
(add-to-list 'org-structure-template-alist
(list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
"\n"
"#+END_SRC")))
)
;; https://github.com/sabof/org-bullets
(use-package org-bullets
:ensure t
:after (org)
:hook (org-mode . org-bullets-mode)
:config
(set-face-attribute 'org-level-1 nil :height 1.3)
(set-face-attribute 'org-level-2 nil :height 1.1)
(set-face-attribute 'org-level-3 nil :height 1.05)
(set-face-attribute 'org-level-4 nil :height 1.05)
(set-face-attribute 'org-scheduled-today nil :height 1.0)
(set-face-attribute 'org-agenda-date-today nil :height 1.1))
;; https://orgmode.org/worg/org-contrib/org-protocol.html
(use-package org-protocol
:ensure org-plus-contrib
:after (org)
:preface
(defvar org-capture-templates)
:init
(setq org-capture-templates
'(("t" "new task" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks")
"* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
("n" "new note" entry (file+headline org-default-notes-file "Notes")
"* %?\n%i\n")
("l" "store link" entry (file+olp org-default-notes-file "Links" "Unfiled")
"* %a\n%?\n")
("d" "store link w/drawer" entry (file+olp org-default-notes-file "Links" "Unfiled")
"* %?\n%l\n:COPIED_TEXT:\n %i\n:END:\n")
("f" "dotfile" entry (file+headline "~/Dropbox/Org/dotfiles.org" "Other")
"* %?\n:PROPERTIES:\n:CUSTOM_ID: %(org-id-get-create)\n:END:\n")
))
)
;; https://github.com/seanohalpin/org-link-minor-mode
(use-package org-link-minor-mode
:ensure t
:defer t
:commands (org-link-minor-mode))
(provide 'custom-packages)
;;; custom-packages.el ends here