From 6e32e49b4dbb1702f8951e525928dbc3872310f7 Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Thu, 12 Nov 2020 10:01:12 +0100 Subject: [PATCH] config/doom: extend config & add annotate package --- .config/doom/.gitignore | 1 - .config/doom/config.el | 59 ++++++++++++++++++++++++++++++---------- .config/doom/packages.el | 53 ++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 .config/doom/packages.el diff --git a/.config/doom/.gitignore b/.config/doom/.gitignore index 7ee6a79..3052865 100644 --- a/.config/doom/.gitignore +++ b/.config/doom/.gitignore @@ -1,3 +1,2 @@ init.el local.el -packages.el diff --git a/.config/doom/config.el b/.config/doom/config.el index 7d898e7..8323cdf 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -26,22 +26,41 @@ ;; `load-theme' function. This is the default: (setq doom-theme 'doom-one) +(setq doom-font (font-spec :family "Fira Code" :size 22 :weight 'semi-light) + doom-variable-pitch-font (font-spec :family "sans" :size 25)) + +(setq display-line-numbers-type 'relative) + (map! :leader "u" 'evil-prev-buffer :leader "i" 'evil-next-buffer :leader "bq" 'doom/save-and-kill-buffer - :leader "mj" 'org-insert-heading) + :leader "mj" 'org-insert-heading + :leader "aa" 'annotate-annotate + :leader "as" 'annotate-mode + ) + +;; Undo (setq evil-want-fine-undo t) +(setq undo-tree-auto-save-history t) +(setq undo-tree-history-directory-alist `(("" . (expand-file-name "backups/undo" user-emacs-directory)))) + +(setq amalgamating-undo-limit 5) + +; (advice-add 'undo-auto--last-boundary-amalgamating-number :override #'ignore) + +;; Global config +(setq confirm-kill-emacs nil) + (setq initial-major-mode 'org-mode) (desktop-save-mode 1) -(setq whitespace-global-modes -1) +(global-whitespace-mode -1) (whitespace-mode -1) ;; Backups & auto-saves - (setq auto-save-default t) (setq auto-save-interval 40) @@ -52,25 +71,21 @@ version-control t) (setq vc-make-backup-files t) -(setq undo-tree-auto-save-history t) -(setq undo-tree-history-directory-alist `(("" . (expand-file-name "backups/undo" user-emacs-directory)))) +;; Data dirs -(setq amalgamating-undo-limit 5) - -; (advice-add 'undo-auto--last-boundary-amalgamating-number :override #'ignore) +(defvar user-data-dir "~/data" "Location of the main user data") (load! "./local.el" nil t) ; ORG -(defvar user-data-dir "~/data" "Location of the main user data") +;; Fix xdg-open - https://askubuntu.com/questions/646631/emacs-doesnot-work-with-xdg-open +(setq process-connection-type nil) (setq org-image-actual-width 200) (set-file-template! 'org-mode :ignore t) -;; If you use `org' and don't want your org files in the default location below, -;; change `org-directory'. It must be set before org loads! (let ((default-directory user-data-dir)) (setq org-directory (expand-file-name "1-projects")) (require 'org) @@ -99,10 +114,26 @@ (add-hook 'org-mode-hook 'org-toggle-blocks) (add-hook 'org-mode-hook 'org-toggle-inline-images) (add-hook 'org-mode-hook (apply-partially '+org/close-all-folds 2)) +(add-hook 'org-mode-hook (apply-partially 'whitespace-mode -1)) -;; This determines the style of line numbers in effect. If set to `nil', line -;; numbers are disabled. For relative line numbers, set this to `relative'. -(setq display-line-numbers-type 'relative) +;; https://christiantietze.de/posts/2019/06/org-fold-heading/ +(defun ct/org-foldup () + "Hide the entire subtree from root headline at point." + (interactive) + (while (ignore-errors (outline-up-heading 1))) + (org-flag-subtree t)) + +(defun ct/org-shifttab (&optional arg) + (interactive "P") + (if (or (null (org-current-level)) ; point is before 1st heading, or + (and (= 1 (org-current-level)) ; at level-1 heading, or + (org-at-heading-p)) + (org-at-table-p)) ; in a table (to preserve cell movement) + ; perform org-shifttab at root level elements and inside tables + (org-shifttab arg) + ; try to fold up elsewhere + (ct/org-foldup))) +(define-key org-mode-map (kbd "S-") 'ct/org-shifttab) ;; Here are some additional functions/macros that could help you configure Doom: ;; diff --git a/.config/doom/packages.el b/.config/doom/packages.el new file mode 100644 index 0000000..b15d47d --- /dev/null +++ b/.config/doom/packages.el @@ -0,0 +1,53 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) + +(package! annotate) +(package! visual-fill-column)