dotfiles

andersuno dotfiles
git clone git://git.andersuno.nu/dotfiles.git
Log | Files | Refs | README

config.el (10479B)


      1 ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
      2 
      3 ;; Place your private configuration here! Remember, you do not need to run 'doom
      4 ;; sync' after modifying this file!
      5 
      6 
      7 ;; Some functionality uses this to identify you, e.g. GPG configuration, email
      8 ;; clients, file templates and snippets.
      9 (setq user-full-name "Anders Hedman"
     10       user-mail-address "anders.hedman01@gmail.com")
     11 
     12 ;;Doom exposes five (optional) variables for controlling fonts in Doom. Here
     13 ;; are the three important ones:
     14 ;;
     15 ;; + `doom-font'
     16 ;; + `doom-variable-pitch-font'
     17 ;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
     18 ;;   presentations or streaming.
     19 ;;
     20 ;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
     21 ;; font string. You generally only need these two:
     22 ;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
     23 ;;       doom-variable-pitch-font (font-spec :family "sans" :size 13))
     24 
     25 ;; There are two ways to load a theme. Both assume the theme is installed and
     26 ;; available. You can either set `doom-theme' or manually load a theme with the
     27 ;; `load-theme' function. This is the default:
     28 (setq doom-theme 'doom-one)
     29 
     30 ;; If you use `org' and don't want your org files in the default location below,
     31 ;; change `org-directory'. It must be set before org loads!
     32  (setq org-directory "~/NC/org/")
     33 
     34 ;; This determines the style of line numbers in effect. If set to `nil', line
     35 ;; numbers are disabled. For relative line numbers, set this to `relative'.
     36 (setq display-line-numbers-type t)
     37 
     38 
     39 ;; Here are some additional functions/macros that could help you configure Doom:
     40 ;;
     41 ;; - `load!' for loading external *.el files relative to this one
     42 ;; - `use-package!' for configuring packages
     43 ;; - `after!' for running code after a package has loaded
     44 ;; - `add-load-path!' for adding directories to the `load-path', relative to
     45 ;;   this file. Emacs searches the `load-path' when you load packages with
     46 ;;   `require' or `use-package'.
     47 ;; - `map!' for binding new keys
     48 ;;
     49 ;; To get information about any of these functions/macros, move the cursor over
     50 ;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
     51 ;; This will open documentation for it, including demos of how they are used.
     52 ;;
     53 ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
     54 ;; they are implemented.
     55 
     56 (add-to-list 'initial-frame-alist '(fullscreen . maximized))
     57 
     58 (defun random-choice (items)
     59   (nth (random (length items)) items))
     60 
     61 ;;(random-choice '("a" "b" "c"))
     62 
     63 (setq doom-themes-treemacs-theme 'Default) ; AKA doom-color
     64 ;;(setq doom-themes-treemacs-theme 'doom-color)
     65 ;;(setq doom-themes-treemacs-theme 'doom-atom)
     66 
     67 (setq doom-modeline-major-mode-icon t)
     68 (setq confirm-kill-emacs nil)
     69 ;;(setq fancy-splash-image "~/.doom.d/splash/doom-emacs-dash.png")
     70 ;;(setq fancy-splash-image "~/.doom.d/splash/doom-emacs-color.png")
     71 ;;(setq fancy-splash-image "~/.doom.d/splash/doom-emacs.png")
     72 
     73 (setq fancy-splash-image
     74       (random-choice
     75        '("~/.doom.d/splash/doom-emacs-dash.png"
     76          "~/.doom.d/splash/doom-emacs-color.png"
     77          "~/.doom.d/splash/emacs-og.png"
     78          "~/.doom.d/splash/emacs-pen.png"
     79          ;;"~/.doom.d/splash/gnu-bw.png"
     80          ;;"~/.doom.d/splash/gnu.png"
     81          ;;"~/.doom.d/splash/stallman.png"
     82          "~/.doom.d/splash/doom-emacs.png")))
     83 
     84 (map! :leader :prefix "o"
     85       "l" #'elfeed)
     86 
     87 ;; Markdown nesting troublesome with nativecomp
     88 ;; Exclude markdown from nativecomp instead of setting nested nil
     89 ;; From lisp/doom-packages.el
     90 (when (featurep 'native-compile)
     91   (after! comp
     92     ;; HACK Disable native-compilation for some troublesome packages
     93     (mapc (doom-partial #'add-to-list 'native-comp-deferred-compilation-deny-list)
     94           (list
     95                 "/markdown-.*\\.el\\'"
     96 ))))
     97 (setq markdown-nested-imenu-heading-index t)
     98 
     99 (setq-default fill-column 70)
    100 (use-package! visual-fill-column
    101   :config
    102   (setq-default visual-fill-column-width 77)
    103   (setq-default visual-fill-column-center-text nil)
    104   )
    105 
    106 (use-package! org
    107   ;; Set above, before org load (setq org-directory "~/NC/org/")
    108   :config
    109   (setq org-ellipsis " ▾")
    110   (setq org-agenda-files "~/NC/org/agenda.org")
    111   (setq org-log-done 'time)
    112   (setq org-log-into-drawer t)
    113   (custom-set-faces!
    114     '(org-document-title :height 1.3)
    115     '(org-level-1 :inherit outline-1 :height 1.4)
    116     '(org-level-2 :inherit outline-2 :height 1.15)
    117     '(org-level-3 :inherit outline-3 :height 1.12)
    118     '(org-level-4 :inherit outline-4 :height 1.09)
    119     '(org-level-5 :inherit outline-5 :height 1.06)
    120     '(org-level-6 :inherit outline-6 :height 1.03)
    121     )
    122   (setq org-refile-targets
    123         '(("archive.org"  :maxlevel . 1)
    124           ("todo.org"     :maxlevel . 1)
    125           ("docs.org"     :maxlevel . 1)
    126           ))
    127   (setq org-capture-templates
    128         '(("t" "todo" entry
    129            (file "inbox.org")
    130            "* TODO %? \n%i\n%a" :prepend t)
    131           ("n" "notes" entry
    132            (file+headline +org-capture-notes-file "Inbox")
    133            "* %u %?\n%i\n%a" :prepend t)
    134           ("j" "journal" entry
    135            (file+olp+datetree +org-capture-journal-file)
    136            "* %U %?\n%i\n%a" :prepend t)))
    137   (setq org-agenda-custom-commands
    138         '(("A" "Agenda and all TODOs"
    139            ((agenda "")
    140             (alltodo "")))
    141           ("u" "Unscheduled Todos"
    142            ((alltodo ""
    143                      ((org-agenda-overriding-header "Unscheduled")
    144                       (org-agenda-skip-function '(org-agenda-skip-entry-if
    145                                                   'scheduled
    146                                                   'deadline
    147                                                   'regexp ":ongoing:")
    148                                                 )))))
    149           )
    150         )
    151   (advice-add 'org-refile :after 'org-save-all-org-buffers)
    152   )
    153 
    154 ;; org-present config
    155 (after! org
    156   (defun my/org-present-start ()
    157     (text-scale-set 5)
    158     (setq display-line-numbers nil)
    159     (setq visual-fill-column-width 50)
    160     (setq visual-fill-column-center-text t)
    161     (visual-fill-column-mode 1)
    162     (visual-line-mode 1))
    163 
    164   (defun my/org-present-end ()
    165     (setq display-line-numbers t)
    166     (setq visual-fill-column-width 77)
    167     (setq visual-fill-column-center-text nil)
    168     (visual-fill-column-mode 0)
    169     (visual-line-mode 0))
    170 
    171   (defun my/org-present-prepare-slide (buffer-name heading)
    172     (org-overview)
    173     (org-fold-show-entry)
    174     (org-fold-show-children))
    175 
    176   (add-hook 'org-present-mode-hook 'my/org-present-start)
    177   (add-hook 'org-present-mode-quit-hook 'my/org-present-end)
    178   (add-hook 'org-present-after-navigate-functions 'my/org-present-prepare-slide)
    179   )
    180 
    181 (use-package! treemacs
    182   :config
    183   (treemacs-indent-guide-mode 1)
    184   (treemacs-follow-mode t))
    185 
    186 (after! mu4e
    187   (setq mu4e-update-interval (* 60 60))
    188 
    189   (set-email-account! "Gmail"
    190   '((mu4e-sent-folder       . "/Gmail/[Gmail]/Sent Mail")
    191     (mu4e-drafts-folder     . "/Gmail/[Gmail]/Drafts")
    192     (mu4e-trash-folder      . "/Gmail/[Gmail]/Trash")
    193     (mu4e-refile-folder     . "/Gmail/[Gmail]/All Mail")
    194     ;;(smtpmail-smtp-user     . "anders.hedman01@gmail.com")
    195     (mu4e-compose-signature . "---\nAnders Hedman"))
    196   t)
    197 
    198   (set-email-account! "andersuno.nu"
    199   '((mu4e-sent-folder       . "/andersuno.nu/Sent")
    200     (mu4e-drafts-folder     . "/andersuno.nu/Drafts")
    201     (mu4e-trash-folder      . "/andersuno.nu/Trash")
    202     (mu4e-refile-folder     . "/andersuno.nu/Archive")
    203     (user-mail-address      . "anders@andersuno.nu")
    204     (smtpmail-smtp-user     . "anders@andersuno.nu")
    205     (mu4e-compose-signature . "---\nAnders Hedman"))
    206   t)
    207 
    208   (setq mu4e-maildir-shortcuts
    209         '((:maildir "/Gmail/INBOX"             :key ?i)
    210           (:maildir "/Gmail/[Gmail]/Sent Mail" :key ?s)
    211           (:maildir "/Gmail/[Gmail]/Drafts"    :key ?d)
    212           (:maildir "/Gmail/[Gmail]/Trash"     :key ?t)
    213           (:maildir "/Gmail/[Gmail]/All Mail"  :key ?a)
    214           (:maildir "/andersuno.nu/INBOX"      :key ?I)
    215           (:maildir "/andersuno.nu/Sent"       :key ?S)
    216           (:maildir "/andersuno.nu/Drafts"     :key ?D)
    217           (:maildir "/andersuno.nu/Trash"      :key ?T)
    218           (:maildir "/andersuno.nu/Archive"    :key ?A)))
    219 
    220   (setq mu4e-bookmarks
    221         '((:name "Unread messages"
    222            :query "flag:unread AND NOT flag:trashed AND maildir:/Gmail/INBOX OR maildir:/andersuno.nu/INBOX AND flag:unread"
    223            :key ?u)
    224           (:name "Today's messages"
    225            :query "date:today..now AND maildir:/Gmail/INBOX"
    226            :key ?t)
    227           (:name "Last 7 days"
    228            :query "date:7d..now AND maildir:/Gmail/INBOX"
    229            :hide-unread t
    230            :key ?w)
    231           (:name "Messages with images"
    232            :query "mime:image/*"
    233            :key ?p)))
    234 
    235   (setq smtpmail-smtp-server "mail.andersuno.nu"
    236         smtpmail-stream-type 'ssl
    237         smtpmail-smtp-service 30465)
    238   )
    239 
    240 ;; Ansible-mode customizations
    241 (def-project-mode! +ansible-yaml-mode
    242   :modes '(yaml-mode)
    243   :add-hooks '(ansible ansible-auto-decrypt-encrypt ansible-doc-mode)
    244   :files (or "roles/" "tasks/main.yml" "local.yml" "inventory" "ansible.cfg"))
    245 
    246 (defun ansible-navigator-run ()
    247   "Utilize terminal-here-launch to run BUFFER with ansible-navigator"
    248   (interactive)
    249   (terminal-here-launch (list "ansible-navigator" "run" (buffer-file-name))))
    250 
    251 (defun ansible-navigator-run-check ()
    252   "Utilize terminal-here-launch to run BUFFER with ansible-navigator with option
    253         -C/--check"
    254   (interactive)
    255   (terminal-here-launch (list "ansible-navigator" "run" (buffer-file-name) "-C")))
    256 
    257 (defun ansible-navigator-run-tags (tags)
    258   "Utilize terminal-here-launch to run BUFFER with ansible-navigator with option
    259         -t/--tags TAGS"
    260   (interactive "sTags: ")
    261   (terminal-here-launch (list "ansible-navigator" "run" (buffer-file-name) (format "-t %s" tags))))
    262 
    263 (defun ansible-navigator-run-check-tags (tags)
    264   "Utilize terminal-here-launch to run BUFFER with ansible-navigator with option
    265         -C/--check and -t/--tags TAGS"
    266   (interactive "sTags: ")
    267   (terminal-here-launch (list "ansible-navigator" "run" (buffer-file-name) "-C" (format "-t %s" tags))))
    268 
    269 (use-package! ansible
    270   :config
    271   (map! :map ansible-key-map
    272         :localleader
    273         :desc "Navigator run"           "r" #'ansible-navigator-run
    274         :desc "Navigator check"         "c" #'ansible-navigator-run-check
    275         :desc "Navigator run tags"      "T" #'ansible-navigator-run-tags
    276         :desc "Navigator check tags"    "t" #'ansible-navigator-run-check-tags
    277         ))