Flake ++ Org Config
This commit is contained in:
449
init.el
449
init.el
@@ -1,431 +1,26 @@
|
||||
;; -*- lexical-binding: t -*-
|
||||
;;; init.el --- Where all the magic begins
|
||||
;;
|
||||
;; This file loads Org and then loads the rest of our Emacs initialization from Emacs lisp
|
||||
;; embedded in literate Org files.
|
||||
|
||||
;; Bootstrap straight.el for package management
|
||||
(defvar bootstrap-version)
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
||||
(bootstrap-version 5))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
;; Disable package.el from loading at startup
|
||||
(setq package-enable-at-startup nil)
|
||||
;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files
|
||||
(setq dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name)))
|
||||
|
||||
;; Ensure custom writes to specific file
|
||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
||||
(load custom-file 'noerror 'nomessage)
|
||||
(let* ((org-dir (expand-file-name
|
||||
"lisp" (expand-file-name
|
||||
"org" (expand-file-name
|
||||
"src" dotfiles-dir))))
|
||||
(org-contrib-dir (expand-file-name
|
||||
"lisp" (expand-file-name
|
||||
"contrib" (expand-file-name
|
||||
".." org-dir))))
|
||||
(load-path (append (list org-dir org-contrib-dir)
|
||||
(or load-path nil))))
|
||||
;; load up Org and Org-babel
|
||||
(require 'org)
|
||||
(require 'ob-tangle))
|
||||
|
||||
;; Change the location of file backups/locks into the emacs.d/backups/
|
||||
(setq backup-directory-alist
|
||||
`(("." . ,(concat user-emacs-directory "backups"))))
|
||||
;; load up all literate org-mode files in this directory
|
||||
(mapc #'org-babel-load-file (directory-files dotfiles-dir t "\\.org$"))
|
||||
|
||||
;;;; VISUAL
|
||||
|
||||
;; Disable Scroll bar, menubar
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; Set custom font to Julia-Mono
|
||||
(custom-set-faces
|
||||
'(default ((t (:family "JuliaMono"
|
||||
:height 150
|
||||
:weight normal)))))
|
||||
|
||||
;; Set location of custom theme dir
|
||||
(setq custom-theme-directory (concat user-emacs-directory "themes"))
|
||||
(load-theme 'UniverseHighContrast)
|
||||
|
||||
;;;; END VISUAL
|
||||
|
||||
;;;; PACKAGE INSTALL AND CONFIG
|
||||
|
||||
;; Set the packagemanager of use-package
|
||||
(setq straight-use-package-by-default t)
|
||||
|
||||
;; Default to lazy loading
|
||||
(setq use-package-always-defer t)
|
||||
;; Ensure use-package.el is installed
|
||||
(straight-use-package 'use-package)
|
||||
|
||||
;; Load font ligatures, fancy arrows etc.
|
||||
(use-package ligature
|
||||
:straight (ligature
|
||||
:package "ligature"
|
||||
:host github
|
||||
:type git
|
||||
:repo "mickeynp/ligature.el")
|
||||
:config
|
||||
;; Enable the "www" ligature in every possible major mode
|
||||
(ligature-set-ligatures 't '("www"))
|
||||
;; Enable traditional ligature support in eww-mode, if the
|
||||
;; `variable-pitch' face supports it
|
||||
(ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi"))
|
||||
;; Enable all Cascadia Code ligatures in programming modes
|
||||
(ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
|
||||
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
|
||||
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
|
||||
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
|
||||
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
|
||||
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
|
||||
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
|
||||
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
|
||||
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
|
||||
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
|
||||
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
|
||||
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
|
||||
"\\\\" "://"))
|
||||
;; Enables ligature checks globally in all buffers. You can also do it
|
||||
;; per mode with `ligature-mode'.
|
||||
(global-ligature-mode t))
|
||||
|
||||
;; Ensure shell variables are loaded
|
||||
(use-package exec-path-from-shell :demand
|
||||
:init
|
||||
(exec-path-from-shell-initialize)
|
||||
)
|
||||
|
||||
;; Profiling
|
||||
;; (use-package esup)
|
||||
|
||||
;; Prevents emacs and packages from messily writing to dirs
|
||||
(use-package no-littering
|
||||
:demand t)
|
||||
|
||||
;; Version control
|
||||
(use-package magit)
|
||||
|
||||
;;;; Nix Related
|
||||
|
||||
;; Nix direnv support
|
||||
(use-package direnv
|
||||
:demand t
|
||||
:config
|
||||
(direnv-mode))
|
||||
|
||||
(use-package nix-mode)
|
||||
|
||||
;;;; End Nix Related
|
||||
|
||||
;;;; Web Related
|
||||
(use-package web-mode
|
||||
:mode
|
||||
(
|
||||
".phtml$"
|
||||
".html?$"
|
||||
".djtml$"
|
||||
".jsx?$"
|
||||
".tsx?$"
|
||||
)
|
||||
)
|
||||
|
||||
(use-package php-mode)
|
||||
;;;; End Web related
|
||||
|
||||
;;;; D2-lang
|
||||
(use-package d2-mode)
|
||||
|
||||
;;;; Yaml
|
||||
(use-package yaml-mode)
|
||||
|
||||
;;;; Company Related
|
||||
(use-package company :demand t
|
||||
:bind
|
||||
(("C-<tab>" . company-complete))
|
||||
:custom-face
|
||||
(company-preview ((t (:background "#000000" :foreground "#ffffff"))))
|
||||
(company-preview-common ((t (:inherit company-preview :foreground "#ff00cf"))))
|
||||
(company-preview-search ((t (:inherit company-preview :background "black"))))
|
||||
(company-scrollbar-bg ((t (:background "grey35"))))
|
||||
(company-scrollbar-fg ((t (:background "#a22390"))))
|
||||
(company-template-field ((t (:background "grey75" :foreground "black"))))
|
||||
(company-tooltip ((t (:background "#353535" :foreground "white"))))
|
||||
(company-tooltip-common ((t (:foreground "magenta"))))
|
||||
(company-tooltip-mouse ((t (:inherit company-tooltip-selection))))
|
||||
(company-tooltip-search ((t (:inherit company-tooltip-selection))))
|
||||
(company-tooltip-search-selection ((t (:inherit company-tooltip-selection))))
|
||||
(company-tooltip-selection ((t (:background "#4584a2" :foreground "white"))))
|
||||
)
|
||||
(add-hook 'after-init-hook 'global-company-mode)
|
||||
|
||||
;; LSP related
|
||||
(use-package lsp-haskell)
|
||||
(use-package lsp-mode
|
||||
:demand t
|
||||
:init
|
||||
(setq lsp-keymap-prefix "C-c l")
|
||||
:hook
|
||||
(
|
||||
(dart-mode . lsp)
|
||||
(python-mode . lsp)
|
||||
(c-mode . lsp)
|
||||
(c++-mode . lsp)
|
||||
(haskell-mode . lsp)
|
||||
(java-mode . lsp)
|
||||
(rust-mode . lsp)
|
||||
;; which key support v v v
|
||||
(lsp-mode . lsp-enable-which-key-integration)
|
||||
)
|
||||
:commands lsp)
|
||||
|
||||
;; optionally
|
||||
(use-package lsp-ui :commands lsp-ui-mode)
|
||||
;; if you are helm user
|
||||
(use-package helm-lsp :commands helm-lsp-workspace-symbol)
|
||||
;; if you are ivy user
|
||||
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
|
||||
(use-package lsp-treemacs :commands lsp-treemacs-errors-list)
|
||||
|
||||
;; optionally if you want to use debugger
|
||||
(use-package dap-mode)
|
||||
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
|
||||
;; optional if you want which-key integration
|
||||
(use-package which-key
|
||||
:config
|
||||
(which-key-mode))
|
||||
;; END LSP related
|
||||
|
||||
;; projectile
|
||||
(use-package projectile
|
||||
:commands projectile-mode)
|
||||
(projectile-mode +1)
|
||||
;; Recommended keymap prefix on macOS
|
||||
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
|
||||
;; projectile
|
||||
|
||||
;; Python
|
||||
(use-package python-mode
|
||||
:straight (python-mode
|
||||
:package "python-mode"
|
||||
:host gitlab
|
||||
:type git
|
||||
:repo "python-mode-devs/python-mode"))
|
||||
|
||||
(setq python-shell-interpreter "ipython"
|
||||
python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True")
|
||||
|
||||
;;; Python Poetry
|
||||
(use-package poetry
|
||||
:ensure t)
|
||||
|
||||
;; Java related
|
||||
(use-package lsp-java
|
||||
:hook (
|
||||
(java-mode . lsp)
|
||||
)
|
||||
)
|
||||
|
||||
;; C related
|
||||
(use-package company-ctags)
|
||||
(use-package company-c-headers)
|
||||
(use-package meson-mode)
|
||||
|
||||
;; Haskell
|
||||
(use-package company-ghci)
|
||||
;;;; End Company Related
|
||||
|
||||
;; Rust related
|
||||
(use-package rust-mode)
|
||||
;; End Rust
|
||||
|
||||
;; Minecraft Functions
|
||||
(use-package mcf-mode
|
||||
:straight (mcf-mode
|
||||
:package "mcf-mode"
|
||||
:host github
|
||||
:type git
|
||||
:repo "rasensuihei/mcf"))
|
||||
|
||||
;; End Minecraft Functions
|
||||
|
||||
;;;; FPGA Related
|
||||
(use-package verilog-mode)
|
||||
(use-package vhdl-mode)
|
||||
|
||||
;;;; Haskell Related
|
||||
(use-package haskell-mode
|
||||
:config
|
||||
(setq haskell-mode-hook '(flyspell-prog-mode interactive-haskell-mode))
|
||||
)
|
||||
(use-package lsp-haskell)
|
||||
|
||||
(use-package ghci-completion)
|
||||
;;;; End Haskell Related
|
||||
|
||||
;;;; NEURON Related
|
||||
;; -- TODO
|
||||
;;;; END NEURON Related
|
||||
|
||||
;;; Lisp / Parentheses Related
|
||||
(use-package rainbow-delimiters
|
||||
:commands rainbow-delimiters-mode
|
||||
:hook (
|
||||
(emacs-lisp-mode . rainbow-delimiters-mode)
|
||||
(geiser-mode . rainbow-delimiters-mode)
|
||||
)
|
||||
:custom-face
|
||||
(rainbow-delimiters-depth-1-face ((t (:foreground "#69f"))) )
|
||||
(rainbow-delimiters-depth-2-face ((t (:foreground "#39b"))) )
|
||||
(rainbow-delimiters-depth-3-face ((t (:foreground "#278"))) )
|
||||
(rainbow-delimiters-depth-4-face ((t (:foreground "#281"))) )
|
||||
(rainbow-delimiters-depth-5-face ((t (:foreground "#047"))) )
|
||||
(rainbow-delimiters-depth-6-face ((t (:foreground "#138"))) )
|
||||
(rainbow-delimiters-depth-7-face ((t (:foreground "#708"))) )
|
||||
(rainbow-delimiters-depth-8-face ((t (:foreground "#920"))) )
|
||||
)
|
||||
(use-package paredit
|
||||
:hook (
|
||||
(emacs-lisp-mode . paredit-mode)
|
||||
(geiser-mode . paredit-mode)
|
||||
)
|
||||
)
|
||||
;;; End Lisp / Parentheses Related
|
||||
|
||||
;;;; Racket Related
|
||||
(use-package geiser-racket)
|
||||
;;;; End Racket Related
|
||||
|
||||
;;;; Org Related
|
||||
|
||||
;; FlySpell
|
||||
(use-package flyspell)
|
||||
(setq flyspell-issue-message-flag nil
|
||||
ispell-local-dictionary "en_GB"
|
||||
ispell-program-name "aspell"
|
||||
ispell-list-command "--list")
|
||||
|
||||
;; Completion engine
|
||||
(use-package ivy-bibtex)
|
||||
;; Interactive menus
|
||||
(use-package helm-bibtex)
|
||||
;; PDF preview etc.
|
||||
(use-package pdf-tools)
|
||||
;; References etc.
|
||||
(use-package org-ref)
|
||||
|
||||
(use-package org
|
||||
:straight (:type built-in)
|
||||
:config
|
||||
(require 'doi-utils)
|
||||
(require 'org-ref)
|
||||
(require 'org-ref-ivy)
|
||||
(require 'org-ref-helm)
|
||||
(require 'org-tempo)
|
||||
|
||||
(setq org-src-fontify-natively t
|
||||
org-confirm-babel-evaluate nil
|
||||
org-src-preserve-indentation t)
|
||||
|
||||
(setq bibtex-completion-bibliography
|
||||
(list (expand-file-name "~/Documents/Bibliography/references.bib")))
|
||||
|
||||
(setq org-ref-bibliography-notes "~/Documents/Bibliography/notes.org"
|
||||
org-ref-default-bibliography '("~/Documents/Bibliography/references.bib")
|
||||
org-ref-pdf-directory "~/Documents/Bibliography/bibtex-pdfs/")
|
||||
|
||||
(setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body
|
||||
org-ref-insert-cite-function 'org-ref-cite-insert-helm
|
||||
org-ref-insert-label-function 'org-ref-insert-label-link
|
||||
org-ref-insert-ref-function 'org-ref-insert-ref-link
|
||||
org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body)))
|
||||
|
||||
(define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link)
|
||||
(define-key org-mode-map (kbd "s-[") 'org-ref-insert-link-hydra/body)
|
||||
|
||||
(tempo-define-template
|
||||
"Lab Template" '("#+TITLE: PHY324: LAB TITLE"n
|
||||
"#+AUTHOR: ***REMOVED*** | ***REMOVED***"n
|
||||
"#+DATE: \\today"n
|
||||
"#+LATEX_HEADER: \\usepackage{natbib}"n
|
||||
"#+LATEX_HEADER: \\usepackage{float}"n
|
||||
"#+LATEX_CLASS: labtemplate"n
|
||||
"#+OPTIONS: toc:nil"n
|
||||
""n
|
||||
"* Abstract:"n
|
||||
"* Introduction:"n > p
|
||||
"* Methods:"n
|
||||
"* Results:"n
|
||||
"* Discussion:"n
|
||||
"bibliographystyle:ieeetr"n
|
||||
"bibliography:~/Documents/Bibliography/references.bib" >)
|
||||
"<LAB" "Insert Lab Template With Headings")
|
||||
(tempo-define-template "Fig. Caption"
|
||||
'("" (P "Image: " image t)
|
||||
(P "Caption: " caption t)
|
||||
(P "Figure Name: " name t)
|
||||
"#+CAPTION: " (s caption) > n >
|
||||
"#+NAME: fig:" (s name) > n >
|
||||
"#+ATTR_LaTeX: :placement [H]" > n >
|
||||
"[[" (s image) "]]" > n > p >)
|
||||
"<fig" "Inserts Figure with Caption")
|
||||
(with-eval-after-load 'ox-latex
|
||||
(add-to-list 'org-latex-packages-alist '("" "minted"))
|
||||
(setq org-latex-listings 'minted)
|
||||
|
||||
(add-to-list 'org-latex-classes
|
||||
'("labtemplate" "\\documentclass{labtemplate}"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
|
||||
)
|
||||
|
||||
(setq org-latex-pdf-process
|
||||
'("%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"bibtex %b"
|
||||
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f")))
|
||||
)
|
||||
(use-package ox-pandoc
|
||||
:after org)
|
||||
;; better TEX
|
||||
(use-package auctex
|
||||
:after org)
|
||||
|
||||
;; Plotting support
|
||||
(use-package gnuplot)
|
||||
|
||||
;;Org Auto Wrap Config
|
||||
(add-hook 'org-mode-hook 'auto-fill-mode)
|
||||
(set-fill-column 100)
|
||||
;;;; End Org Related
|
||||
|
||||
;; ghci-completion company-ghci
|
||||
;; exec-path-from-shell nix-haskell-mode haskell-mode
|
||||
;; pyvenv rainbow-mode company-ctags company-jedi
|
||||
;; company-anaconda anaconda-mode matlab-mode markdown-mode company-irony-c-headers company-irony irony rust-mode company-c-headers cdlatex auctex use-package smog conda gnuplot php-mode web-mode org-ref pdf-tools chess
|
||||
|
||||
;;; Flutter Related
|
||||
(use-package dart-mode)
|
||||
(use-package lsp-dart)
|
||||
;;; End Flutter Related
|
||||
|
||||
;;; BQN
|
||||
(use-package bqn-mode
|
||||
:straight (bqn-mode
|
||||
:package "bqn-mode"
|
||||
:host github
|
||||
:type git
|
||||
:repo "museoa/bqn-mode"
|
||||
)
|
||||
:config
|
||||
(set-face-attribute 'bqn-list-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-separator-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-arrow-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-function-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-one-modifier-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-two-modifier-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-subject-face nil :family 'unspecified)
|
||||
(set-face-attribute 'bqn-nothing-face nil :family 'unspecified)
|
||||
)
|
||||
|
||||
;;; END-BQN
|
||||
|
||||
;;;; END PACKAGES
|
||||
;;; init.el ends here
|
||||
|
||||
Reference in New Issue
Block a user