diff options
author | gxlin <[email protected]> | 2021-07-04 22:16:16 +0800 |
---|---|---|
committer | gxlin <[email protected]> | 2021-07-04 22:16:16 +0800 |
commit | 42553b34003b60e4738b6d5bd9e1f39044f1a377 (patch) | |
tree | c137b69576869c9bc535dd22f2b99d0c5a5cb873 | |
parent | 12f643457350e603eaa4520aec1e24ed801923e1 (diff) | |
download | dotfiles-42553b34003b60e4738b6d5bd9e1f39044f1a377.tar.gz dotfiles-42553b34003b60e4738b6d5bd9e1f39044f1a377.tar.bz2 dotfiles-42553b34003b60e4738b6d5bd9e1f39044f1a377.zip |
Speed up my emacs startup
-rw-r--r-- | .emacs.d/init-mu4e.el | bin | 2516 -> 2519 bytes | |||
-rw-r--r-- | .emacs.d/init.el | 50 | ||||
-rw-r--r-- | .emacs.d/modes/init-evil-mode.el | 17 | ||||
-rw-r--r-- | .emacs.d/modes/init-org-mode.el | 78 |
4 files changed, 91 insertions, 54 deletions
diff --git a/.emacs.d/init-mu4e.el b/.emacs.d/init-mu4e.el Binary files differindex 863cc22..bf72115 100644 --- a/.emacs.d/init-mu4e.el +++ b/.emacs.d/init-mu4e.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 042a044..df7a5c9 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1,3 +1,12 @@ +;; Make startup faster by reducing frequency of garbage collection. +(setq gc-cons-percentage 0.6) +(setq gc-cons-threshold most-positive-fixnum) +;; Make gc pauses faster by decreasing the threhold to 8 MiB (default is +;; 800kB) +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (expt 2 23)))) + ;; Set up package.el to work with MELPA (require 'package) (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") @@ -9,6 +18,7 @@ (setq backup-directory-alist `(("." . ,(concat user-emacs-directory "backups")))) (setq-default fill-column 72) +(menu-bar-mode -1) (setq recentf-max-saved-items 100) @@ -44,43 +54,44 @@ ;; ledger-mode (use-package ledger-mode + :mode (("\\.journal$" . ledger-mode)) :config - (add-to-list 'auto-mode-alist '("\\.journal$" . ledger-mode)) - (add-hook 'ledger-mode-hook - (lambda () - (setq-local tab-always-indent 'complete) - (setq-local completion-cycle-threshold t) - (setq-local ledger-complete-in-steps t))) - (setq ledger-highlight-xact-under-point nil)) + (add-hook 'ledger-mode-hook + (setq-local tab-always-indent 'complete) + (setq-local completion-cycle-threshold t))) ;; Company Mode (use-package company :init - (setq company-global-modes '(emacs-lisp-mode go-mode)) + (setq company-global-modes + '(emacs-lisp-mode go-mode ledger-mode)) :hook ((after-init . global-company-mode))) ;; Projectile (use-package projectile + :init + (evil-define-key 'normal projectile-mode-map + (kbd "<leader>p") 'projectile-command-map) :config (setq projectile-cache-file (expand-file-name ".cache/projectile" user-emacs-directory)) - (projectile-mode 1) - (evil-define-key 'normal projectile-mode-map - (kbd "<leader>p") 'projectile-command-map)) + (projectile-mode 1)) (use-package counsel :after evil + :init + (evil-define-key 'normal ivy-mode-map + (kbd "<leader>fb") 'ivy-switch-buffer + (kbd "<leader>fm") 'counsel-recentf) :config (ivy-mode 1) (setq ivy-use-virtual-buffers t) (setq ivy-count-format "(%d/%d) ") (setq ivy-re-builders-alist '((read-file-name-internal . ivy--regex-fuzzy) - (t . ivy--regex-plus))) - (evil-define-key 'normal ivy-mode-map - (kbd "<leader>fb") 'ivy-switch-buffer - (kbd "<leader>fm") 'counsel-recentf)) + (t . ivy--regex-plus)))) (use-package vterm + :commands (vterm) :config (setq vterm-kill-buffer-on-exit t)) @@ -91,9 +102,9 @@ ("\\.md\\'" . markdown-mode) ("\\.markdown\\'" . markdown-mode)) :init - (setq markdown-command "multimarkdown") (evil-define-key 'normal markdown-mode-map - (kbd "<RET>") 'markdown-follow-link-at-point)) + (kbd "<RET>") 'markdown-follow-link-at-point) + (setq markdown-command "multimarkdown")) (use-package exec-path-from-shell :if (memq window-system '(mac ns)) @@ -109,7 +120,6 @@ (use-package avy) -(use-package dashboard +(use-package esup :ensure t - :config - (dashboard-setup-startup-hook)) + :pin melpa) diff --git a/.emacs.d/modes/init-evil-mode.el b/.emacs.d/modes/init-evil-mode.el index bccbc87..c15e403 100644 --- a/.emacs.d/modes/init-evil-mode.el +++ b/.emacs.d/modes/init-evil-mode.el @@ -1,6 +1,7 @@ (use-package evil :ensure t - :hook (evil-org-mode . (lambda () (setq evil-want-C-i-jump nil))) + :hook ((evil-org-mode . (lambda () (setq evil-want-C-i-jump nil))) + (after-init . (lambda () (evil-mode 1)))) :init (setq evil-want-integration t evil-want-C-u-scroll t @@ -9,25 +10,15 @@ evil-disable-insert-state-bindings t) :config (evil-set-leader 'normal ",") - (evil-set-undo-system 'undo-tree) - (evil-mode 1)) + (evil-set-undo-system 'undo-tree)) (use-package evil-collection :after evil :ensure t -; :custom (evil-collection-setup-minibuffer t) +; :custom (evil-collection-setup-minibuffer t) :config (evil-collection-init)) -(use-package evil-escape - :after evil - :config - (evil-escape-mode) - (setq-default - evil-escape-delay 0.2 - evil-escape-key-sequence "jk" - evil-escape-unordered-key-sequence t)) - (use-package evil-easymotion :ensure t :after (evil avy) diff --git a/.emacs.d/modes/init-org-mode.el b/.emacs.d/modes/init-org-mode.el index 80f1e70..af03184 100644 --- a/.emacs.d/modes/init-org-mode.el +++ b/.emacs.d/modes/init-org-mode.el @@ -1,9 +1,15 @@ (use-package org + :ensure t :after evil - :commands org-agenda + :commands (org-mode org-agenda org-store-link org-capture) + :mode (("\\.org$" . org-mode)) :hook ((org-mode . (lambda () (setq tab-width 4)))) :init (setq org-src-tab-acts-natively t) + (evil-define-key 'normal 'global + (kbd "<leader>a") 'org-agenda + (kbd "<leader>l") 'org-store-link + (kbd "<leader>c") 'org-capture) :config (require 'org-tempo) (setq org-directory "~/notes/") @@ -14,36 +20,47 @@ ("j" "Journal" entry (file+datetree org-default-notes-file) "* %?\nCaptured on %U\n %i\n %a"))) (add-hook 'org-mode-hook (lambda () (setq truncate-lines nil))) -; (setq org-agenda-files (directory-files-recursively "~/notes/" "\\.org$")) - (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) (setq org-agenda-start-on-weekday 0) (setq org-adapt-indentation nil) (setq org-return-follows-link t) (setq org-descriptive-links nil) - (evil-define-key 'normal 'global - (kbd "<leader>a") 'org-agenda - (kbd "<leader>l") 'org-store-link - (kbd "<leader>c") 'org-capture) (evil-define-key 'normal org-mode-map (kbd "TAB") 'org-cycle (kbd "RET") 'org-open-at-point - (kbd "<leader>ot") 'org-todo (kbd "<leader>os") 'org-schedule (kbd "<leader>od") 'org-deadline - (kbd "<leader>or") 'org-refile) + (kbd "<leader>or") 'org-refile + (kbd "<leader>oil") 'org-insert-link + (kbd "<leader>oih") 'org-insert-heading) + (setq org-tags-exclude-from-inheritance + '("PROJECT")) + + ;; refile + (setq org-refile-targets '((nil :maxlevel . 9) + (org-agenda-files :maxlevel . 9)) + org-outline-path-complete-in-steps nil + org-refile-use-outline-path 'file) + + (setq org-stuck-projects + '("+PROJECT/-SOMEDAY-DONE-MAYBE" ("NEXT") ("@shop") + "\\<IGNORE\\>")) ;; todo (setq org-todo-keywords - '((sequence "TODO" "NEXT" "WAITING" "SOMEDAY" "PROJECT" "|" "DONE" "CANCELED"))) + '((sequence "TODO(t)" ; to do later + "NEXT" ; doing now or to do soon + "WAITING(w)" "SOMEDAY(s)" + "|" "DONE(d)" "CANCELED(c)"))) (setq org-log-done t) ;; tags (setq org-tag-alist '((:startgroup . nil) - ("work" . ?w) ("home" . ?h) ("errants" . ?e) + ("@work" . ?w) ("@home" . ?h) ("errants" . ?e) (:endgroup . nil) ("phone" . ?p) ("FLAGGED" . ?f) - ("URGENT" . ?u))) + ("URGENT" . ?u) + ("PROJECT" . ?p))) ;; org babel (org-babel-do-load-languages @@ -52,21 +69,40 @@ (use-package org-agenda :ensure nil + :after (org) + :commands (org-agenda) :init (setq org-agenda-dim-blocked-tasks nil) (setq org-agenda-skip-deadline-prewarning-if-scheduled t) (setq org-deadline-warning-days 10) (setq org-agenda-compact-blocks t) (setq org-agenda-custom-commands - '(("d" "Daily agenda and all TODOs" - ((tags "PRIORITY=\"A\"" - ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "High-priority unfinished tasks:"))) - (agenda "" ((org-agenda-ndays-to-span 1))) - (alltodo "" - ((org-agenda-skip-function '(or (org-agenda-skip-if nil '(scheduled deadline)))) - (org-agenda-overriding-header "All normal priority tasks:")))))))) - + '(("D" "Daily agenda and all TODOs" + ((agenda "" ((org-agenda-span 1))) + (tags-todo "+PRIORITY=\"A\"") + (tags-todo "computer|@office|phone") + (tags "PROJECT+CATEGORY=\"elephants\"") + (todo "WAITING")) + ((org-agenda-compact-blocks t))) + ("W" "Weekly Review" + ((agenda "" ((org-agenda-ndays-to-span 7))) + (stuck "") ; review stuck porjects as designated by org-stuck-projects + (todo "NEXT") + (todo "WAITING"))) + ("d" "Upcoming deadlines" agenda "" + ((org-agenda-time-grid nil) + (org-deadline-warning-days 365) + (org-agenda-entry-types '(:deadline)))) + ("c" "Weekly schedule" agenda "" + ((org-agenda-span 7) + (org-agenda-repeating-timestamp-show-all t) + (org-agenda-entry-types '(:deadline :scheduled)))) + ("g" . "GTD contexts") + ("gh" "Home" tags-todo "home") + ("p" . "Priorities") + ("pa" "A items" tags-todo "+PRIORITIES=\"A\"") + ("pb" "B items" tags-todo "+PRIORITIES=\"B\"") + ("pc" "C items" tags-todo "+PRIORITIES=\"C\"")))) (use-package evil-org :ensure t |