summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/plugins/snippets/init.fnl6
-rw-r--r--fnl/plugins/snippets/org.fnl34
-rw-r--r--fnl/plugins/snippets/workflow.fnl42
3 files changed, 47 insertions, 35 deletions
diff --git a/fnl/plugins/snippets/init.fnl b/fnl/plugins/snippets/init.fnl
index b586d76..016b3b6 100644
--- a/fnl/plugins/snippets/init.fnl
+++ b/fnl/plugins/snippets/init.fnl
@@ -3,8 +3,10 @@
(local dependencies [:rafamadriz/friendly-snippets])
(fn add-snippets []
- (let [org (require :plugins.snippets.org)]
- (org.add-snippets)))
+ (let [org (require :plugins.snippets.org)
+ workflow (require :plugins.snippets.workflow)]
+ (org.add-snippets)
+ (workflow.add-snippets)))
(fn config []
(let [ls (require :luasnip)
diff --git a/fnl/plugins/snippets/org.fnl b/fnl/plugins/snippets/org.fnl
index 0887821..a2b2e46 100644
--- a/fnl/plugins/snippets/org.fnl
+++ b/fnl/plugins/snippets/org.fnl
@@ -8,38 +8,6 @@
fmt fmt.fmt]
(ls.add_snippets :org
[(s :be
- (fmt "#+begin_src {}\n{}\n#+end_src" [(i 1) (i 2)]))
- (s :wf
- (fmt "workflow \"{}\" =
- input: {}
- output (on success):
- {}
- output (on error):
- {}
-
- // step {}
- do {}
- {}
- "
- [(i 1) (i 2) (i 3) (i 4) (i 5) (i 6) (i 7)]))
- (s :st
- (fmt "
- // step {}
- do {}
- If {}:
- {}
-
- "
- [(i 1) (i 2) (i 3) (i 4)]))
- (s :ss
- (fmt "
-substep \"{}\" =
- input: {}
- output: {}
- dependencies: {}
-
- {}
- "
- [(i 1) (i 2) (i 3) (i 4) (i 5)]))]))))
+ (fmt "#+begin_src {}\n{}\n#+end_src" [(i 1) (i 2)]))]))))
{: add-snippets}
diff --git a/fnl/plugins/snippets/workflow.fnl b/fnl/plugins/snippets/workflow.fnl
new file mode 100644
index 0000000..b7f0807
--- /dev/null
+++ b/fnl/plugins/snippets/workflow.fnl
@@ -0,0 +1,42 @@
+(fn workflow-snippets []
+ (let [ls (require :luasnip)
+ fmt (require :luasnip.extras.fmt)]
+ (let [s ls.s
+ i ls.insert_node
+ fmt fmt.fmt]
+ [(s :wf (fmt "workflow \"{}\" =
+ input: {}
+ output (on success):
+ {}
+ output (on error):
+ {}
+
+ // step {}
+ do {}
+ {}
+ " [(i 1) (i 2) (i 3) (i 4) (i 5) (i 6) (i 7)]))
+ (s :st (fmt "
+ // step {}
+ do {}
+ If {}:
+ {}
+
+ "
+ [(i 1) (i 2) (i 3) (i 4)]))
+ (s :ss (fmt "
+substep \"{}\" =
+ input: {}
+ output: {}
+ dependencies: {}
+
+ {}
+ "
+ [(i 1) (i 2) (i 3) (i 4) (i 5)]))])))
+
+(fn add-snippets []
+ (let [ls (require :luasnip)
+ snippets (workflow-snippets)]
+ (ls.add_snippets :org snippets)
+ (ls.add_snippets :markdown snippets)))
+
+{: add-snippets}