diff --git a/README.md b/README.md
index 1d39159..a552082 100644
--- a/README.md
+++ b/README.md
@@ -205,7 +205,7 @@ to maintain snippets for a language, please get in touch.
Notes: People are interested in snippets - and their interest may wane again.
This list is kept up-to-date on a best effort basis.
-* Elixir - [iurifq](https://github.com/iurifq)
+* Elixir - [lpil](https://github.com/lpil), [iurifq](https://github.com/iurifq)
* Falcon - [steveno](https://github.com/steveno)
* HTML Django - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets
index 7578378..fb6138a 100644
--- a/UltiSnips/all.snippets
+++ b/UltiSnips/all.snippets
@@ -89,7 +89,8 @@ endsnippet
snippet bbox "A nice box over the full width" b
`!p
-width = int(vim.eval("&textwidth")) or 71
+if not snip.c:
+ width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
box = make_box(len(t[1]), width)
snip.rv = box[0]
snip += box[1]
diff --git a/UltiSnips/eelixir.snippets b/UltiSnips/eelixir.snippets
index a9c5a29..040077f 100644
--- a/UltiSnips/eelixir.snippets
+++ b/UltiSnips/eelixir.snippets
@@ -1,3 +1,33 @@
priority -50
extends html
+
+snippet % "<% %>" w
+<% $0 %>
+endsnippet
+
+snippet = "<%= %>" w
+<%= $0 %>
+endsnippet
+
+snippet end "<% end %>" w
+<% end %>
+endsnippet
+
+snippet ft "form_tag" w
+<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %>
+ $0
+
+endsnippet
+
+snippet lin "link" w
+<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %>
+endsnippet
+
+snippet ff "form_for" w
+<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %>
+ $0
+
+ <%= submit "Submit" %>
+<% end %>
+endsnippet
diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets
index efd1589..780ee29 100644
--- a/UltiSnips/go.snippets
+++ b/UltiSnips/go.snippets
@@ -111,6 +111,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
}
endsnippet
+snippet funch "HTTP handler" b
+func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
+ ${0:${VISUAL}}
+}
+endsnippet
+
# types and variables
snippet map "Map type" b
map[${1:keytype}]${2:valtype}
@@ -135,3 +141,10 @@ snippet json "JSON field"
endsnippet
# vim:ft=snippets:
+
+# error handling
+snippet err "Basic error handling" b
+if err != nil {
+ log.${1:Fatal}(err)
+}
+endsnippet
diff --git a/UltiSnips/html.snippets b/UltiSnips/html.snippets
index 3986e11..fd1aca5 100644
--- a/UltiSnips/html.snippets
+++ b/UltiSnips/html.snippets
@@ -198,6 +198,18 @@ snippet h1 "XHTML
" w
$0
endsnippet
+snippet h2 "XHTML " w
+$0
+endsnippet
+
+snippet h3 "XHTML " w
+$0
+endsnippet
+
+snippet h4 "XHTML " w
+$0
+endsnippet
+
snippet head "XHTML "
diff --git a/UltiSnips/html_minimal.snippets b/UltiSnips/html_minimal.snippets
index 6867e86..e7ca5e0 100644
--- a/UltiSnips/html_minimal.snippets
+++ b/UltiSnips/html_minimal.snippets
@@ -29,5 +29,5 @@ snippet textarea
endsnippet
snippet img
-
+
endsnippet
diff --git a/UltiSnips/rust.snippets b/UltiSnips/rust.snippets
index ddb948f..a27d6fa 100644
--- a/UltiSnips/rust.snippets
+++ b/UltiSnips/rust.snippets
@@ -4,12 +4,34 @@
priority -50
-snippet fn "A function, optionally with arguments and return type." b
+snippet let "let variable declaration" b
+let ${1:name}${2:: ${3:type}} = ${4};
+endsnippet
+
+snippet letm "let mut variable declaration" b
+let mut ${1:name}${2:: ${3:type}} = ${4};
+endsnippet
+
+snippet fn "A function, optionally with arguments and return type."
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
${VISUAL}${0}
}
endsnippet
+snippet arg "Function Arguments" i
+${1:a}: ${2:T}${3:, arg}
+endsnippet
+
+snippet || "Closure, anonymous function (inline)" i
+${1:move }|${2}| { $3 }
+endsnippet
+
+snippet |} "Closure, anonymous function (block)" i
+${1:move }|${2}| {
+ $3
+}
+endsnippet
+
snippet pri "print!(..)" b
print!("${1}"${2/..*/, /}${2});
endsnippet
@@ -30,7 +52,7 @@ macro_rules! ${1:name} (
)
endsnippet
-snippet mod "A module" b
+snippet mod "A module" b
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
${VISUAL}${0}
}
@@ -52,18 +74,27 @@ struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
}
endsnippet
+# TODO: fancy dynamic field mirroring like Python slotclass
snippet stn "Struct with new constructor." b
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
- ${3}
+ fd${0}
}
impl $1 {
pub fn new(${2}) -> $1 {
- ${4}return $1 {
- ${5}
- };
+ $1 { ${3} };
}
}
endsnippet
+snippet fd "Struct field definition" w
+${1:name}: ${2:Type},
+endsnippet
+
+snippet impl "Struct/Trait implementation" b
+impl ${1:Type/Trait}${2: for ${3:Type}} {
+ ${0}
+}
+endsnippet
+
# vim:ft=snippets:
diff --git a/snippets/cs.snippets b/snippets/cs.snippets
index e537bce..561bf9f 100644
--- a/snippets/cs.snippets
+++ b/snippets/cs.snippets
@@ -71,7 +71,7 @@ snippet simc
}
# if condition
snippet if
- if (${1}) {
+ if (${1:True}) {
${0}
}
snippet el
@@ -90,7 +90,7 @@ snippet ?
snippet do
do {
${0}
- } while (${1});
+ } while (${1:True});
# while loop
snippet wh
while (${1}) {
@@ -101,17 +101,21 @@ snippet for
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) {
${0}
}
+snippet forr
+ for (int ${1:i} = ${2:length}; $1 >= 0; $1--) {
+ ${0}
+ }
# foreach
snippet fore
- foreach (var ${1:entry} in ${2}) {
+ foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
snippet foreach
- foreach (var ${1:entry} in ${2}) {
+ foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
snippet each
- foreach (var ${1:entry} in ${2}) {
+ foreach (${1:var} ${2:entry} in ${3}) {
${0}
}
# interfaces
@@ -347,6 +351,11 @@ snippet struct
}
# enumeration
snippet enum
+ enum ${1} {
+ ${0}
+ }
+
+snippet enum+
public enum ${1} {
${0}
}
@@ -372,3 +381,39 @@ snippet ${1}
snippet ${1}
+
+snippet cw
+ Console.WriteLine(${1});
+
+# equals override
+snippet eq
+ public override bool Equals(object obj){
+ if (obj == null || GetType() != obj.GetType()){
+ return false;
+ }
+ ${0:throw new NotImplementedException();}
+ return base.Equals(obj);
+ }
+# exception snippet
+snippet exc
+ public class ${1:MyException} : ${2:Exception}{
+ public $1() { }
+ public $1(string message) : base(message) { }
+ public $1(string message, Exception inner) : base(message, inner) { }
+ protected $1(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context)
+ : base(info, context) { }
+ }
+# indexer snippet
+snippet index
+ public ${1:object} this[${2:int} index]{
+ get { ${3:} }
+ set { ${0:} }
+ }
+# eventhandler snippet
+snippet inv
+ EventHandler temp = ${1:MyEvent};
+ if (${2:temp} != null){
+ $2();
+ }
diff --git a/snippets/eelixir.snippets b/snippets/eelixir.snippets
index 17855b4..be7ce01 100644
--- a/snippets/eelixir.snippets
+++ b/snippets/eelixir.snippets
@@ -1,6 +1,23 @@
snippet %
<% ${0} %>
+
snippet =
- <%= ${1} %>
+ <%= ${0} %>
+
snippet end
<% end %>
+
+snippet ft
+ <%= form_tag(${1:"/users"}, method: ${2::post}) %>
+ ${0}
+
+
+snippet lin
+ <%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
+
+snippet ff
+ <%= form_for @changeset, ${1:"/users"}, fn f -> %>
+ ${0}
+
+ <%= submit "Submit" %>
+ <% end %>
diff --git a/snippets/html.snippets b/snippets/html.snippets
index dcc28e7..89438b4 100644
--- a/snippets/html.snippets
+++ b/snippets/html.snippets
@@ -592,6 +592,10 @@ snippet link:rss
snippet link:touch
+snippet main
+
+ ${0}
+
snippet map