diff --git a/snippets/crystal-mode/any b/snippets/crystal-mode/any new file mode 100644 index 000000000..a58caf40d --- /dev/null +++ b/snippets/crystal-mode/any @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: any? { |...| ... } +# key: any +# group : collections +# -- +any? { |${e}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/case b/snippets/crystal-mode/case new file mode 100644 index 000000000..e2f330808 --- /dev/null +++ b/snippets/crystal-mode/case @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: case ... end +# key: case +# group : general +# -- +case ${1:object} +when ${2:condition} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/cls b/snippets/crystal-mode/cls new file mode 100644 index 000000000..7b22720ef --- /dev/null +++ b/snippets/crystal-mode/cls @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: class ... end +# key: cls +# group : definitions +# -- +class ${1:`(let ((fn (capitalize (file-name-nondirectory + (file-name-sans-extension + (or (buffer-file-name) + (buffer-name (current-buffer)))))))) + (replace-regexp-in-string "_" "" fn t t))`} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/def b/snippets/crystal-mode/def new file mode 100644 index 000000000..ac12bbbaf --- /dev/null +++ b/snippets/crystal-mode/def @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: def ... end +# key: def +# key: def +# -- +def ${1:method}${2:(${3:args})} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/ea b/snippets/crystal-mode/ea new file mode 100644 index 000000000..9321c29c8 --- /dev/null +++ b/snippets/crystal-mode/ea @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: each { |...| ... } +# key: ea +# group : collections +# -- +each { |${e}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/eac b/snippets/crystal-mode/eac new file mode 100644 index 000000000..9e9f838fc --- /dev/null +++ b/snippets/crystal-mode/eac @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: each_cons(...) { |...| ... } +# key: eac +# group : collections +# -- +each_cons(${1:2}) { |${group}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/eai b/snippets/crystal-mode/eai new file mode 100644 index 000000000..9dde33fe6 --- /dev/null +++ b/snippets/crystal-mode/eai @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: each_index { |i| ... } +# key: eai +# group : collections +# -- +each_index { |${i}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/eawi b/snippets/crystal-mode/eawi new file mode 100644 index 000000000..9fcd7e7d1 --- /dev/null +++ b/snippets/crystal-mode/eawi @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: each_with_index { |e, i| ... } +# key: eawi +# group : collections +# -- +each_with_index { |${e}, ${i}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/el b/snippets/crystal-mode/el new file mode 100644 index 000000000..019ab7a50 --- /dev/null +++ b/snippets/crystal-mode/el @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: else ... +# key: el +# group : control structure +# -- +else`(indent-for-tab-command)` + $1 \ No newline at end of file diff --git a/snippets/crystal-mode/esi b/snippets/crystal-mode/esi new file mode 100644 index 000000000..ca82cddc8 --- /dev/null +++ b/snippets/crystal-mode/esi @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: elsif ... +# key: esi +# group : control structure +# -- +elsif`(indent-for-tab-command)` ${1:condition} + $2 \ No newline at end of file diff --git a/snippets/crystal-mode/for b/snippets/crystal-mode/for new file mode 100644 index 000000000..1047d7b9b --- /dev/null +++ b/snippets/crystal-mode/for @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for +# key: for +# group : control structure +# -- +for ${1:el} in ${2:collection} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/forin b/snippets/crystal-mode/forin new file mode 100644 index 000000000..18531bfeb --- /dev/null +++ b/snippets/crystal-mode/forin @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: for ... in ...; ... end +# key: forin +# group : control structure +# -- +for ${1:element} in ${2:collection} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/if b/snippets/crystal-mode/if new file mode 100644 index 000000000..62a80a991 --- /dev/null +++ b/snippets/crystal-mode/if @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: if ... end +# key: if +# group : control structure +# -- +if ${1:condition} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/ife b/snippets/crystal-mode/ife new file mode 100644 index 000000000..ac7da8942 --- /dev/null +++ b/snippets/crystal-mode/ife @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: if ... else ... end +# key: ife +# group : control structure +# -- +if ${1:condition} + $2 +else + $3 +end \ No newline at end of file diff --git a/snippets/crystal-mode/inc b/snippets/crystal-mode/inc new file mode 100644 index 000000000..bfcd94e90 --- /dev/null +++ b/snippets/crystal-mode/inc @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: include Module +# key: inc +# group: general +# -- +include ${1:Module} +$0 diff --git a/snippets/crystal-mode/init b/snippets/crystal-mode/init new file mode 100644 index 000000000..264f3415b --- /dev/null +++ b/snippets/crystal-mode/init @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: init +# key: init +# -- +def initialize(${1:args}) + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/map b/snippets/crystal-mode/map new file mode 100644 index 000000000..1f71b195d --- /dev/null +++ b/snippets/crystal-mode/map @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: map { |...| ... } +# key: map +# group : collections +# -- +map { |${e}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/mod b/snippets/crystal-mode/mod new file mode 100644 index 000000000..af1a897e2 --- /dev/null +++ b/snippets/crystal-mode/mod @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: module ... end +# group : definitions +# key: mod +# -- +module ${1:`(let ((fn (capitalize (file-name-nondirectory + (file-name-sans-extension + (or (buffer-file-name) + (buffer-name (current-buffer)))))))) + (while (string-match "_" fn) + (setq fn (replace-match "" nil nil fn))) + fn)`} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/red b/snippets/crystal-mode/red new file mode 100644 index 000000000..4f807b36c --- /dev/null +++ b/snippets/crystal-mode/red @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: reduce(...) { |...| ... } +# key: red +# group : collections +# -- +reduce(${1:0}) { |${2:accumulator}, ${3:element}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/reject b/snippets/crystal-mode/reject new file mode 100644 index 000000000..1a003aa95 --- /dev/null +++ b/snippets/crystal-mode/reject @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: reject { |...| ... } +# key: reject +# group : collections +# -- +reject { |${1:element}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/req b/snippets/crystal-mode/req new file mode 100644 index 000000000..0be86a4db --- /dev/null +++ b/snippets/crystal-mode/req @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: require "..." +# key: require +# group : general +# -- +require '$0' \ No newline at end of file diff --git a/snippets/crystal-mode/select b/snippets/crystal-mode/select new file mode 100644 index 000000000..95da29b23 --- /dev/null +++ b/snippets/crystal-mode/select @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: select { |...| ... } +# key: select +# group : collections +# -- +select { |${1:element}| $0 } \ No newline at end of file diff --git a/snippets/crystal-mode/upt b/snippets/crystal-mode/upt new file mode 100644 index 000000000..a5750f61f --- /dev/null +++ b/snippets/crystal-mode/upt @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: upto(...) { |n| ... } +# key: upt +# group : control structure +# -- +upto(${n}) { |${i}| + $0 +} \ No newline at end of file diff --git a/snippets/crystal-mode/when b/snippets/crystal-mode/when new file mode 100644 index 000000000..5885d2cff --- /dev/null +++ b/snippets/crystal-mode/when @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: when ... end +# key: when +# group : control structure +# -- +when ${condition} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/while b/snippets/crystal-mode/while new file mode 100644 index 000000000..7b037f04d --- /dev/null +++ b/snippets/crystal-mode/while @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: while ... end +# key: while +# group : control structure +# -- +while ${condition} + $0 +end \ No newline at end of file diff --git a/snippets/crystal-mode/zip b/snippets/crystal-mode/zip new file mode 100644 index 000000000..112c099df --- /dev/null +++ b/snippets/crystal-mode/zip @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: zip(...) { |...| ... } +# key: zip +# group : collections +# -- +zip(${enums}) { |${row}| $0 } \ No newline at end of file