feat: Add snippets and improve config

This commit is contained in:
Samuel Ortion 2023-12-12 16:46:10 +01:00
parent db597bbf94
commit 9c16af9e7c
6 changed files with 118 additions and 47 deletions

View File

@ -5,11 +5,11 @@
* Doom theme * Doom theme
** Use nerd-font in Emacs (for better support in vterm to liquidprompt) ** Use nerd-font in Emacs (for better support in vterm to liquidprompt)
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle yes
(setq doom-font (font-spec :family "Blex Mono Nerd Font" :size 12) (setq doom-font (font-spec :family "Fira Code Nerd Font" :size 12)
doom-big-font (font-spec :family "Blex Mono Nerd Font" :size 24) doom-big-font (font-spec :family "Fira Code Nerd Font" :size 24)
doom-variable-pitch-font (font-spec :family "Blex Mono Nerd Font" :size 12) doom-variable-pitch-font (font-spec :family "Fira Code Nerd Font" :size 12)
doom-unicode-font (font-spec :family "Blex Mono Nerd Font") doom-unicode-font (font-spec :family "Fira Code Nerd Font")
doom-serif-font (font-spec :family "Blex Mono Nerd Font" :size 12 :weight 'light)) doom-serif-font (font-spec :family "Fira Code Nerd Font" :size 12 :weight 'light))
#+end_src #+end_src
* UI * UI
@ -32,16 +32,29 @@ I want my back quotes back.
(setq cdlatex-math-symbol-prefix [f12]) (setq cdlatex-math-symbol-prefix [f12])
#+end_src #+end_src
Add srcartcl to ox-latex class Add custom LaTeX classes to ox-latex class.
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle yes
(eval-after-load "ox-latex" (defun custom-latex-classes ()
'(add-to-list 'org-latex-classes (add-to-list 'org-latex-classes
'("scrartcl" "\\documentclass{scrartcl}" '("scrartcl" "\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(add-to-list 'org-latex-classes
'("scrbook" "\\documentclass{scrbook}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))) ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
(eval-after-load "ox-latex"
#'custom-latex-classes)
#+end_src #+end_src
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle yes
@ -61,6 +74,19 @@ Disable LateX preview in Org-mode by default
(setq org-startup-with-latex-preview nil) (setq org-startup-with-latex-preview nil)
#+end_src #+end_src
*** Add a hook so that the org file is tangled before the build
#+begin_src emacs-lisp :tangle yes
(add-hook 'org-export-before-processing-hook #'org-babel-tangle)
#+end_src
*** Syntax highlighting in Org-mode
#+begin_src emacs-lisp :tangle yes
(setq org-highlight-latex-and-related '(latex script entities))
#+end_src
\(i \in \mathbf{N}\)
** Expand initial Frame ** Expand initial Frame
#+begin_src emacs-lisp :tangle yes #+begin_src emacs-lisp :tangle yes
@ -73,6 +99,11 @@ Disable LateX preview in Org-mode by default
(require 'conda) (require 'conda)
(conda-env-initialize-interactive-shells) (conda-env-initialize-interactive-shells)
#+end_src #+end_src
** Org-roam
Set the roam directory
#+begin_src emacs-lisp
(setq org-roam-directory "~/sync/Documents/org/roam/")
#+end_src
* Emacs Server & Emacs Client * Emacs Server & Emacs Client
@ -104,3 +135,14 @@ systemctl --user enable --now emacs
#+RESULTS: #+RESULTS:
* Escape from vim in libvterm while in evil-mode
#+begin_src emacs-lisp :tangle no
(defun vim-save ()
":wd this unfortunate vim window in my terminal"
(interactive)
(send-))
#+end_src
#+RESULTS:
: vim-save

48
init.el
View File

@ -32,11 +32,11 @@
doom ; what makes DOOM look the way it does doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs doom-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂 (emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra ;;hydra
;;indent-guides ; highlighted indent columns indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side ;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions ;;nav-flash ; blink cursor line after big motions
@ -56,7 +56,7 @@
(evil +everywhere); come to the dark side, we have cookies (evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness (format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys ;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim ;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once ;;multiple-cursors ; editing in many places at once
@ -64,12 +64,12 @@
;;parinfer ; turn lisp into python, sort of ;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates ;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to snippets ; my elves. They type so I don't have to
;;word-wrap ; soft wrapping with language-aware indent word-wrap ; soft wrapping with language-aware indent
:emacs :emacs
dired ; making dired pretty [functional] dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree vc ; version-control and Emacs, sitting in a tree
@ -81,18 +81,18 @@
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling (spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make grammar ; tasing grammar mistake every you make
:tools :tools
;;ansible ;;ansible
;;biblio ; Writes a PhD for you (citation needed) biblio ; Writes a PhD for you (citation needed)
;;collab ; buffers with friends ;;collab ; buffers with friends
;;debugger ; FIXME stepping through code, to help you add bugs ;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv ;;direnv
;;docker ;;docker
;;editorconfig ; let someone else argue about tabs vs spaces editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists ;;gist ; interacting with github gists
lookup ; navigate your code and its documentation lookup ; navigate your code and its documentation
@ -100,18 +100,18 @@
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs ;;make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
;;pdf ; pdf enhancements pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders ;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects ;;taskrunner ; taskrunner for all your projects
;;terraform ; infrastructure as code ;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux ;;tmux ; an API for interacting with tmux
;;tree-sitter ; syntax and parsing, sitting in a tree... tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp ;;upload ; map local to remote projects via ssh/ftp
:os :os
;;(:if IS-MAC macos) ; improve compatibility with macOS ;;(:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience tty ; improve the terminal Emacs experience
:lang :lang
;;agda ; types of types of types of types... ;;agda ; types of types of types of types...
@ -138,36 +138,36 @@
;;gdscript ; the language you waited for ;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect ;;(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST ;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am (haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python ;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on ;;idris ; a language you can depend on
json ; At least it ain't XML json ; At least it ain't XML
(java +lsp) ; the poster child for carpal tunnel syndrome (java +lsp) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here)))))) javascript ; all(hope(abandon(ye(who(enter(here))))))
julia ; a better, faster MATLAB julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script) kotlin ; a better, slicker Java(Script)
latex ; writing papers in Emacs has never been so fun latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove lean ; for folks with too much to prove
;;ledger ; be audit you can be ;;ledger ; be audit you can be
lua ; one-based indices? one-based indices lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c ;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!" ;;nix ; I hereby declare "nix geht mehr!"
ocaml ; an objective camel (ocaml +lsp) ; an objective camel
org ; organize your plain life in plain text (org +roam2 +hugo +pandoc +brain) ; organize your plain life in plain text
;;php ; perl's insecure younger brother php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more ;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional ;;purescript ; javascript, but functional
python ; beautiful is better than ugly python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever ;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs racket ; a DSL for DSLs
raku ; the artist formerly known as perl6 raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client ;;rest ; Emacs as a REST client
;;rst ; ReST in peace rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
scala ; java, but good scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps (scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml ;;sml
;;solidity ; do you need a blockchain? No. ;;solidity ; do you need a blockchain? No.

View File

@ -7,47 +7,49 @@
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: ;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;(package! some-package) ;(package! some-package)
;; To install a package directly from a remote git repo, you must specify a ;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here: ;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/radian-software/straight.el#the-recipe-format ;; https://github.com/radian-software/straight.el#the-recipe-format
;(package! another-package ;(package! another-package
; :recipe (:host github :repo "username/repo")) ; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el ;; 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 ;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe': ;; `:files' in the `:recipe':
;(package! this-package ;(package! this-package
; :recipe (:host github :repo "username/repo" ; :recipe (:host github :repo "username/repo"
; :files ("some-file.el" "src/lisp/*.el"))) ; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here ;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property: ;; with the `:disable' property:
;(package! builtin-package :disable t) ;(package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify ;; 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 ;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror: ;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t)) ;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package")) ;(package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag. ;; 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 ;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see radian-software/straight.el#279) ;; our package manager can't deal with; see radian-software/straight.el#279)
;(package! builtin-package :recipe (:branch "develop")) ;(package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install. ;; Use `:pin' to specify a particular commit to install.
;(package! builtin-package :pin "1a2b3c4d5e") ;(package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to ;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages... ;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package) ;(unpin! pinned-package)
;; ...or multiple packages ;; ...or multiple packages
;(unpin! pinned-package another-pinned-package) ;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t) ;(unpin! t)
(package! conda)
(package! quarto-mode) (package! quarto-mode)
@ -57,6 +59,9 @@
(package! pasp-mode) (package! pasp-mode)
(package! ob-pasp (package! ob-pasp
:recipe (:host github :repo "UncleSamulus/ob-pasp")) :recipe (:local-repo "~/Documents/Projects/ob-pasp"))
(package! ox-hugo) (package! ox-hugo)
(package! groovy-mode)
(package! nextflow-mode :recipe (:host github :repo "emiller88/nextflow-mode"))

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: align
# key: align
# --
\begin{align*}
$1
\end{align*}

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: frame
# key: frame
# --
\begin{frame}{$1}
\end{frame}

10
snippets/latex-mode/taocp Normal file
View File

@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: myexercise
# key: myexercise
# --
\begin{myexercise}{$1}{$2}
$4
\begin{myanswer}
$5
\end{myanswer}
\end{myexercise}