 ;; UTF-8 bullets for org mode
 (use-package org-bullets
   :ensure t
+  :after org
   :hook (org-mode . org-bullets-mode))
 
 (use-package org-journal
-  :ensure t)
+  :ensure t
+  :after org
+  :bind
+  ("C-c n j" . org-journal-new-entry)
+  :custom
+  (org-journal-date-prefix "#+title: ")
+  (org-journal-file-format "%Y-%m-%d.org")
+  (org-journal-dir "/Volumes/code/roam")
+  (org-journal-date-format "%A, %d %B %Y"))
 
 (use-package org-roam
   :ensure t
-  :hook
-  (after-init . org-roam-mode)
-  :custom
-  (org-roam-directory "/Volumes/code/roam")
-      :bind (:map org-roam-mode-map
+  :after org
+  :hook (after-init . org-roam-mode)
+  :config
+  (setq org-roam-directory "/Volumes/code/roam"
+        org-roam-db-location "~/.emacs.d/org-roam.db")
+  :bind (:map org-roam-mode-map
               (("C-c n l" . org-roam)
                ("C-c n f" . org-roam-find-file)
-               ("C-c n g" . org-roam-graph))
+               ("C-c n g" . org-roam-graph)
+               ("C-c n b" . org-roam-switch-to-buffer)
+               ("C-c n r" . org-roam-find-ref)
+               ("C-c n d" . org-roam-find-directory))
               :map org-mode-map
-              (("C-c n i" . org-roam-insert))
-              (("C-c n I" . org-roam-insert-immediate))))
+              (("C-c n i" . org-roam-insert))))
+
+(use-package org-roam-protocol)
+
+(use-package org-roam-capture
+  :after org-roam
+  :config
+  (setq org-roam-capture-templates
+        '(("d" "default" plain (function org-roam-capture--get-point)
+           "%?"
+           :file-name "%<%Y%m%d%H%M%S>-${slug}"
+           :head "#+title: ${title}\n#+roam_alias:\n#+roam_tags:\n"
+           :unnarrowed t))
+        org-roam-capture-ref-templates
+        '(("r" "ref" plain (function org-roam-capture--get-point)
+           "#+roam_key: ${ref}\n%?"
+           :file-name "%<%Y%m%d%H%M%S>_web_${slug}"
+           :head "#+title: ${title}]\n#+roam_tags: website\n"
+           :unnarrowed t))
+        org-roam-dailies-capture-templates
+        '(("d" "daily" plain (function org-roam-capture--get-point)
+           ""
+           :immediate-finish t
+           :file-name "journal_%<%Y-%m-%d>"
+           :head "#+title: %<%Y-%m-%d %a>\n#+roam_tags: journal\n"))
+        ))
 
 (use-package company-org-roam
   :ensure t
+  :after org company
   :config
   (push 'company-org-roam company-backends))
 

    (setq initial-frame-alist '((tool-bar-lines . 0)))
    (setq default-frame-alist '((tool-bar-lines . 0)))))

;; Setup package, use-package, and repositories
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")

  :config
  (company-terraform-init))

(defun reload-init-file ()
  (interactive)
  (load-file user-init-file))

(global-set-key (kbd "C-c r") 'reload-init-file)    ; Reload .emacs file

;; keep init.el clean
(setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file 'noerror)
