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
** Use nerd-font in Emacs (for better support in vterm to liquidprompt)
#+begin_src emacs-lisp :tangle yes
(setq doom-font (font-spec :family "Blex Mono Nerd Font" :size 12)
doom-big-font (font-spec :family "Blex Mono Nerd Font" :size 24)
doom-variable-pitch-font (font-spec :family "Blex Mono Nerd Font" :size 12)
doom-unicode-font (font-spec :family "Blex Mono Nerd Font")
doom-serif-font (font-spec :family "Blex Mono Nerd Font" :size 12 :weight 'light))
(setq doom-font (font-spec :family "Fira Code Nerd Font" :size 12)
doom-big-font (font-spec :family "Fira Code Nerd Font" :size 24)
doom-variable-pitch-font (font-spec :family "Fira Code Nerd Font" :size 12)
doom-unicode-font (font-spec :family "Fira Code Nerd Font")
doom-serif-font (font-spec :family "Fira Code Nerd Font" :size 12 :weight 'light))
#+end_src
* UI
@ -32,16 +32,29 @@ I want my back quotes back.
(setq cdlatex-math-symbol-prefix [f12])
#+end_src
Add srcartcl to ox-latex class
Add custom LaTeX classes to ox-latex class.
#+begin_src emacs-lisp :tangle yes
(eval-after-load "ox-latex"
'(add-to-list 'org-latex-classes
(defun custom-latex-classes ()
(add-to-list 'org-latex-classes
'("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}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
(eval-after-load "ox-latex"
#'custom-latex-classes)
#+end_src
#+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)
#+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
#+begin_src emacs-lisp :tangle yes
@ -73,6 +99,11 @@ Disable LateX preview in Org-mode by default
(require 'conda)
(conda-env-initialize-interactive-shells)
#+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
@ -104,3 +135,14 @@ systemctl --user enable --now emacs
#+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-dashboard ; a nifty splash screen for Emacs
doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;hydra
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
indent-guides ; highlighted indent columns
ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
@ -56,7 +56,7 @@
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
@ -64,12 +64,12 @@
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
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
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;ibuffer ; interactive buffer management
ibuffer ; interactive buffer management
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
@ -81,18 +81,18 @@
:checkers
syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
(spell +flyspell) ; tasing you for misspelling mispelling
grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
biblio ; Writes a PhD for you (citation needed)
;;collab ; buffers with friends
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
;;docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
editorconfig ; let someone else argue about tabs vs spaces
ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
;;gist ; interacting with github gists
lookup ; navigate your code and its documentation
@ -100,18 +100,18 @@
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings
rgb ; creating color strings
;;taskrunner ; taskrunner for all your projects
;;terraform ; infrastructure as code
;;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
:os
;;(:if IS-MAC macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
tty ; improve the terminal Emacs experience
:lang
;;agda ; types of types of types of types...
@ -138,36 +138,36 @@
;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect
;;(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
;;idris ; a language you can depend on
json ; At least it ain't XML
(java +lsp) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here))))))
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
;;lean ; for folks with too much to prove
lean ; for folks with too much to prove
;;ledger ; be audit you can be
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
ocaml ; an objective camel
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
(ocaml +lsp) ; an objective camel
(org +roam2 +hugo +pandoc +brain) ; organize your plain life in plain text
php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
racket ; a DSL for DSLs
raku ; the artist formerly known as perl6
;;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'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
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
;;sml
;;solidity ; do you need a blockchain? No.

View File

@ -49,6 +49,8 @@
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)
(package! conda)
(package! quarto-mode)
(package! org-elp)
@ -57,6 +59,9 @@
(package! pasp-mode)
(package! ob-pasp
:recipe (:host github :repo "UncleSamulus/ob-pasp"))
:recipe (:local-repo "~/Documents/Projects/ob-pasp"))
(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}