From 9c16af9e7c744ad2747dcde0432f4d3a7045f0fe Mon Sep 17 00:00:00 2001 From: Samuel Ortion Date: Tue, 12 Dec 2023 16:46:10 +0100 Subject: [PATCH] feat: Add snippets and improve config --- config.org | 58 ++++++++++++++++++++++++++++++++------ init.el | 48 +++++++++++++++---------------- packages.el | 35 +++++++++++++---------- snippets/latex-mode/align* | 7 +++++ snippets/latex-mode/frame | 7 +++++ snippets/latex-mode/taocp | 10 +++++++ 6 files changed, 118 insertions(+), 47 deletions(-) create mode 100644 snippets/latex-mode/align* create mode 100644 snippets/latex-mode/frame create mode 100644 snippets/latex-mode/taocp diff --git a/config.org b/config.org index 6a38ec7..e03b021 100644 --- a/config.org +++ b/config.org @@ -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 diff --git a/init.el b/init.el index ce972f0..4513388 100644 --- a/init.el +++ b/init.el @@ -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. diff --git a/packages.el b/packages.el index 22de399..c82b01d 100644 --- a/packages.el +++ b/packages.el @@ -7,47 +7,49 @@ ;; 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 ;; `:recipe'. You'll find documentation on what `:recipe' accepts here: ;; https://github.com/radian-software/straight.el#the-recipe-format -;(package! another-package -; :recipe (:host github :repo "username/repo")) + ;(package! another-package + ; :recipe (:host github :repo "username/repo")) ;; 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 ;; `:files' in the `:recipe': -;(package! this-package -; :recipe (:host github :repo "username/repo" -; :files ("some-file.el" "src/lisp/*.el"))) + ;(package! this-package + ; :recipe (:host github :repo "username/repo" + ; :files ("some-file.el" "src/lisp/*.el"))) ;; If you'd like to disable a package included with Doom, you can do so here ;; 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 ;; all the properties for `:recipe'. These will inherit the rest of its recipe ;; from Doom or MELPA/ELPA/Emacsmirror: -;(package! builtin-package :recipe (:nonrecursive t)) -;(package! builtin-package-2 :recipe (:repo "myfork/package")) + ;(package! builtin-package :recipe (:nonrecursive t)) + ;(package! builtin-package-2 :recipe (:repo "myfork/package")) ;; 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 ;; 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. -;(package! builtin-package :pin "1a2b3c4d5e") + ;(package! builtin-package :pin "1a2b3c4d5e") ;; Doom's packages are pinned to a specific commit and updated from release to ;; release. The `unpin!' macro allows you to unpin single packages... -;(unpin! pinned-package) + ;(unpin! pinned-package) ;; ...or multiple packages -;(unpin! pinned-package another-pinned-package) + ;(unpin! pinned-package another-pinned-package) ;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) -;(unpin! t) + ;(unpin! t) + +(package! conda) (package! quarto-mode) @@ -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")) diff --git a/snippets/latex-mode/align* b/snippets/latex-mode/align* new file mode 100644 index 0000000..207c8ba --- /dev/null +++ b/snippets/latex-mode/align* @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: align +# key: align +# -- +\begin{align*} + $1 +\end{align*} \ No newline at end of file diff --git a/snippets/latex-mode/frame b/snippets/latex-mode/frame new file mode 100644 index 0000000..d53b786 --- /dev/null +++ b/snippets/latex-mode/frame @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: frame +# key: frame +# -- +\begin{frame}{$1} + +\end{frame} \ No newline at end of file diff --git a/snippets/latex-mode/taocp b/snippets/latex-mode/taocp new file mode 100644 index 0000000..1e35c2a --- /dev/null +++ b/snippets/latex-mode/taocp @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: myexercise +# key: myexercise +# -- +\begin{myexercise}{$1}{$2} + $4 + \begin{myanswer} + $5 + \end{myanswer} +\end{myexercise} \ No newline at end of file