From 89522d1ad2c7ab76660eef6598ed1ac3a475a3a1 Mon Sep 17 00:00:00 2001 From: g0rdin <9ordin@gmail.com> Date: Sat, 8 Jan 2011 22:25:28 +0100 Subject: [PATCH 1/3] Added snippets for erlang (grabbed from TextMate bundles) --- UltiSnips/erlang.snippets | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 UltiSnips/erlang.snippets diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets new file mode 100644 index 0000000..4acd923 --- /dev/null +++ b/UltiSnips/erlang.snippets @@ -0,0 +1,87 @@ +########################################################################### +# TEXTMATE SNIPPETS # +########################################################################### + +snippet beh "Behaviour Directive" +-behaviour (${1:behaviour}). +endsnippet + +snippet case "Case Expression" +case ${1:expression} of + ${2:pattern}${3: when ${4:guard}} -> + ${5:body} +end +endsnippet + +snippet def "Define Directive" +-define (${1:macro}${2: (${3:param})}, ${4:body}). +endsnippet + +snippet exp "Export Directive" +-export ([${1:function}/${2:arity}]). +endsnippet + +snippet fun "Fun Expression" +fun + (${1:pattern})${2: when ${3:guard}} -> + ${4:body} +end +endsnippet + +snippet if "If Expression" +if + ${1:guard} -> + ${2:body} +end +endsnippet + +snippet ifdef "Ifdef Directive" +-ifdef (${1:macro}). +endsnippet + +snippet ifndef "Ifndef Directive" +-ifndef (${1:macro}). +endsnippet + +snippet imp "Import Directive" +-import (${1:module}, [${2:function}/${3:arity}]). +endsnippet + +snippet inc "Include Directive" +-include ("${1:file}"). +endsnippet + +snippet mod "Module Directive" +-module (${1:`!p snip.rv = snip.basename or "module"`}). +endsnippet + +snippet rcv "Receive Expression" +receive +${1: ${2:pattern}${3: when ${4:guard}} -> + ${5:body} +}${6:after + ${7:expression} -> + ${8:body} +}end +endsnippet + +snippet rec "Record Directive" +-record (${1:record}, {${2:field}${3: = ${4:value}}}). +endsnippet + +snippet try "Try Expression" +try${1: ${2:expression}${3: of + ${4:pattern}${5: when ${6:guard}} -> + ${7:body}}} +${8:catch + ${9:pattern}${10: when ${11:guard}} -> + ${12:body}} +${13:after + ${14:body}} +end +endsnippet + +snippet undef "Undef Directive" +-undef (${1:macro}). +endsnippet + From 06b6aeba34f180cb9f972ab3247f86af34eb28f8 Mon Sep 17 00:00:00 2001 From: g0rdin <9ordin@gmail.com> Date: Sat, 8 Jan 2011 23:20:07 +0100 Subject: [PATCH 2/3] Added useful snippets to erlang snippets --- UltiSnips/erlang.snippets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets index 4acd923..80776a7 100644 --- a/UltiSnips/erlang.snippets +++ b/UltiSnips/erlang.snippets @@ -2,6 +2,11 @@ # TEXTMATE SNIPPETS # ########################################################################### +snippet pat "Case:Receive:Try Clause" +${1:pattern}${2: when ${3:guard}} ->; + ${4:body} +endsnippet + snippet beh "Behaviour Directive" -behaviour (${1:behaviour}). endsnippet @@ -28,6 +33,11 @@ fun end endsnippet +snippet fu "Function" +${1:function} (${2:param})${3: when ${4:guard}} -> + ${5:body} +endsnippet + snippet if "If Expression" if ${1:guard} -> From ad3a3d72425316231aec7f4ee795eda76a02fb4d Mon Sep 17 00:00:00 2001 From: g0rdin <9ordin@gmail.com> Date: Mon, 10 Jan 2011 02:07:59 +0100 Subject: [PATCH 3/3] tweaked receive snippet for erlang --- UltiSnips/erlang.snippets | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UltiSnips/erlang.snippets b/UltiSnips/erlang.snippets index 80776a7..5474fd8 100644 --- a/UltiSnips/erlang.snippets +++ b/UltiSnips/erlang.snippets @@ -68,11 +68,11 @@ endsnippet snippet rcv "Receive Expression" receive ${1: ${2:pattern}${3: when ${4:guard}} -> - ${5:body} -}${6:after + ${5:body}} +${6:after ${7:expression} -> - ${8:body} -}end + ${8:body}} +end endsnippet snippet rec "Record Directive"