From 9a7b7f7e33fd1f2f0d1254df894b03f3e3cf621b Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sat, 27 Jan 2024 00:24:25 -0500 Subject: [PATCH] Added a few orgmode yas-snippets --- .gitignore | 1 - emacs/config.org | 38 ++++++++++++++++++++++++++++++++++ emacs/makefile | 11 ---------- emacs/snippets/org-mode/gh | 6 ++++++ emacs/snippets/org-mode/lk | 6 ++++++ emacs/snippets/org-mode/ticket | 6 ++++++ 6 files changed, 56 insertions(+), 12 deletions(-) create mode 100644 emacs/snippets/org-mode/gh create mode 100644 emacs/snippets/org-mode/lk create mode 100644 emacs/snippets/org-mode/ticket diff --git a/.gitignore b/.gitignore index de670e6..a1117c4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ ################################################################################ # Configs -emacs/snippets i3/config vim/backup/* vim/autoload/* diff --git a/emacs/config.org b/emacs/config.org index baec891..286a8a1 100644 --- a/emacs/config.org +++ b/emacs/config.org @@ -901,6 +901,44 @@ machine api.openai.com login apikey password TOKEN ) ) #+end_src +** Snippets +We've enabled the [[doom-module:editor snippets][snippets module]] [[*Editor][earlier]]. This will give us use of the [[https://github.com/doomemacs/snippets][Doom Snippets package]], but we'll want to add our own as well. Custom snippets are added under =$DOOMDIR/snippets/= directory. Documentation on how to write snippets can be found at [[http://joaotavora.github.io/yasnippet/snippet-development.html][yas-snippet/documentation]] and [[https://github.com/doomemacs/snippets][doom-snippets github page]]. + +While we'll want to store these snippets in this orgmode document, using the =+snippets/create= & =snippets/edit= may be useful for creating these. + +*** Orgmode +In my work todo and my roam notes I've been using a list elements with nerd-fonts icons under my section header to provide quick links for the context. Below are a few that I've been using. + +-  [[github:github/example][github/example]] +#+begin_src snippet :tangle "snippets/org-mode/gh" +# -*- mode: snippet -*- +# name: Github Element +# uuid: gh +# key: gh +# -- +-  ${1:repo} +#+end_src + +-  [[example.com][example.com]] +#+begin_src snippet :tangle "snippets/org-mode/lk" +# -*- mode: snippet -*- +# name: Link Elment +# uuid: lk +# key: lk +# -- +-  ${1:link} +#+end_src + +-  [[https://example.com][Jira-12929]] +#+begin_src snippet :tangle "snippets/org-mode/ticket" +# -*- mode: snippet -*- +# name: Ticker Elment +# uuid: ticket +# key: ticket +# -- +-  ${1:link} +#+end_src + * Content Stolen From A large amount of the details listed here have been lifted from: - [[https://tecosaur.github.io/emacs-config/][tecosaur's literate configuration]]. diff --git a/emacs/makefile b/emacs/makefile index b8bdc2f..6b8e649 100644 --- a/emacs/makefile +++ b/emacs/makefile @@ -5,8 +5,6 @@ EMACSD := ~/.emacs.d # Doom Config DOOMD := ~/.doom.d DOOM_URL := https://github.com/doomemacs/doomemacs -YASD := ~/.doom.d/snippets -YAS_URL := https://github.com/doomemacs/snippets include ../lib/shared.mk @@ -35,7 +33,6 @@ setup: $(report) header "emacs init" $(mk_link) $(SRC_DIR) $(DOOMD) $(MAKE) -C $(SRC_DIR) doom_init - $(MAKE) -C $(SRC_DIR) yas_init fi doom_init: @@ -48,11 +45,3 @@ doom_init: else $(report) debug "emacsd already exists. Skipping" fi - - -yas_init: - if [ ! -e $(YASD) ] ; then - git clone $(YAS_URL) $(YASD) ; $(report) "YAS setup" - else - $(report) debug "YASD already exists. Skipping" - fi diff --git a/emacs/snippets/org-mode/gh b/emacs/snippets/org-mode/gh new file mode 100644 index 0000000..ec1d5e7 --- /dev/null +++ b/emacs/snippets/org-mode/gh @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: Github Element +# uuid: gh +# key: gh +# -- +-  ${1:repo} diff --git a/emacs/snippets/org-mode/lk b/emacs/snippets/org-mode/lk new file mode 100644 index 0000000..6afb083 --- /dev/null +++ b/emacs/snippets/org-mode/lk @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: Link Elment +# uuid: lk +# key: lk +# -- +-  ${1:link} diff --git a/emacs/snippets/org-mode/ticket b/emacs/snippets/org-mode/ticket new file mode 100644 index 0000000..dc96d77 --- /dev/null +++ b/emacs/snippets/org-mode/ticket @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: Ticker Elment +# uuid: ticket +# key: ticket +# -- +-  ${1:link}