aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/modes/init-org-mode.el
blob: 1bbf17d71a124b7b9ffd5fbd60f768cc9cc9ce4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
(use-package org
  :after evil
  :commands org-agenda
  :hook ((org-mode . (lambda () (setq tab-width 4))))
  :init
  (setq org-src-tab-acts-natively t)
  :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-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)

  ;; todo
  (setq org-todo-keywords
	'((sequence "TODO" "NEXT" "WAITING" "SOMEDAY" "PROJECT" "|" "DONE" "CANCELED")))
  (setq org-log-done t)

  ;; tags
  (setq org-tag-alist '((:startgroup . nil)
			("work" . ?w) ("home" . ?h) ("errants" . ?e)
			(:endgroup . nil)
			("@phone" . ?p)))

  ;; org babel
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((shell . t))))

(use-package org-agenda
  :ensure nil
  :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:"))))))))


(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-mode)