Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add & to snippets that require their own line #44

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/emacs-lisp.eld
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
emacs-lisp-mode

(autoload ";;;###autoload")
(autoload & ";;;###autoload")
(pt "(point)")
(var "(defvar " p "\n \"" p "\")")
(local "(defvar-local " p "\n \"" p "\")")
Expand Down
16 changes: 8 additions & 8 deletions templates/markdown.eld
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
markdown-mode

(gitcollapse "## " (p "Heading") n n "<details>" n n
(gitcollapse & "## " (p "Heading") n n "<details>" n n
"<summary>" (p "Sub Heading") "</summary>" n n
(r "Insert Link or comments") n n "</details>")
(bolditalics "***" p "***")
(srcblock (call-interactively #'markdown-insert-gfm-code-block))
(src "'" p "'")
(unorderlist "- " (p "First") n> "- " (p "Second") n> "- " (p "Third"))
(orderlist "1. " (p "First") n> "2. " (p "Second") n> "3. " (p "Third"))
(unorderlist & "- " (p "First") n> "- " (p "Second") n> "- " (p "Third"))
(orderlist & "1. " (p "First") n> "2. " (p "Second") n> "3. " (p "Third"))
(insertimage (call-interactively #'markdown-insert-image))
(insertlink (call-interactively #'markdown-insert-link))
(hugotitle "+++" n "title = " (p "title") n "date = " (format-time-string "%Y-%m-%d") n "tags = [ " (p "tag1, tag2 ") "]" n "draft = false" n "+++")
(h1 "# " p " #")
(h2 "## " p " ##")
(h3 "### " p " ###")
(h4 "#### " p " ####")
(hugotitle & "+++" n "title = " (p "title") n "date = " (format-time-string "%Y-%m-%d") n "tags = [ " (p "tag1, tag2 ") "]" n "draft = false" n "+++")
(h1 & "# " p " #")
(h2 & "## " p " ##")
(h3 & "### " p " ###")
(h4 & "#### " p " ####")
(inserttable (call-interactively #'markdown-insert-table))
54 changes: 28 additions & 26 deletions templates/org.eld
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
org-mode

(ttl "#+title: " p n "#+author: " p n "#+language: " p n n)
(qt "#+begin_quote" n> r> n> "#+end_quote")
(exmpl "#+begin_example" n> r> n> "#+end_example")
(cntr "#+begin_center" n> r> n> "#+end_center")
(comm "#+begin_comment" n> r> n> "#+end_comment")
(vrs "#+begin_verse" n> r> n> "#+end_verse")
(src "#+begin_src " p n r n "#+end_src" :post (org-edit-src-code))
(rst "#+begin_src restclient" p n> r> n> "#+end_src" :post (org-edit-src-code))
(elsp "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))

(ttl & "#+title: " p n "#+author: " p n "#+language: " p n n)
(qt & "#+begin_quote" n> r> n> "#+end_quote")
(exmpl & "#+begin_example" n> r> n> "#+end_example")
(cntr & "#+begin_center" n> r> n> "#+end_center")
(comm & "#+begin_comment" n> r> n> "#+end_comment")
(vrs & "#+begin_verse" n> r> n> "#+end_verse")
(src & "#+begin_src " p n r n "#+end_src" :post (org-edit-src-code))
(rst & "#+begin_src restclient" p n r n "#+end_src" :post (org-edit-src-code))
(elsp & "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))
(readonly ":tangle yes :tangle-mode (identity #o444) :mkdirp yes" n)
(oxhugo ":PROPERTIES:" n ":EXPORT_FILE_NAME: " (p "Simple Filename") n ":EXPORT_DATE: " (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:")
(oxhugo & ":PROPERTIES:" n ":EXPORT_FILE_NAME: " (p "Simple Filename") n ":EXPORT_DATE: " (format-time-string "%Y-%m-%d") n ":EXPORT_HUGO_DRAFT: false" n ":END:")
(readmecollapse "*** " (p "Heading") n "#+HTML: <details> <summary> " (p "sub-heading") " </summary>" n (r> "link or any comments") n n "#+HTML: </details>" n)

;; taken from https://github.com/minad/tempel/blob/5b09f612cfd805dba5e90bf06580583cab045499/README.org#template-file-format
(caption "#+caption: ")
(drawer ":" p ":" n r ":end:")
(begin "#+begin_" (s name) n> r> n "#+end_" name)
(quote "#+begin_quote" n> r> n "#+end_quote")
(sidenote "#+begin_sidenote" n> r> n "#+end_sidenote")
(marginnote "#+begin_marginnote" n> r> n "#+end_marginnote")
(example "#+begin_example" n> r> n "#+end_example")
(center "#+begin_center" n> r> n "#+end_center")
(ascii "#+begin_export ascii" n> r> n "#+end_export")
(html "#+begin_export html" n> r> n "#+end_export")
(latex "#+begin_export latex" n> r> n "#+end_export")
(comment "#+begin_comment" n> r> n "#+end_comment")
(verse "#+begin_verse" n> r> n "#+end_verse")
(gnuplot "#+begin_src gnuplot :var data=" (p "table") " :file " (p "plot.png") n> r> n "#+end_src" :post (org-edit-src-code))
(elisp "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))
(caption & "#+caption: ")
(drawer & ":" p ":" n r ":end:")
(begin & "#+begin_" (s name) n r n "#+end_" name)
(quote & "#+begin_quote" n> r> n "#+end_quote")
(sidenote & "#+begin_sidenote" n> r> n "#+end_sidenote")
(marginnote & "#+begin_marginnote" n> r> n "#+end_marginnote")
(example & "#+begin_example" n> r> n "#+end_example")
(center & "#+begin_center" n> r> n "#+end_center")
(ascii & "#+begin_export ascii" n> r> n "#+end_export")
(html & "#+begin_export html" n> r> n "#+end_export")
(latex & "#+begin_export latex" n> r> n "#+end_export")
(comment & "#+begin_comment" n> r> n "#+end_comment")
(verse & "#+begin_verse" n> r> n "#+end_verse")
(gnuplot & "#+begin_src gnuplot :var data=" (p "table") " :file " (p "plot.png") n r n "#+end_src" :post (org-edit-src-code))
(elisp & "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))
(inlsrc "src_" p "{" q "}")
(title "#+title: " p n "#+author: " p n "#+language: " p n n)
(title & "#+title: " p n "#+author: " p n "#+language: " p n n)

2 changes: 1 addition & 1 deletion templates/python-base.eld
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
python-base-mode

(for "for " p " in " p ":" n> q)
(tr "import " p "; " p ".set_trace()" q)
(tr & "import " p "; " p ".set_trace()" q)
(ig "# type: ignore" q)

2 changes: 1 addition & 1 deletion templates/rust.eld
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rust-mode rust-ts-mode

(crt "extern crate " q ";")

(drv "#[derive(" p ")]" q)
(drv & "#[derive(" p ")]" q)

(d "dbg!(" p ")" q)

Expand Down
2 changes: 1 addition & 1 deletion templates/sh-base.eld
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sh-base-mode

(! "#!/usr/bin/env bash" n q)
(! & "#!/usr/bin/env bash" n q)

(if "if [ " p " ]" n " then " p n "fi" q)

Expand Down
Loading