From 43b356933766807cff3cce9dda6955469f4df49c Mon Sep 17 00:00:00 2001 From: gxlin Date: Tue, 6 Jul 2021 22:00:15 +0800 Subject: Reorganized emacs config --- .emacs.d/lisp/init-org.el | 128 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 .emacs.d/lisp/init-org.el (limited to '.emacs.d/lisp/init-org.el') diff --git a/.emacs.d/lisp/init-org.el b/.emacs.d/lisp/init-org.el new file mode 100644 index 0000000..caadeec --- /dev/null +++ b/.emacs.d/lisp/init-org.el @@ -0,0 +1,128 @@ +(use-package org + :ensure t + :after evil + :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 "a") 'org-agenda + (kbd "l") 'org-store-link + (kbd "c") 'org-capture) + :config + (require 'org-tempo) + (setq org-directory "~/notes/") + (setq org-default-notes-file (concat org-directory "/inbox.org")) + (setq org-capture-templates + '(("t" "TODO" entry (file+headline org-default-notes-file "Tasks") + "* TODO %?\nCaptured on %U\n %i\n %a") + ("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-start-on-weekday 0) + (setq org-adapt-indentation nil) + (setq org-descriptive-links nil) + (evil-define-key 'normal org-mode-map + (kbd "TAB") 'org-cycle + (kbd "RET") 'org-open-at-point + (kbd "os") 'org-schedule + (kbd "od") 'org-deadline + (kbd "or") 'org-refile + (kbd "oil") 'org-insert-link + (kbd "oih") 'org-insert-heading + (kbd "oci") 'org-clock-in + (kbd "oco") 'org-clock-out + (kbd "sp") 'org-set-property) + (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") + "\\")) + + ;; todo + (setq org-todo-keywords + '((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) + (:endgroup . nil) + ("phone" . ?p) + ("FLAGGED" . ?f) + ("URGENT" . ?u) + ("PROJECT" . ?p))) + + ;; org babel + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t))) + + ;; org-habit + (add-to-list 'org-modules 'org-habit t)) + +(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" + ((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 + :after (org evil) + :hook (org-mode . (lambda () (evil-org-mode))) + :config + (evil-org-set-key-theme '(navigation insert textobjects additional calendar todo)) + (require 'evil-org-agenda) + (evil-org-agenda-set-keys) + (evil-define-key 'motion org-agenda-mode-map + (kbd "q") (lambda () + (interactive) + (org-save-all-org-buffers) + (org-agenda-quit)))) + +(provide 'init-org) -- cgit v1.2.3