;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

(setq user-full-name "Colin Powell"
      user-mail-address "colin@unbl.ink")

(nyan-mode)

(setq doom-theme 'doom-one
      doom-font (font-spec :family "Iosevka" :size 14 :weight 'regular)
      doom-big-font (font-spec :family "Iosevka" :size 18 :weight 'regular)
      doom-variable-pitch-font (font-spec :family "Overpass" :size 12))

(setq display-line-numbers-type t)

;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/var/org/")

(load! "+agenda-fix")
(defun vulpea-agenda-files-update (&rest _)
  (setq org-agenda-files vulpea-project-files))

(setq org-roam-directory "~/var/org/"
      org-roam-dailies-directory "dailies")

(advice-add 'org-agenda :before #'vulpea-agenda-files-update)
(advice-add 'org-todo-list :before #'vulpea-agenda-files-update)

(map! ;; Easier window movement
 :n "C-h" 'evil-window-left
 :n "C-j" 'evil-window-down
 :n "C-k" 'evil-window-up
 :n "C-l" 'evil-window-right

 (:map evil-treemacs-state-map
       "C-h" 'evil-window-left
       "C-l" 'evil-window-right))

(defun unfill-paragraph ()
  "Takes a multi-line paragraph and makes it into a single line of text."
  (interactive)
  (let ((fill-column (point-max)))
    (fill-paragraph nil)))

(define-key global-map "\M-z" 'unfill-paragraph)

(defun file-notify-rm-all-watches ()
  "Remove all existing file notification watches from Emacs."
  (interactive)
  (maphash
   (lambda (key _value)
     (file-notify-rm-watch key))
   file-notify-descriptors))


(setq frame-title-format
      '(""
        (:eval
         (if (s-contains-p org-roam-directory (or buffer-file-name ""))
             (replace-regexp-in-string
              ".*/[0-9]*-?" "☰ "
              (subst-char-in-string ?_ ?  buffer-file-name))
           "%b"))
        (:eval
         (let ((project-name (projectile-project-name)))
           (unless (string= "-" project-name)
             (format (if (buffer-modified-p)  " ◉ %s" "  ●  %s") project-name))))))

(setq mm-text-html-renderer 'w3m)
(setq w3m-fill-column 88)

(setq lsp-lens-enable 1
      lsp-ui-sideline-enable 1
      lsp-enable-links 1
      lsp-headerline-breadcrumb-enable 1
      lsp-modeline-code-actions-enable 1
      lsp-modeline-diagnostics-enable 1
      lsp-completion-show-detail 1
      lsp-file-watch-threshold nil)
