diff --git a/snippets/julia-mode/.yas-setup.el b/snippets/julia-mode/.yas-setup.el new file mode 100644 index 0000000..630d1db --- /dev/null +++ b/snippets/julia-mode/.yas-setup.el @@ -0,0 +1,5 @@ +(require 'yasnippet) + +(defun yas-julia-iteration-keyword-choice () + "Choose the iteration keyword for for-loop" + (yas-choose-value '("=" "in" "∈"))) diff --git a/snippets/julia-mode/atype b/snippets/julia-mode/atype new file mode 100644 index 0000000..9721a04 --- /dev/null +++ b/snippets/julia-mode/atype @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: abstract type ... end +# key: atype +# contributor: hankail05 +# -- +abstract type ${1:${2:type} <: ${3:supertype}} end$0 \ No newline at end of file diff --git a/snippets/julia-mode/begin b/snippets/julia-mode/begin new file mode 100644 index 0000000..78f851e --- /dev/null +++ b/snippets/julia-mode/begin @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: begin ... end +# key: begin +# contributor: hankail05 +# -- +begin + ${1:body} +end +$0 diff --git a/snippets/julia-mode/do b/snippets/julia-mode/do index 40e51f1..7630ffc 100644 --- a/snippets/julia-mode/do +++ b/snippets/julia-mode/do @@ -1,8 +1,9 @@ # -*- mode: snippet -*- # name: do ... ... end # key: do -# contributor : hankail05 +# contributor: hankail05 # -- do ${1:x} - $0 -end \ No newline at end of file + ${2:body} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/for b/snippets/julia-mode/for index 46011d8..8f9619f 100644 --- a/snippets/julia-mode/for +++ b/snippets/julia-mode/for @@ -1,8 +1,9 @@ # -*- mode: snippet -*- -# name: for ... in ... ... end +# name: for ... ... end # key: for -# contributor : hankail05 +# contributor: hankail05 # -- -for ${1:i} in ${2:1:n} - $0 +for ${1:i} ${2:$$(yas-julia-iteration-keyword-choice)} ${3:1:n} + ${4:body} end +$0 diff --git a/snippets/julia-mode/function b/snippets/julia-mode/fun similarity index 68% rename from snippets/julia-mode/function rename to snippets/julia-mode/fun index d938948..2abeccf 100644 --- a/snippets/julia-mode/function +++ b/snippets/julia-mode/fun @@ -1,8 +1,9 @@ # -*- mode: snippet -*- # name: function(...) ... end # key: fun -# contributor : hankail05 +# contributor: hankail05 # -- function ${1:fun}(${2:args}) - $0 -end \ No newline at end of file + ${3:body} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/if b/snippets/julia-mode/if index f28873a..adc4ad0 100644 --- a/snippets/julia-mode/if +++ b/snippets/julia-mode/if @@ -1,8 +1,9 @@ # -*- mode: snippet -*- # name: if ... ... end # key: if -# contributor : hankail05 +# contributor: hankail05 # -- if ${1:cond} - $0 + ${2:body} end +$0 diff --git a/snippets/julia-mode/ife b/snippets/julia-mode/ife index 8d3cb7f..f2578d4 100644 --- a/snippets/julia-mode/ife +++ b/snippets/julia-mode/ife @@ -1,10 +1,11 @@ # -*- mode: snippet -*- # name: if ... ... else ... end # key: ife -# contributor : hankail05 +# contributor: hankail05 # -- if ${1:cond} - $2 + ${2:true} else - $0 -end \ No newline at end of file + ${3:false} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/let b/snippets/julia-mode/let new file mode 100644 index 0000000..e53385c --- /dev/null +++ b/snippets/julia-mode/let @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: let ... ... end +# key: let +# contributor: hankail05 +# -- +let ${1:x = 0} + ${2:body} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/macro b/snippets/julia-mode/macro new file mode 100644 index 0000000..56b2976 --- /dev/null +++ b/snippets/julia-mode/macro @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: macro(...) ... end +# key: macro +# contributor: hankail05 +# -- +macro ${1:macro}(${2:args}) + ${3:body} +end +$0 diff --git a/snippets/julia-mode/module b/snippets/julia-mode/module new file mode 100644 index 0000000..4ff4538 --- /dev/null +++ b/snippets/julia-mode/module @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: module ... ... end +# key: module +# contributor: hankail05 +# -- +module ${1:name} +${2:body} +end +$0 diff --git a/snippets/julia-mode/mutstr b/snippets/julia-mode/mutstr new file mode 100644 index 0000000..feeb3c7 --- /dev/null +++ b/snippets/julia-mode/mutstr @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: mutable struct ... end +# key: mutstr +# contributor: hankail05 +# -- +mutable struct ${1:name} + ${2:body} +end +$0 diff --git a/snippets/julia-mode/ptype b/snippets/julia-mode/ptype new file mode 100644 index 0000000..d40dd09 --- /dev/null +++ b/snippets/julia-mode/ptype @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: primitive type ... end +# key: ptype +# contributor: hankail05 +# -- +primitive type ${1:${2:type} <: ${3:supertype}} ${4:bits} end$0 diff --git a/snippets/julia-mode/quote b/snippets/julia-mode/quote new file mode 100644 index 0000000..cc3a2e0 --- /dev/null +++ b/snippets/julia-mode/quote @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: quote ... end +# key: quote +# contributor: hankail05 +# -- +quote + ${1:expr} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/struct b/snippets/julia-mode/struct new file mode 100644 index 0000000..b0d31e0 --- /dev/null +++ b/snippets/julia-mode/struct @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: struct ... end +# key: struct +# contributor: hankail05 +# -- +struct ${1:name} + ${2:body} +end +$0 \ No newline at end of file diff --git a/snippets/julia-mode/try b/snippets/julia-mode/try new file mode 100644 index 0000000..932c86c --- /dev/null +++ b/snippets/julia-mode/try @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: try ... catch ... end +# key: try +# contributor: hankail05 +# -- +try + ${1:expr} +catch ${2:error} + ${3:e_expr} +end +$0 diff --git a/snippets/julia-mode/tryf b/snippets/julia-mode/tryf new file mode 100644 index 0000000..0ebb5e1 --- /dev/null +++ b/snippets/julia-mode/tryf @@ -0,0 +1,13 @@ +# -*- mode: snippet -*- +# name: try ... catch ... finally ... end +# key: try +# contributor: hankail05 +# -- +try + ${1:expr} +catch ${2:error} + ${3:e_expr} +finally + ${4:f_expr} +end +$0 diff --git a/snippets/julia-mode/using b/snippets/julia-mode/using index 1838b95..cdc8ad4 100644 --- a/snippets/julia-mode/using +++ b/snippets/julia-mode/using @@ -1,6 +1,6 @@ # -*- mode: snippet -*- # name: using ... # key: using -# contributor : hankail05 -using ${1:package} -$0 +# contributor: hankail05 +# -- +using ${1:${2:package}:}$0 diff --git a/snippets/julia-mode/while b/snippets/julia-mode/while index 76f81b9..7a13bca 100644 --- a/snippets/julia-mode/while +++ b/snippets/julia-mode/while @@ -1,7 +1,9 @@ # -*- mode: snippet -*- # name: while ... ... end # key: while -# contributor : hankail05 +# contributor: hankail05 +# -- while ${1:cond} - $0 -end \ No newline at end of file + ${2:body} +end +$0 \ No newline at end of file