Skip to content

gabr1sr/.emacs.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 

Repository files navigation

Emacs init.el Literate Configuration

This is my Emacs Literate Configuration. I’m currently using it in my NixOS setup. You can modify and use as you want.

How to use

To export all emacs-lisp code blocks to init.el file, you must use C-c C-v t or M-x org-babel-tangle.

Support

This configuration has support for the following topcs:

Programming Languages

  • Rust
  • Solidity
  • Erlang
  • Elixir
  • JavaScript
  • TypeScript
  • Nix
  • Lean4

Markup / Configuration Languages

  • TOML
  • YAML
  • Dockerfile
  • Markdown
  • Mermaid
  • PlantUML
  • Editorconfig

Others

  • Org-roam
  • Biblio
  • Citar
  • PDFView
  • VTerm

Early Init File

(setq package-enable-at-startup nil)

Optimizations

Garbage Collector Optimizations.

(setq read-process-output-max (* 10 1024 1024))
(setq gc-cons-threshold 33554432)

Global Variables

Global variables are variables used throughout the configuration.

(setq global/bibliography-list '("~/org/biblio/books.bib"
				 "~/org/biblio/blockchain.bib"
				 "~/org/biblio/whitepapers.bib"))

Git Variables

Variables used for Git-related things.

(setq user-full-name "Gabriel Rosa"
      user-email-address "[email protected]")

Custom Functions

; based on:
; - https://gluer.org/blog/2023/automating-ox-hugo-slugs-even-more/
; - https://ox-hugo.scripter.co/doc/org-capture-setup/
(defun org-hugo-new-subtree-post-capture-template ()
  (let* ((title (read-from-minibuffer "Post Title: "))
	 (slug (org-hugo-slug title)))
    (mapconcat #'identity
	       `(
		 ,(concat "** POST " title)
		 ":PROPERTIES:"
		 ,(concat ":EXPORT_FILE_NAME: " slug)
		 ,(concat ":EXPORT_HUGO_SLUG: " slug)
		 ":EXPORT_DESCRIPTION: description"
		 ":END:"
		 "%?")
	       "\n")))

Straight.el Bootstrap

Bootstrapping straight.el.

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

Encoding

Set editor default encoding.

(prefer-coding-system 'utf-8-unix)
(set-language-environment "UTF-8")

Startup

Things that are loaded when Emacs starts.

(setq load-prefer-newer t
      inhibit-startup-message t)

(global-display-line-numbers-mode 1)
(scroll-bar-mode -1)
(menu-bar-mode -1)
(tool-bar-mode -1)

Fonts

Editor fonts.

(set-face-attribute 'default nil :font "JetBrains Mono" :height 100 :weight 'regular)
(set-fontset-font t 'emoji "Segoe UI Emoji")

Custom

Load custom file and set cache, backup and autosave directories.

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(ignore-errors (load custom-file))

(defvar user-cache-directory (expand-file-name ".cache" user-emacs-directory))
(defvar user-backup-directory (expand-file-name "backup" user-emacs-directory))
(defvar user-autosave-directory (expand-file-name "autosave" user-emacs-directory))

(dolist (dir (list user-cache-directory user-backup-directory user-autosave-directory))
  (when (not (file-directory-p dir))
    (make-directory dir t)))

(setq backup-directory-alist `(("." . ,user-backup-directory))
      auto-save-filename-transforms `(("." ,user-autosave-directory t))
      auto-save-list-file-prefix (concat user-autosave-directory ".saves-")
      tramp-backup-directory-alist `((".*" . ,user-backup-directory))
      tramp-auto-save-directory user-autosave-directory)

Electric Pairs

Use the built-in autopairs mode.

(when (fboundp 'electric-pair-mode)
  (electric-pair-mode t))

Compatibility

Minimal adjustments to solve compatibility issues.

pdf-view

(dolist (mode '(pdf-view-mode-hook writeroom-mode-hook))
  (add-hook mode (lambda () (display-line-numbers-mode 0))))

Tree Sitter

Tree Sitter languages support.

(setq treesit-language-source-alist
      '((rust "https://github.com/tree-sitter/tree-sitter-rust")
	(heex "https://github.com/phoenixframework/tree-sitter-heex")
	(elixir "https://github.com/elixir-lang/tree-sitter-elixir")
	(javascript "https://github.com/tree-sitter/tree-sitter-javascript")
	(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
	(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
	(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile")
	(make "https://github.com/alemuller/tree-sitter-make")
	(markdown "https://github.com/ikatyang/tree-sitter-markdown")
	(python "https://github.com/tree-sitter/tree-sitter-python")
	(toml "https://github.com/tree-sitter/tree-sitter-toml")
	(yaml "https://github.com/ikatyang/tree-sitter-yaml")
	(html "https://github.com/tree-sitter/tree-sitter-html")
	(css "https://github.com/tree-sitter/tree-sitter-css")
	(json "https://github.com/tree-sitter/tree-sitter-json")
	(c "https://github.com/tree-sitter/tree-sitter-c")
	(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
	(cmake "https://github.com/uyha/tree-sitter-cmake")
	(org "https://github.com/milisims/tree-sitter-org")
	(solidity "https://github.com/JoranHonig/tree-sitter-solidity")))

Packages

Package-specific configurations.

which-key

(use-package which-key
  :straight (which-key :type git :host github :repo "justbur/emacs-which-key")
  :hook (after-init . which-key-mode)
  :config
  (which-key-setup-side-window-bottom))

company

(use-package company
  :straight (company :type git :host github :repo "company-mode/company-mode")
  :hook (after-init . global-company-mode)
  :custom
  (company-minimum-prefix-length 2)
  (company-tooltip-limit 14)
  (company-tooltip-align-annotations t)
  (company-require-match 'never)
  (company-auto-commit nil)
  (company-dabbrev-other-buffers nil)
  (company-dabbrev-ignore-case nil)
  (company-dabbrev-downcase nil))

company-box

(use-package company-box
  :straight (company-box :type git :host github :repo "sebastiencs/company-box")
  :after company
  :hook (company-mode . company-box-mode)
  :custom
  (company-box-show-single-candidate t)
  (company-box-backends-colors nil)
  (company-box-tooltip-limit 50))

vertico

(use-package vertico
  :straight (vertico :type git :host github :repo "minad/vertico")
  :init
  (vertico-mode)
  :custom
  (vertico-cycle t)
  :bind
  (:map vertico-map
	("C-j" . vertico-next)
	("C-k" . vertico-previous)
	("C-f" . vertico-exit)
	:map minibuffer-local-map
	("M-h" . backward-kill-word)))

savehist

(use-package savehist
  :straight (savehist :type built-in)
  :init
  (savehist-mode))

marginalia

(use-package marginalia
  :straight (marginalia :type git :host github :repo "minad/marginalia")
  :after (vertico)
  :init
  (marginalia-mode)
  :custom
  (marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))

embark

(use-package embark
  :straight (embark :type git :host github :repo "oantolin/embark")
  :hook (eldoc-documentation-functions . embark-eldoc-first-target)
  :custom
  (prefix-help-command #'embark-prefix-help-command)
  (add-to-list 'display-buffer-alist
	       '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
		 nil
		 (window-parameters (mode-line-format . none))))
  :bind
  ("C-." . embark-act)
  ("C-;" . embark-dwim)
  ("C-h B" . embark-bindings))

citar

(use-package citar
  :straight (citar :type git :host github :repo "emacs-citar/citar")
  :config
  ; icons
  (defvar citar-indicator-files-icons
    (citar-indicator-create
     :symbol (nerd-icons-faicon
	      "nf-fa-file_o"
	      :face 'nerd-icons-green
	      :v-adjust -0.1)
     :function #'citar-has-files
     :padding " "
     :tag "has:files"))
  (defvar citar-indicator-links-icons
    (citar-indicator-create
     :symbol (nerd-icons-faicon
              "nf-fa-link"
              :face 'nerd-icons-orange
              :v-adjust 0.01)
     :function #'citar-has-links
     :padding "  "
     :tag "has:links"))
  (defvar citar-indicator-notes-icons
    (citar-indicator-create
     :symbol (nerd-icons-codicon
              "nf-cod-note"
              :face 'nerd-icons-blue
              :v-adjust -0.3)
     :function #'citar-has-notes
     :padding "    "
     :tag "has:notes"))
  (defvar citar-indicator-cited-icons
    (citar-indicator-create
     :symbol (nerd-icons-faicon
              "nf-fa-circle_o"
              :face 'nerd-icon-green)
     :function #'citar-is-cited
     :padding "  "
     :tag "is:cited"))
  (setq citar-indicators
	(list citar-indicator-files-icons
	      citar-indicator-links-icons
	      citar-indicator-notes-icons
	      citar-indicator-cited-icons))
  :custom
  (citar-bibliography global/bibliography-list)
  (citar-notes-paths '("~/org/roam/"))
  (citar-open-note-function 'orb-citar-edit-note)
  (citar-at-point-function 'embark-act)
  ; templates
  (citar-templates
   '((main . "${author editor:30%sn}     ${date year issued:4}     ${title:48}")
     (suffix . "          ${=key= id:15}    ${=type=:12}    ${tags keywords:*}")
     (preview . "${author editor:%etal} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.\n")
     (note . "Notes on ${author editor:%etal}, ${title}")))
  ; advices
  (advice-add 'org-cite-insert :after #'(lambda (args)
					              (save-excursion (left-char) (citar-org-update-prefix-suffix))))
  :bind
  (("C-c b b" . citar-insert-citation)
   ("C-c b r" . citar-insert-reference)
   ("C-c b f" . citar-open-note)
   ("C-c b o" . citar-open)))

citar-embark

(use-package citar-embark
  :straight (citar-embark :type git :host github :repo "emacs-citar/citar")
  :after (citar embark)
  :config
  (citar-embark-mode))

citeproc

(use-package citeproc
  :straight (citeproc :type git :host github :repo "andras-simonyi/citeproc-el"))

org

(use-package org
  :straight (org :type built-in)
  :custom
  ; org
  (org-directory (file-truename "~/org/"))
  (org-todo-keywords '((sequence "TODO(t)" "ONGOING(o)" "WAIT(w@)" "|" "DONE(d!)" "CANCELED(c@)")
		       (sequence "[ ](T)" "[-](O)" "[?](W)" "|" "[X](D)")
		       (sequence "POST(p)" "|" "POSTED(P!)")
		       (sequence "TOREAD(r)" "|" "READ(R!)")
		       (sequence "TOLEARN(l)" "|" "LEARNED(L!)")))
  
  ; indentation
  (org-startup-truncated t)
  (org-startup-indented t)

  ; src block indentation
  (org-src-preserve-indentation t)
  (org-src-tab-acts-natively t)
  (org-edit-src-content-indentation 0)

  ; logging
  (org-log-done 'time)
  (org-log-into-drawer t)

  ; latex preview
  (org-format-latex-options (plist-put org-format-latex-options :scale 2.0))

  ; don't show emphasis markers
  (org-hide-emphasis-markers t)
  
  ; templates
  (org-capture-templates
   '(("t" "Tasks")
      ("tt" "Unscheduled Task" entry (file+olp "~/org/tasks.org" "Inbox")
       "* TODO %?\n%i"
       :empty-lines-after 1
       :jump-to-captured t)

      ("tl" "Located Task" entry (file+olp "~/org/tasks.org" "Inbox")
       "* TODO %?\n%a\n%i"
       :empty-lines-after 1)

      ("ts" "Scheduled Task" entry (file+olp "~/org/tasks.org" "Inbox")
       "* TODO %?\nSCHEDULED: %^t\n%i"
       :empty-lines-after 1)

      ("td" "Deadline Task" entry (file+olp "~/org/tasks.org" "Inbox")
       "* TODO %?\nDEADLINE: %^t\n%i"
       :empty-lines-after 1)

     ("l" "Learning")
      ("ll" "Unscheduled Learning" entry (file+olp "~/org/learn.org" "Inbox")
       "* TOLEARN %?\n%i"
       :empty-lines-after 1
       :jump-to-captured t)

      ("ls" "Scheduled Learning" entry (file+olp "~/org/learn.org" "Inbox")
       "* TOLEARN %?\nSCHEDULED: %^t\n%i"
       :empty-lines-after 1)

      ("ld" "Deadline Learning" entry (file+olp "~/org/learn.org" "Inbox")
       "* TOLEARN %?\nDEADLINE: %^t\n%i"
       :empty-lines-after 1)

     ("r" "Reading")
      ("rr" "Reading" entry (file+olp "~/org/read.org" "Inbox")
       "* TOREAD %?\n%i"
       :empty-lines-after 1
       :jump-to-captured t)
     
      ("ra" "Reading Article" entry (file+olp "~/org/read.org" "Inbox")
       "* TOREAD %? :article:\n%i"
       :empty-lines-after 1)

      ("rb" "Reading Book" entry (file+olp "~/org/read.org" "Inbox")
       "* TOREAD %? :book:\n%i"
       :empty-lines-after 1)

     ("b" "Blog")
      ("bp" "Blog Post" entry (file+olp "~/org/blog.org" "Posts")
       (function org-hugo-new-subtree-post-capture-template)
       :empty-lines-after 1
       :jump-to-captured t)

     ("c" "Cooking")
      ("ci" "Cookbook Import" entry (file "~/org/cookbook.org")
       "%(org-chef-get-recipe-from-url)"
       :empty-lines-after 1)

      ("cm" "Cookbook Manual" entry (file "~/org/cookbook.org")
       "* %^{Recipe title: }\n  :PROPERTIES:\n  :source-url:\n  :servings:\n  :prep-time:\n  :cook-time:\n  :ready-in:\n  :END:\n** Ingredients\n   %?\n\n** Directions\n\n")

     ("a" "Auditing")
      ("af" "Audit Finding" entry (file (lambda () (concat projectile-project-root "findings.org")))
       (file "~/org/templates/audit_finding.org"))))
  :bind
  ("C-c a" . org-agenda)
  ("C-c l" . org-store-link)
  ("C-c c" . org-capture))

org-agenda

(use-package org-agenda
  :straight (org-agenda :type built-in)
  :custom
  (org-agenda-files '("habits.org" "tasks.org" "learn.org" "blog.org" "read.org"))
  (org-agenda-start-with-log-mode t)
  (org-agenda-custom-commands
   '(("z" "Super view"
      ((agenda "" ((org-agenda-span 'day)
		   (org-super-agenda-groups
		    '((:name "ConcluĂ­dos"
			     :time-grid t
			     :order 1)
		      (:name "Hábitos"
			     :habit t
			     :order 2)
		      (:name "Importantes"
			     :priority "A"
			     :order 3)
		      (:name "Estudando"
			     :todo "TOLEARN"
			     :order 4)
		      (:name "Tarefas"
			     :and (:scheduled today :todo "TODO")
			     :deadline today
			     :order 5)
		      (:name "Outros"
			     :todo "[ ]"
			     :order 6)
		      (:discard (:anything t))))))
       (alltodo "" ((org-agenda-overriding-header "")
		    (org-super-agenda-groups
		      '((:name "PrĂłximos"
			       :and (:scheduled future :not (:habit t))
			       :deadline future
			       :order 1)
			(:name "Esperando"
			       :todo "WAIT"
			       :order 2)
			(:name "Livros"
			       :todo "TOREAD"
			       :order 3)
			(:name "Publicar"
			       :todo "POST"
			       :order 4)
			(:name "Agendar"
			       :and (:todo "TODO" :scheduled nil)
			       :order 5)
			(:name "Estudar"
			       :and (:todo "TOLEARN" :scheduled nil)
			       :order 6)
			(:discard (:anything t)))))))))))

org-babel

(use-package ob
  :straight (ob :type built-in)
  :config
  (defun org-babel-execute:c (body params)
    "Execute a C BODY according to its header arguments PARAMS.
This function is called by `org-babel-execute-src-block'."
    (funcall 'org-babel-execute:C body params))
  :custom
  (org-confirm-babel-evaluate nil)
  (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t)
							   (rust . t)
							   (c . t)
							   (mermaid . t))))

ob-rust

(use-package ob-rust
  :straight (ob-rust :type git :host github :repo "micanzhang/ob-rust"))

ob-async

(use-package ob-async
  :straight (ob-async :type git :host github :repo "astahlman/ob-async"))

ob-C

(use-package ob-C
  :straight (ob-C :type built-in))

org-cite

(use-package oc
  :straight (oc :type built-in)
  :custom
  (org-cite-insert-processor 'citar)
  (org-cite-follow-processor 'citar)
  (org-cite-activate-processor 'citar)
  (org-cite-global-bibliography global/bibliography-list)
  (org-cite-export-processors '((latex biblatex)
				(t csl)))
  (org-cite-csl-styles-dir "~/org/csl/"))

(use-package oc-biblatex
  :straight (oc-biblatex :type built-in)
  :after oc)

(use-package oc-csl
  :straight (oc-csl :type built-in)
  :after oc)

(use-package oc-natbib
  :straight (oc-natbib :type built-in)
  :after oc)

ox-hugo

(use-package ox-hugo
  :straight (ox-hugo :type git :host github :repo "kaushalmodi/ox-hugo")
  :after ox
  :custom
  (org-hugo-base-dir "~/org/blog/"))

org-roam

(use-package org-roam
  :straight (org-roam :type git :host github :repo "org-roam/org-roam")
  :init
  (require 'org-roam-dailies)
  (org-roam-db-sync)
  :config
  (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:42}" 'face 'org-tag)))
  (org-roam-db-autosync-enable)
  :custom
  ; org-roam
  (org-roam-directory (file-truename "~/org/roam/"))
  (org-roam-complete-everywhere t)

  ; org-roam-dailies
  (org-roam-dailies-directory "daily/")
  
  ; org-roam templates
  (org-roam-capture-templates
   '(("d" "default" plain "%?"
      :if-new (file+head "${slug}.org" "#+title: ${title}\n#+date: %U\n")
      :unnarrowed t)

     ("z" "zettel" plain (file "~/org/templates/zettel.org")
      :if-new (file+head "${slug}.org" "#+title: ${title}\n#+date: %U\n")
      :unarrowed t)

     ("r" "reading notes" plain "%?"
      :target (file+head "${citar-citekey}.org" "#+title: ${note-title}\n#+created: %U\n")
      :unarrowed t)

     ("n" "nirvax notes" plain "- tags ::\n- source ::\n\n%?"
      :target (file+head "nirvax/${slug}.org" "#+title: Nirvax: ${title}\n#+filetags: :nirvax:\n#+author: %n\n#+created: %U\n")
      :unarrowed t)))

  ; org-roam-dailies templates
  (org-roam-dailies-capture-templates
   '(("d" "default" entry "* %?\nCREATED: %U\n%i"
      :empty-lines 1
      :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))

     ("s" "scheduled study" entry "* TODO %? :study:\nSCHEDULED: %^t\nCREATED: %U\n%i"
      :empty-lines 1
      :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))

     ("t" "scheduled task" entry "* TODO %? :task:\nSCHEDULED: %^t\nCREATED: %U\n%i"
      :empty-lines 1
      :target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))
  
  :bind
  ; org-roam bind
  (("C-c n l" . org-roam-buffer-toggle)
   ("C-c n f" . org-roam-node-find)
   ("C-c n g" . org-roam-graph)
   ("C-c n i" . org-roam-node-insert)
   ("C-c n c" . org-roam-capture)
   ("C-c n u" . org-roam-ui-mode)
   
   ; org-roam-dailies bind
   :map org-roam-dailies-map
   ("Y" . org-roam-dailies-capture-yesterday)
   ("T" . org-roam-dailies-capture-tomorrow))
  
  :bind-keymap
  ("C-c n d" . org-roam-dailies-map))

Templates

~/org/templates/zettel.org

- tags ::
- source ::

org-roam-bibtex

(use-package org-roam-bibtex
  :straight (org-roam-bibtex :type git :host github :repo "org-roam/org-roam-bibtex")
  :after (org-roam)
  :hook (org-roam-mode . org-roam-bibtex-mode)
  :custom
  (org-roam-bibtex-preformat-keywords
   '("=key=" "title" "file" "author" "keywords"))
  (orb-process-file-keyword t)
  (orb-process-file-field t)
  (orb-attached-file-extensions '("pdf")))

org-roam-ui

(use-package org-roam-ui
  :straight (org-roam-ui :type git :host github :repo "org-roam/org-roam-ui")
  :after (org-roam)
  :custom
  (org-roam-ui-sync-theme t)
  (org-roam-ui-follow t)
  (org-roam-ui-update-on-save t)
  (org-roam-ui-open-on-start t))

citar-org-roam

(use-package citar-org-roam
  :straight (citar-org-roam :type git :host github :repo "emacs-citar/citar-org-roam")
  :after (citar org-roam)
  :config
  (citar-org-roam-mode)
  (setq citar-org-roam-note-title-template "${author} - ${title}")
  (setq citar-org-roam-capture-template-key "r"))

pdftools

(use-package pdf-tools
  :mode ("\\.pdf\\'" . pdf-view-mode)
  :magic ("%PDF" . pdf-view-mode)
  :config
  (pdf-tools-install-noverify)
  :bind
  (:map pdf-view-mode-map ("q" . #'kill-current-buffer)))

org-pdftools

(use-package org-pdftools
  :straight (org-pdftools :type git :host github :repo "fuxialexander/org-pdftools")
  :hook (org-mode . org-pdftools-setup-link))

org-modern

(use-package org-modern
  :straight (org-modern :type git :host github :repo "minad/org-modern")
  :after (org)
  :config
  (global-org-modern-mode))

org-download

(use-package org-download
  :straight (org-download :type git :host github :repo "abo-abo/org-download")
  :after (org)
  :custom
  (org-download-screenshot-method "grim -g \"$(slurp)\" -o %s")
  :bind
  (:map org-mode-map
	(("s-Y" . org-download-screenshot)
	 ("s-y" . org-download-yank))))

magit

(use-package magit
  :straight (magit :type git :host github :repo "magit/magit")
  :custom
  (magit-display-buffer-function 'magit-display-buffer-fullframe-status-topleft-v1)
  (magit-bury-buffer-function 'magit-restore-window-configuration))

magit-todos

(use-package magit-todos
  :straight (magit-todos :type git :host github :repo "alphapapa/magit-todos")
  :after magit
  :config
  (setq hl-todo-keyword-faces
	'(("TODO" . "#cc9393")
	  ("AUDIT" . "#6e57d2")
	  ("@audit" . "#6e57d2")))
  (setq magit-todos-keywords-list '("TODO" "AUDIT" "@audit"))
  (setq magit-todos-keyword-suffix "\\(?:[([][^])]+[])]\\)? ")
  (magit-todos-mode 1))

ssh-agency

(use-package ssh-agency
  :straight (ssh-agency :type git :host github :repo "magit/ssh-agency"))

editorconfig

(use-package editorconfig
  :straight (editorconfig :type git :host github :repo "editorconfig/editorconfig-emacs")
  :config
  (editorconfig-mode 1))

doom

doom-themes

(use-package doom-themes
  :straight (doom-themes :type git :host github :repo "doomemacs/themes")
  :if (display-graphic-p)
  :config
  (setq doom-themes-enable-bold t
	      doom-themes-enable-italic t)
  (load-theme 'doom-one t)
  (doom-themes-visual-bell-config)
  (doom-themes-org-config))

doom-modeline

(use-package doom-modeline
  :straight (doom-modeline :type git :host github :repo "seagle0128/doom-modeline")
  :if (display-graphic-p)
  :hook (after-init . doom-modeline-mode))

projectile

(use-package projectile
  :straight (projectile type: git :host github :repo "bbatsov/projectile")
  :init
  (projectile-mode)
  :bind
  (:map projectile-command-map ("n" . projectile-add-known-project))
  :bind-keymap
  ("C-c p" . projectile-command-map))

eglot

(use-package eglot
  :straight (eglot :type built-in)
  :init
  (setq eglot-sync-connect 1
	eglot-autoshutdown t
	eglot-auto-display-help-buffer nil)
  :config
  (setq eglot-stay-out-of '(flymake))
  (setq-default eglot-workspace-configuration
		'(:solidity (:defaultCompiler "remote"
			     :compileUsingLocalVersion "latest"
           		         :compileUsingLocalVersion "solc")
		  :rust-analyzer (:procMacro (:ignored (:leptos_macro ["server"])))))
  (add-to-list 'eglot-server-programs
	           '(solidity-mode . ("vscode-solidity-server" "--stdio")))
  (add-to-list 'eglot-server-programs
	       '((elixir-ts-mode heex-ts-mode) . ("elixir-ls"))))

eglot-booster

(use-package eglot-booster
  :straight (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
  :after eglot
  :config
  (eglot-booster-mode))

eglot-x

(use-package eglot-x
  :straight (eglot-x :type git :host github :repo "nemethf/eglot-x")
  :after eglot
  :config
  (eglot-x-setup))

apheleia

(use-package apheleia
  :straight (apheleia :type git :host github :repo "radian-software/apheleia")
  :config
  (setf (alist-get 'rustfmt apheleia-formatters)
	'("rustfmt" "--quiet" "--edition" "2021" "--emit" "stdout"))
   (add-to-list 'apheleia-mode-alist '(rust-ts-mode . rustfmt))
   (add-to-list 'apheleia-mode-alist '(rust-mode . rustfmt))
  (apheleia-global-mode +1))

solidity-mode

(use-package solidity-mode
  :straight (solidity-mode :type git :host github :repo "ethereum/emacs-solidity")
  :hook (solidity-mode . eglot-ensure)
  :custom
  (solidity-comment-style 'slash)
  (solidity-solc-path "solc"))

erlang

(use-package erlang
  :straight (erlang :source melpa)
  :mode ("\\.erlang\\'" . erlang-mode)
  :mode ("/rebar\\.config\\(?:\\.script\\)?\\'" . erlang-mode)
  :mode ("/\\(?:app\\|sys\\)\\.config\\'" . erlang-mode)
  :hook (erlang-mode . eglot-ensure))

tree-sitter langs

elixir-ts-mode

(use-package elixir-ts-mode
  :straight (elixir-ts-mode :type git :host github :repo "wkirschbaum/elixir-ts-mode")
  :hook (elixir-ts-mode . eglot-ensure)
  :init
  (add-to-list 'org-src-lang-modes '("elixir" . elixir-ts)))

heex-ts-mode

(use-package heex-ts-mode
  :straight (heex-ts-mode :type git :host github :repo "wkirschbaum/heex-ts-mode")
  :hook (heex-ts-mode . eglot-ensure)
  :init
  (add-to-list 'org-src-lang-modes '("heex" . heex-ts)))

rust-ts-mode

(use-package rust-ts-mode
  :straight (rust-ts-mode :type built-in)
  :mode "\\.rs\\'"
  :hook ((rust-ts-mode . eglot-ensure)
	 (rust-ts-mode . combobulate-mode))
  :init
  (add-to-list 'org-src-lang-modes '("rust" . rust-ts)))

js-ts-mode

(use-package js-ts-mode
  :straight (js-ts-mode :type built-in)
  :mode "\\.js\\'"
  :mode "\\.mjs\\'"
  :mode "\\.cjs\\'"
  :hook ((js-ts-mode . eglot-ensure)
	 (js-ts-mode . combobulate-mode))
  :init
  (add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))
  (add-to-list 'org-src-lang-modes '("javascript" . js-ts)))

typescript-ts-mode

(use-package typescript-ts-mode
  :straight (typescript-ts-mode :type built-in)
  :mode "\\.ts\\'"
  :mode "\\.mts\\'"
  :hook ((typescript-ts-mode . eglot-ensure)
	 (typescript-ts-mode . combobulate-mode))
  :init
  (add-to-list 'major-mode-remap-alist '(typescript-mode . typescript-ts-mode))
  (add-to-list 'org-src-lang-modes '("typescript" . typescript-ts)))

tsx-ts-mode

(use-package tsx-ts-mode
  :straight (tsx-ts-mode :type built-in)
  :mode "\\.tsx\\'"
  :mode "\\.jsx\\'"
  :hook ((tsx-ts-mode . eglot-ensure)
	 (tsx-ts-mode . combobulate-mode))
  :init
  (add-to-list 'org-src-lang-modes '("tsx" . tsx-ts)))

json-ts-mode

(use-package json-ts-mode
  :straight (json-ts-mode :type built-in)
  :mode "\\.json\\'"
  :hook ((json-ts-mode . eglot-ensure)
	 (json-ts-mode . combobulate-mode))
  :init
  (add-to-list 'major-mode-remap-alist '(json-mode . json-ts-mode))
  (add-to-list 'org-src-lang-modes '("json" . json-ts)))

c-ts-mode

(use-package c-ts-mode
  :straight (c-ts-mode :type built-in)
  :mode "\\.c\\'"
  :mode "\\.h\\'"
  :hook ((c-ts-mode . eglot-ensure)
	 (c-ts-mode . combobulate-mode))
  :init
  ; (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
  (add-to-list 'org-src-lang-modes '("c" . c-ts))
  :config
  (defun my-c-ts-indent-style ()
    "Override the built-in K&R indentation style with some additional rules"
    `(((match "case_statement" "compound_statement") parent-bol c-ts-mode-indent-offset)
      ,@(alist-get 'k&r (c-ts-mode--indent-styles 'c))))
  :custom
  (c-ts-mode-indent-style #'my-c-ts-indent-style))

c++-ts-mode

(use-package c++-ts-mode
  :straight (c++-ts-mode :type built-in)
  :mode "\\.cpp\\'"
  :mode "\\.cxx\\'"
  :mode "\\.hpp\\'"
  :hook ((c++-ts-mode . eglot-ensure)
	 (c++-ts-mode . combobulate-mode))
  :init
  ; (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
  (add-to-list 'org-src-lang-modes '("c++" . c++-ts))
  (add-to-list 'org-src-lang-modes '("cpp" . c++-ts)))

elcord

(use-package elcord
  :straight (elcord :type git :host github :repo "Mstrodl/elcord"))

lean4-mode

(use-package lean4-mode
  :straight (lean4-mode :type git :host github :repo "leanprover/lean4-mode" :files ("*.el" "data"))
  :commands (lean4-mode))

nix-mode

(use-package nix-mode
  :straight (nix-mode :type git :host github :repo "NixOS/nix-mode")
  :mode "\\.nix\\'")

direnv

(use-package direnv
  :straight (direnv :type git :host github :repo "wbolster/emacs-direnv")
  :config
  (direnv-mode))

org-drill

(use-package org-drill
  :straight (org-drill :type git :host gitlab :repo "phillord/org-drill"))

plantuml-mode

(use-package plantuml-mode
  :straight (plantuml-mode :type git :host github :repo "gabr1sr/plantuml-mode")
  :mode "\\.plantuml\\'"
  :init
  (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
  (setq plantuml-executable-path "plantuml"
	plantuml-default-exec-mode 'executable))

dockerfile-mode

(use-package dockerfile-mode
  :straight (dockerfile-mode :type git :host github :repo "spotify/dockerfile-mode")
  :custom
  (dockerfile-mode-command "podman"))

yaml-mode

(use-package yaml-mode
  :straight (yaml-mode :type git :host github :repo "yoshiki/yaml-mode")
  :mode "\\.yml\\'"
  :mode "\\.yaml\\'"
  :init
  (add-to-list 'org-src-lang-modes '("yaml" . yaml)))

ob-mermaid

(use-package ob-mermaid
  :straight (ob-mermaid :type git :host github :repo "arnm/ob-mermaid"))

vterm

(use-package vterm
  :straight (vterm :type git :host github :repo "akermu/emacs-libvterm")
  :init
  (defun run-vterm-custom ()
    "This function will run vterm inside the project root or in the current directory."
    (interactive)
    (if (projectile-project-p) (projectile-run-vterm) (vterm default-directory)))

  (defun run-vterm-other-window-custom ()
    "This function will run vterm in other window inside the project root or in the current directory."
    (interactive)
    (if (projectile-project-p) (projectile-run-vterm-other-window) (vterm-other-window default-directory)))
  
  :bind (("C-c t" . run-vterm-custom)
	 ("C-c C-t" . run-vterm-other-window-custom)))

org-tree-slide

(use-package org-tree-slide
  :straight (org-tree-slide :type git :host github :repo "takaxp/org-tree-slide")
  :after org
  :commands (org-tree-slide-mode org-tree-slide-move-next-tree org-tree-slide-move-previous-tree org-tree-slide-skip-done-toggle)
  :bind
  (:map org-tree-slide-mode-map
	("C-c s d" . org-tree-slide-move-next-tree)
	("C-c s a" . org-tree-slide-move-previous-tree))
  (:map org-mode-map
	("C-c n p" . org-tree-slide-mode)
	("C-c n P" . org-tree-slide-skip-done-toggle)))

writeroom-mode

(use-package writeroom-mode
  :straight (writeroom-mode :type git :host github :repo "joostkremers/writeroom-mode")
  :custom
  (writeroom-global-effects nil)
  (writeroom-maximize-window nil)
  :bind
  ("C-M-z" . writeroom-mode)
  (:map writeroom-mode-map
	("C-M-<" . writeroom-decrease-width)
	("C-M->" . writeroom-increase-width)
	("C-M-=" . writeroom-adjust-width)))

flycheck

(use-package flycheck
  :straight (flycheck :type git :host github :repo "flycheck/flycheck")
  :init
  (global-flycheck-mode))

flycheck-posframe

(use-package flycheck-posframe
  :straight (flycheck-posframe :type git :host github :repo "alexmurray/flycheck-posframe")
  :after flycheck
  :hook (flycheck-mode . flycheck-posframe-mode))

flycheck-popup-tip

(use-package flycheck-popup-tip
  :straight (flycheck-popup-tip :type git :host github :repo "flycheck/flycheck-popup-tip")
  :after flycheck
  :hook (flycheck-mode . flycheck-popup-tip-mode))

flycheck-eglot

(use-package flycheck-eglot
  :straight (flycheck-eglot :type git :host github :repo "flycheck/flycheck-eglot")
  :after (eglot flycheck)
  :hook (eglot-managed-mode . flycheck-eglot-mode))

erc

(use-package erc
  :straight (erc :type built-in)
  :config
  (setq erc-track-shorten-start 8
	erc-kill-buffer-on-part t
	erc-auto-query 'bury))

orderless

(use-package orderless
  :straight (orderless :type git :host github :repo "oantolin/orderless")
  :custom
  (completion-styles '(orderless basic))
  (completion-category-overrides '((file (styles basic partial-completion))))
  :config
  (defun just-one-face (fn &rest args)
    (let ((orderless-match-faces [completions-common-part]))
      (apply fn args)))

  (advice-add 'company-capf--candidates :around #'just-one-face)
  (setq orderless-component-separator "[ &]"))

all-the-icons

(use-package all-the-icons
  :straight (all-the-icons :type git :host github :repo "domtronn/all-the-icons.el")
  :if (display-graphic-p))

(use-package all-the-icons-dired
  :straight (all-the-icons-dired :type git :host github :repo "jtbm37/all-the-icons-dired")
  :if (display-graphic-p)
  :hook (dired-mode . all-the-icons-dired-mode))

(use-package all-the-icons-completion
  :straight (all-the-icons-completion :type git :host github :repo "iyefrat/all-the-icons-completion")
  :if (display-graphic-p)
  :after (all-the-icons marginalia)
  :hook (marginalia-mode . all-the-icons-completion-marginalia-setup)
  :init
  (all-the-icons-completion-mode))

mixed-pitch

(use-package mixed-pitch
  :straight (mixed-pitch :type git :host gitlab :repo "jabranham/mixed-pitch")
  :hook (writeroom-mode . +toggle-mixed-pitch-mode-h)
  :config
  (defun +toggle-mixed-pitch-mode-h ()
    "Enable `mixed-pitch-mode` when in `writeroom-mode`."
    (when (apply #'derived-mode-p '(org-mode markdown-mode))
      (mixed-pitch-mode (if writeroom-mode +1 -1)))))

org-modern-indent

(use-package org-modern-indent
  :straight (org-modern-indent :type git :host github :repo "jdtsmith/org-modern-indent")
  :hook (org-modern-mode . org-modern-indent-mode))

org-super-agenda

(use-package org-super-agenda
  :straight (org-super-agenda :type git :host github :repo "alphapapa/org-super-agenda")
  :hook (org-agenda-mode . org-super-agenda-mode))

org-chef

(use-package org-chef
  :straight (org-chef :type git :host github :repo "Chobbes/org-chef"))

combobulate

(use-package combobulate
  :straight (combobulate :type git :host github :repo "mickeynp/combobulate")
  :preface
  (setq combobulate-key-prefix "C-c o"))

consult

(use-package consult
  :straight (consult :type git :host github :repo "minad/consult")
  :hook (completion-list-mode . consult-preview-at-point-mode)
  :bind (("C-c M-x" . consult-mode-command)
         ("C-c h" . consult-history)
         ("C-c k" . consult-kmacro)
         ("C-c m" . consult-man)
         ("C-c i" . consult-info)
         ([remap Info-search] . consult-info)
         ("C-x M-:" . consult-complex-command)
         ("C-x b" . consult-buffer)           
         ("C-x 4 b" . consult-buffer-other-window)
         ("C-x 5 b" . consult-buffer-other-frame)
         ("C-x t b" . consult-buffer-other-tab)
         ("C-x r b" . consult-bookmark)
         ("C-x p b" . consult-project-buffer)
         ("M-#" . consult-register-load)
         ("M-'" . consult-register-store)
         ("C-M-#" . consult-register)
         ("M-y" . consult-yank-pop)
         ("M-g e" . consult-compile-error)
         ("M-g f" . consult-flycheck)
         ("M-g g" . consult-goto-line)
         ("M-g M-g" . consult-goto-line)
         ("M-g o" . consult-outline)
         ("M-g m" . consult-mark)
         ("M-g k" . consult-global-mark)
         ("M-g i" . consult-imenu)
         ("M-g I" . consult-imenu-multi)
         ("M-s d" . consult-find)
         ("M-s c" . consult-locate)
         ("M-s g" . consult-grep)
         ("M-s G" . consult-git-grep)
         ("M-s r" . consult-ripgrep)
         ("M-s l" . consult-line)
         ("M-s L" . consult-line-multi)
         ("M-s k" . consult-keep-lines)
         ("M-s u" . consult-focus-lines)
         ("M-s e" . consult-isearch-history)
         :map isearch-mode-map
         ("M-e" . consult-isearch-history)
         ("M-s e" . consult-isearch-history)
         ("M-s l" . consult-line)
         ("M-s L" . consult-line-multi)
         :map minibuffer-local-map
         ("M-s" . consult-history)
         ("M-r" . consult-history))
  :init
  (setq register-preview-delay 0.5
        register-preview-function #'consult-register-format)

  (advice-add #'register-preview :override #'consult-register-window)

  (setq xref-show-xrefs-function #'consult-xref
        xref-show-definitions-function #'consult-xref)

  :config
  (consult-customize
   consult-theme :preview-key '(:debounce 0.2 any)
   consult-ripgrep consult-git-grep consult-grep
   consult-bookmark consult-recent-file consult-xref
   consult--source-bookmark consult--source-file-register
   consult--source-recent-file consult--source-project-recent-file
   :preview-key '(:debounce 0.4 any))

  (setq consult-narrow-key "<"))

consult-flycheck

(use-package consult-flycheck
  :straight (consult-flycheck :type git :host github :repo "minad/consult-flycheck"))

embark-consult

(use-package embark-consult
  :straight (embark-consult :type git :host github :repo "oantolin/embark" :files ("embark-consult.el"))
  :hook
  (embark-collect-mode . consult-preview-at-point-mode))

charm-freeze

(use-package charm-freeze
  :straight (charm-freeze :type git :host codeberg :repo "godmaire/charm-freeze.el" :branch "main")
  :custom
  (charm-freeze-format "png")
  (charm-freeze-theme "doom-one2"))

About

Emacs Literate Configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published