From edd715cf78d6b75ddb8f53573324f4df46e014b8 Mon Sep 17 00:00:00 2001 From: hankail05 <39765074+hankail05@users.noreply.github.com> Date: Mon, 30 Sep 2019 11:12:33 +0900 Subject: [PATCH 1/2] add snippets for some keywords --- snippets/julia-mode/do | 8 ++++++++ snippets/julia-mode/for | 8 ++++++++ snippets/julia-mode/function | 8 ++++++++ snippets/julia-mode/if | 8 ++++++++ snippets/julia-mode/ife | 10 ++++++++++ snippets/julia-mode/using | 6 ++++++ snippets/julia-mode/while | 7 +++++++ 7 files changed, 55 insertions(+) create mode 100644 snippets/julia-mode/do create mode 100644 snippets/julia-mode/for create mode 100644 snippets/julia-mode/function create mode 100644 snippets/julia-mode/if create mode 100644 snippets/julia-mode/ife create mode 100644 snippets/julia-mode/using create mode 100644 snippets/julia-mode/while diff --git a/snippets/julia-mode/do b/snippets/julia-mode/do new file mode 100644 index 000000000..40e51f1fe --- /dev/null +++ b/snippets/julia-mode/do @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: do ... ... end +# key: do +# contributor : hankail05 +# -- +do ${1:x} + $0 +end \ No newline at end of file diff --git a/snippets/julia-mode/for b/snippets/julia-mode/for new file mode 100644 index 000000000..46011d800 --- /dev/null +++ b/snippets/julia-mode/for @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for ... in ... ... end +# key: for +# contributor : hankail05 +# -- +for ${1:i} in ${2:1:n} + $0 +end diff --git a/snippets/julia-mode/function b/snippets/julia-mode/function new file mode 100644 index 000000000..d93894859 --- /dev/null +++ b/snippets/julia-mode/function @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: function(...) ... end +# key: fun +# contributor : hankail05 +# -- +function ${1:fun}(${2:args}) + $0 +end \ No newline at end of file diff --git a/snippets/julia-mode/if b/snippets/julia-mode/if new file mode 100644 index 000000000..f28873a56 --- /dev/null +++ b/snippets/julia-mode/if @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: if ... ... end +# key: if +# contributor : hankail05 +# -- +if ${1:cond} + $0 +end diff --git a/snippets/julia-mode/ife b/snippets/julia-mode/ife new file mode 100644 index 000000000..8d3cb7f95 --- /dev/null +++ b/snippets/julia-mode/ife @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: if ... ... else ... end +# key: ife +# contributor : hankail05 +# -- +if ${1:cond} + $2 +else + $0 +end \ No newline at end of file diff --git a/snippets/julia-mode/using b/snippets/julia-mode/using new file mode 100644 index 000000000..1838b959f --- /dev/null +++ b/snippets/julia-mode/using @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: using ... +# key: using +# contributor : hankail05 +using ${1:package} +$0 diff --git a/snippets/julia-mode/while b/snippets/julia-mode/while new file mode 100644 index 000000000..76f81b962 --- /dev/null +++ b/snippets/julia-mode/while @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: while ... ... end +# key: while +# contributor : hankail05 +while ${1:cond} + $0 +end \ No newline at end of file From 3c0a57777b13b907a5f556ec05b5a57f37676451 Mon Sep 17 00:00:00 2001 From: hankail05 <39765074+hankail05@users.noreply.github.com> Date: Tue, 1 Oct 2019 12:32:05 +0900 Subject: [PATCH 2/2] add snippets for keywords --- snippets/julia-mode/.yas-setup.el | 5 +++++ snippets/julia-mode/atype | 6 ++++++ snippets/julia-mode/begin | 9 +++++++++ snippets/julia-mode/do | 7 ++++--- snippets/julia-mode/for | 9 +++++---- snippets/julia-mode/{function => fun} | 7 ++++--- snippets/julia-mode/if | 5 +++-- snippets/julia-mode/ife | 9 +++++---- snippets/julia-mode/let | 9 +++++++++ snippets/julia-mode/macro | 9 +++++++++ snippets/julia-mode/module | 9 +++++++++ snippets/julia-mode/mutstr | 9 +++++++++ snippets/julia-mode/ptype | 6 ++++++ snippets/julia-mode/quote | 9 +++++++++ snippets/julia-mode/struct | 9 +++++++++ snippets/julia-mode/try | 11 +++++++++++ snippets/julia-mode/tryf | 13 +++++++++++++ snippets/julia-mode/using | 6 +++--- snippets/julia-mode/while | 8 +++++--- 19 files changed, 133 insertions(+), 22 deletions(-) create mode 100644 snippets/julia-mode/.yas-setup.el create mode 100644 snippets/julia-mode/atype create mode 100644 snippets/julia-mode/begin rename snippets/julia-mode/{function => fun} (68%) create mode 100644 snippets/julia-mode/let create mode 100644 snippets/julia-mode/macro create mode 100644 snippets/julia-mode/module create mode 100644 snippets/julia-mode/mutstr create mode 100644 snippets/julia-mode/ptype create mode 100644 snippets/julia-mode/quote create mode 100644 snippets/julia-mode/struct create mode 100644 snippets/julia-mode/try create mode 100644 snippets/julia-mode/tryf diff --git a/snippets/julia-mode/.yas-setup.el b/snippets/julia-mode/.yas-setup.el new file mode 100644 index 000000000..630d1dbd7 --- /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 000000000..9721a046a --- /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 000000000..78f851e60 --- /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 40e51f1fe..7630ffcfa 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 46011d800..8f9619f43 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 d93894859..2abeccf1b 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 f28873a56..adc4ad048 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 8d3cb7f95..f2578d404 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 000000000..e53385cb6 --- /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 000000000..56b29765d --- /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 000000000..4ff4538e9 --- /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 000000000..feeb3c783 --- /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 000000000..d40dd0995 --- /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 000000000..cc3a2e0bc --- /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 000000000..b0d31e0f4 --- /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 000000000..932c86c6c --- /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 000000000..0ebb5e132 --- /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 1838b959f..cdc8ad4bf 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 76f81b962..7a13bca1a 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