summaryrefslogtreecommitdiff
path: root/init.el
blob: 0b96d15d37538cb94741191f1a071dbfbb3a521c (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
;;; init.el --- minimal single-file Org workflow -*- lexical-binding: t; -*-

;;; Code:

;; --------------------------------------------------
;; Core paths
;; --------------------------------------------------

(setq org-directory (expand-file-name "~/org"))
(setq org-default-notes-file (expand-file-name "obtf.org" org-directory))

;; --------------------------------------------------
;; Startup: agenda as modal view
;; --------------------------------------------------

(setq initial-buffer-choice
      (lambda ()
        (org-agenda nil "a")
        (delete-other-windows)
        (current-buffer)))

;; --------------------------------------------------
;; Package bootstrap
;; --------------------------------------------------

(require 'package)

(setq package-archives
      '(("gnu"    . "https://elpa.gnu.org/packages/")
        ("nongnu" . "https://elpa.nongnu.org/nongnu/")
        ("melpa"  . "https://melpa.org/packages/")))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (pkg '(vertico marginalia orderless consult modus-themes olivetti))
  (unless (package-installed-p pkg)
    (package-install pkg)))

(require 'use-package)
(setq use-package-always-ensure t)

;; --------------------------------------------------
;; UI
;; --------------------------------------------------

(setq inhibit-startup-message t
      inhibit-startup-screen t
      ring-bell-function #'ignore)

(column-number-mode 1)
(show-paren-mode 1)

(when (display-graphic-p)
  (tool-bar-mode -1)
  (scroll-bar-mode -1)
  (set-face-attribute 'default nil :font "JetBrains Mono" :height 120))

(use-package modus-themes
  :config
  (load-theme 'modus-vivendi t))

(use-package olivetti
  :hook (org-mode . olivetti-mode)
  :config
  (setq olivetti-body-width 100))

;; --------------------------------------------------
;; Completion
;; --------------------------------------------------

(use-package vertico
  :init (vertico-mode 1))

(use-package marginalia
  :init (marginalia-mode 1))

(use-package orderless
  :init
  (setq completion-styles '(orderless basic)))

(use-package consult
  :bind (("C-s" . consult-line)
         ("C-c o" . consult-outline)))

;; --------------------------------------------------
;; Org
;; --------------------------------------------------

(use-package org
  :ensure nil
  :bind (("C-c c" . org-capture)
         ("C-c a" . org-agenda)
         ("C-c r" . org-refile))
  :config
  (setq org-agenda-files (list org-default-notes-file)
        org-todo-keywords '((sequence "TODO" "CLARIFY" "|" "DONE"))
        org-log-done 'time
        org-log-into-drawer t)

  ;; modal capture
  (add-to-list 'display-buffer-alist
               '("\*Org Capture\*" (display-buffer-same-window)))

  (add-hook 'org-capture-mode-hook
            (lambda () (delete-other-windows))))

;; --------------------------------------------------
;; Capture templates
;; --------------------------------------------------

(setq org-capture-templates
      `(("i" "Inbox" entry
         (file+headline ,org-default-notes-file "Inbox")
         "* %?\n")

        ("t" "Task" entry
         (file+headline ,org-default-notes-file "Tasks")
         "* TODO %?\n")

        ("q" "Question" entry
         (file+headline ,org-default-notes-file "Questions")
         "* CLARIFY %?\n")

        ("m" "Meeting" entry
         (file+headline ,org-default-notes-file "Meetings")
         "* %<%H:%M> %?\n<%<%Y-%m-%d %a %H:%M>>\n")

        ("r" "Recurring" entry
         (file+headline ,org-default-notes-file "Recurring")
         "* TODO %?\nSCHEDULED: %^t\n")))

(provide 'init)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(safe-local-variable-values
   '((eval progn
	   (setq-local gac-automatically-add-new-files-p t
		       gac-automatically-push-p t
		       gac-debounce-interval 2 gac-default-message
		       (lambda (_filename)
			 (format-time-string
			  "Auto-commit: %Y-%m-%d %H:%M:%S")))
	   (git-auto-commit-mode 1)))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )