Advertisement
CftfKees2x

emacs config 2022-07-26 Aegis

Jul 26th, 2022
1,553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 13.16 KB | None | 0 0
  1. ;; You will most likely need to adjust this font size for your system!
  2. (defvar runemacs/default-font-size 125)
  3.  
  4. (setq inhibit-startup-message t)
  5.  
  6. (scroll-bar-mode -1)        ; Disable visible scrollbar
  7. (tool-bar-mode -1)          ; Disable the toolbar
  8. (tooltip-mode -1)           ; Disable tooltips
  9. (set-fringe-mode 10)        ; Give some breathing room
  10.  
  11. (menu-bar-mode -1)            ; Disable the menu bar
  12.  
  13. ;; Set up the visible bell
  14. (setq visible-bell t)
  15.  
  16. (column-number-mode)
  17. (global-display-line-numbers-mode t)
  18.  
  19. ;; Disable line numbers for some modes
  20. (dolist (mode '(org-mode-hook
  21.                 term-mode-hook
  22.                 shell-mode-hook
  23.                 eshell-mode-hook))
  24.   (add-hook mode (lambda () (display-line-numbers-mode 0))))
  25.  
  26. ;; Font Configuration ----------------------------------------------------------
  27.  
  28. (set-face-attribute 'default nil :font "Fira Code Retina" :height runemacs/default-font-size)
  29.  
  30. ;; Set the fixed pitch face
  31. (set-face-attribute 'fixed-pitch nil :font "Fira Code Retina" :height 125)
  32.  
  33. ;; Set the variable pitch face
  34. (set-face-attribute 'variable-pitch nil :font "Cantarell" :height 125 :weight 'regular)
  35.  
  36. ;; Package Manager Configuration -----------------------------------------------
  37.  
  38. ;; Initialize package sources
  39. (require 'package)
  40.  
  41. (setq package-archives '(("melpa" . "https://melpa.org/packages/")
  42.                          ("org" . "https://orgmode.org/elpa/")
  43.                          ("elpa" . "https://elpa.gnu.org/packages/")))
  44.  
  45. (package-initialize)
  46. (unless package-archive-contents
  47.  (package-refresh-contents))
  48.  
  49. ;; Initialize use-package on non-Linux platforms
  50. (unless (package-installed-p 'use-package)
  51.    (package-install 'use-package))
  52.  
  53. (require 'use-package)
  54. (setq use-package-always-ensure t)
  55.  
  56. ;; Ivy Configuration -----------------------------------------------------------
  57.  
  58. (use-package ivy
  59.   ;:diminish
  60.   :bind (("C-s" . swiper)
  61.          :map ivy-minibuffer-map
  62.          ("TAB" . ivy-alt-done)
  63.          ("C-l" . counsel-up-directory)
  64.          ("C-j" . ivy-next-line)
  65.          ("C-k" . ivy-previous-line)
  66.          :map ivy-switch-buffer-map
  67.      ("C-j" . ivy-next-line)
  68.          ("C-k" . ivy-previous-line)
  69.          ("C-l" . counsel-up-directory)
  70.          ("C-d" . ivy-switch-buffer-kill)
  71.          :map ivy-reverse-i-search-map
  72.          ("C-j" . ivy-next-line)
  73.      ("C-k" . ivy-previous-line)
  74.          ("C-d" . ivy-reverse-i-search-kill))
  75.   :config
  76.   (ivy-mode 1))
  77.  
  78. ;; NOTE: The first time you load your configuration on a new machine, you'll
  79. ;; need to run the following command interactively so that mode line icons
  80. ;; display correctly:
  81. ;;
  82. ;; M-x all-the-icons-install-fonts
  83.  
  84. (use-package all-the-icons)
  85.  
  86. ;; for some reason this is crashing emacs rn
  87. ;(use-package doom-modeline
  88. ;  :init (doom-modeline-mode 1)
  89. ;  :custom ((doom-modeline-height 15)))
  90.  
  91. (use-package doom-themes
  92.   :init (load-theme 'doom-dracula t))
  93.  
  94. (use-package rainbow-delimiters
  95.   :hook (prog-mode . rainbow-delimiters-mode))
  96.  
  97. (use-package which-key
  98.   :init (which-key-mode)
  99.   :diminish which-key-mode
  100.   :config
  101.   (setq which-key-idle-delay 1))
  102.  
  103. (use-package counsel
  104.   :bind (("M-x" . counsel-M-x)
  105.          ("C-x b" . counsel-ibuffer)
  106.          ("C-x C-f" . counsel-find-file)
  107.      ("C-M-j" . counsel-switch-buffer)
  108.          :map minibuffer-local-map
  109.          ("C-r" . 'counsel-minibuffer-history)))
  110.  
  111. (use-package ivy-rich
  112.   :init
  113.   (ivy-rich-mode 1))
  114.  
  115. (use-package helpful
  116.   :custom
  117.   (counsel-describe-function-function #'helpful-callable)
  118.   (counsel-describe-variable-function #'helpful-variable)
  119.   :bind
  120.   ([remap describe-function] . counsel-describe-function)
  121.   ([remap describe-command] . helpful-command)
  122.   ([remap describe-variable] . counsel-describe-variable)
  123.   ([remap describe-key] . helpful-key))
  124.  
  125. ;; Key Binding Configuration ---------------------------------------------------
  126.  
  127. ;; Make ESC quit prompts
  128. (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  129.  
  130. (use-package general
  131.   :config
  132.   (general-create-definer rune/leader-keys
  133.     :keymaps '(normal insert visual emacs)
  134.     :prefix "SPC"
  135.     :global-prefix "C-SPC")
  136.  
  137.   (rune/leader-keys
  138.     "t"  '(:ignore t :which-key "toggles")
  139.     "tt" '(counsel-load-theme :which-key "choose theme")))
  140.  
  141. (use-package evil
  142.   :init
  143.   (setq evil-want-integration t)
  144.   (setq evil-want-keybinding nil)
  145.   (setq evil-want-C-u-scroll t)
  146.   (setq evil-want-C-i-jump nil)
  147.   :config
  148.   (evil-mode 1)
  149.   (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
  150.   (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
  151.  
  152.   ;; Use visual line motions even outside of visual-line-mode buffers
  153.   (evil-global-set-key 'motion "j" 'evil-next-visual-line)
  154.   (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
  155.  
  156.   (evil-set-initial-state 'messages-buffer-mode 'normal)
  157.   (evil-set-initial-state 'dashboard-mode 'normal))
  158.  
  159. (use-package evil-collection
  160.   :after evil
  161.   :config
  162.   (evil-collection-init))
  163.  
  164. (use-package hydra)
  165.  
  166. (defhydra hydra-text-scale (:timeout 4)
  167.   "scale text"
  168.   ("j" text-scale-increase "in")
  169.   ("k" text-scale-decrease "out")
  170.   ("f" nil "finished" :exit t))
  171.  
  172. (rune/leader-keys
  173.   "ts" '(hydra-text-scale/body :which-key "scale text"))
  174.  
  175. ;; Projectile, Magit, and Forge are code development and git tools. Remove them if you don't need them.
  176. ;; Projectile Configuration ----------------------------------------------------
  177.  
  178. (use-package projectile
  179.   :diminish projectile-mode
  180.   :config (projectile-mode)
  181.   :custom ((projectile-completion-system 'ivy))
  182.   :bind-keymap
  183.   ("C-c p" . projectile-command-map)
  184.   :init
  185.   ;; NOTE: Set this to the folder where you keep your Git repos!
  186.   (when (file-directory-p "~/../../../git")
  187.     (setq projectile-project-search-path '("~/../../../git"))
  188.   (setq projectile-switch-project-action #'projectile-dired)))
  189.  
  190. (use-package counsel-projectile
  191.   :config (counsel-projectile-mode))
  192.  
  193. ;; Magit Configuration ---------------------------------------------------------
  194.  
  195. (use-package magit
  196.   :custom
  197.   (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
  198.  
  199. ;; NOTE: Make sure to configure a GitHub token before using this package!
  200. ;; - https://magit.vc/manual/forge/Token-Creation.html#Token-Creation
  201. ;; - https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started
  202. (use-package forge)
  203.  
  204. (defun efs/org-mode-setup ()
  205.   (org-indent-mode)
  206.   (variable-pitch-mode 1)
  207.   (visual-line-mode 1)
  208.   (auto-fill-mode 0)
  209.   (setq evil-auto-indent nil))
  210.  
  211. (defun efs/org-font-setup ()
  212.   ;; Replace list hyphen with dot
  213.   (font-lock-add-keywords 'org-mode
  214.                           '(("^ *\\([-]\\) "
  215.                              (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
  216.  
  217.   ;; Set faces for heading levels
  218.   (dolist (face '((org-level-1 . 1.2)
  219.                   (org-level-2 . 1.1)
  220.                   (org-level-3 . 1.05)
  221.                   (org-level-4 . 1.0)
  222.                   (org-level-5 . 1.1)
  223.                   (org-level-6 . 1.1)
  224.                   (org-level-7 . 1.1)
  225.                   (org-level-8 . 1.1)))
  226.     (set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face)))
  227.  
  228.   ;; Ensure that anything that should be fixed-pitch in Org files appears that way
  229.   (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
  230.   (set-face-attribute 'org-code nil   :inherit '(shadow fixed-pitch))
  231.   (set-face-attribute 'org-table nil   :inherit '(shadow fixed-pitch))
  232.   (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
  233.   (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
  234.   (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
  235.   (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
  236.  
  237. (use-package org
  238.   :hook (org-mode . efs/org-mode-setup)
  239.   :bind (("C-c a" . org-agenda))
  240.  
  241.   :config
  242.   (setq org-ellipsis " ▾")
  243.  
  244.   (setq org-agenda-start-with-log-mode t)
  245.   (setq org-log-done 'time)
  246.   (setq org-log-into-drawer t)
  247.  
  248.   (setq org-agenda-files
  249.     '("~/../org"))
  250.   (setq org-deadline-warning-days 8)
  251.  
  252.   (setq org-todo-keywords
  253.     '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@)")
  254.       (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANCELLED(k@)")))
  255.   ;; Configure custom agenda view
  256.   (setq org-agenda-custom-commands
  257.     '(("d" "Dashboard"
  258.        ((agenda "" ((org-deadline-warning-days 7)))
  259.         (todo "NEXT"
  260.           ((org-agenda-overriding-header "Next Tasks")))
  261.         (todo "ACTIVE" ((org-agenda-overriding-header "Active Projects")))))
  262.  
  263.       ("n" "Next Tasks"
  264.        ((todo "NEXT"
  265.           ((org-agenda-overriding-header "Next Tasks")))))
  266.  
  267.       ("W" "Work Tasks" tags-todo "+work") ;; TODO tweak, i don't need this
  268.  
  269.       ;;Low-effort next actions
  270.       ("e" tags-todo "+TODO=\"NEXT\"+Effort<=15&+Effort>0"
  271.        ((org-agenda-overriding-header "Low Effort Tasks")
  272.         (org-agenda-max-todos 20) ;; TODO tweak
  273.         (org-agenda-files org-agenda-files)))
  274.  
  275.       ("w" "Workflow Status"
  276.        ((todo "WAIT"
  277.           ((org-agenda-overriding-header "Waiting on External")
  278.            (org-agenda-files org-agenda-files)))
  279.         (todo "REVIEW"
  280.           ((org-agenda-overriding-header "In Review")
  281.            (org-agenda-files org-agenda-files)))
  282.         (todo "PLAN"
  283.           ((org-agenda-overriding-header "In Planning")
  284.            (org-agenda-todo-list-sublevels nil)
  285.            (org-agenda-files org-agenda-files)))
  286.         (todo "BACKLOG"
  287.           ((org-agenda-overriding-header "Project Backlog")
  288.            (org-agenda-todo-list-sublevels nil)
  289.            (org-agenda-files org-agenda-files)))
  290.         (todo "READY"
  291.           ((org-agenda-overriding-header "Ready for Work")
  292.            (org-agenda-files org-agenda-files)))
  293.         (todo "ACTIVE"
  294.           ((org-agenda-overriding-header "Active Projects")
  295.            (org-agenda-files org-agenda-files)))
  296.         (todo "COMPLETED"
  297.           ((org-agenda-overriding-header "Completed Projects")
  298.            (org-agenda-files org-agenda-files)))
  299.         (todo "CANCELLED"
  300.           ((org-agenda-overriding-header "Cancelled Projects")
  301.            (org-agenda-files org-agenda-files)))))))
  302.  
  303.   (setq org-tag-alist
  304.     '((:startgroup)
  305.           ;; Put mutually exclusive tags here
  306.       (:endgroup)
  307.       ("@errand" . ?E)
  308.       ("@home" . ?H)
  309.       ("@work" . ?W)
  310.       ("agenda" . ?a)
  311.       ("planning" . ?p)
  312.       ("writing" . ?w)
  313.       ("batch" . ?b)
  314.       ("note" . ?n)
  315.       ("creative" . ?c)
  316.       ("homework" . ?h)
  317.       ("idea" . ?i)))
  318.  
  319.   (setq org-refile-targets
  320.     '(("Archive.org" :maxlevel . 1)
  321.       ("Tasks.org" :maxlevel . 1)
  322.       ("Homework.org" :maxlevel . 1)))
  323.  
  324.   ;; Save org buffers after refiling
  325.   (advice-add 'org-refile :after 'org-save-all-org-buffers)
  326.  
  327.   (setq org-capture-templates
  328.     '(("t" "tasks / Projects")
  329.       ("tt" "task" entry (file+olp "~/../org/Tasks.org" "Inbox")
  330.        "* TODO %?\n %U\n %a\n %i" :empty-lines 1)
  331.       ("ts" "clocked Entry Subtask" entry (clock)
  332.        "* TODO %?\n %U\n %a\n %i" :empty-lines 1)
  333.       ("tc" "chore" entry (file "~/../org/Chores.org")
  334.        "* TODO %?\n:PROPERTIES:\n:STYLE: habit\n:END:\n %i" :empty-lines 1)
  335.  
  336.  
  337.       ("j" "Journal Entries")
  338.       ("jj" "Journal" entry
  339.        (fil+olp+datetree "~/../org/Journal.org")
  340.        "\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
  341.        :clock-in :clock-resume
  342.        :empty-lines 1)
  343.       ("jm" "Meeting" entry
  344.        (file+olp+datetree "~/../org/Journal.org")
  345.        "* %<%I:%M %p> - %a :meetings:\n\n%?\n\n"
  346.        :clock-in :clock-resume
  347.        :empty-lines 1)
  348.  
  349.       ("w" "Workflows")
  350.       ("we" "Checking Email" entry (file+olp+datetree ,(dw/get-todays-journal-file-name))
  351.        "* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1)
  352.  
  353.       ("m" "Metrics Capture")
  354.       ("mw" "Weight" table-line (file+headline "~/../org/Metrics.org" "Weight")
  355.        "| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)))
  356.  
  357.   ;; Org habit display config
  358.   (setq org-habit-graph-column 60)
  359.   (setq org-habit-preceding-days 15)
  360.   (setq org-habit-following-days 5)
  361.  
  362.   (efs/org-font-setup))
  363.  
  364. (global-set-key (kbd "C-c c") 'org-capture)
  365.  
  366. (use-package org-bullets
  367.   :after org
  368.   :hook (org-mode . org-bullets-mode)
  369.   :custom
  370.   (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
  371.  
  372. (defun efs/org-mode-visual-fill ()
  373.   (setq visual-fill-column-width 100
  374.         visual-fill-column-center-text t)
  375.   (visual-fill-column-mode 1))
  376.  
  377. (use-package visual-fill-column
  378.   :hook (org-mode . efs/org-mode-visual-fill))
  379.  
  380.  
  381.  
  382. (custom-set-variables
  383.  ;; custom-set-variables was added by Custom.
  384.  ;; If you edit it by hand, you could mess it up, so be careful.
  385.  ;; Your init file should contain only one such instance.
  386.  ;; If there is more than one, they won't work right.
  387.  '(org-modules
  388.    '(ol-bbdb ol-bibtex ol-docview ol-eww ol-gnus org-habit ol-info ol-irc ol-mhe ol-rmail ol-w3m))
  389.  '(package-selected-packages
  390.    '(buffer-move visual-fill-column org-bullets forge magit counsel-projectile projectile hydra doom-themes doom-modeline evil-collection evil general helpful counsel which-key use-package rainbow-delimiters ivy-rich all-the-icons)))
  391. (custom-set-faces
  392.  ;; custom-set-faces was added by Custom.
  393.  ;; If you edit it by hand, you could mess it up, so be careful.
  394.  ;; Your init file should contain only one such instance.
  395.  ;; If there is more than one, they won't work right.
  396.  )
  397.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement