vim-snippets/snippets/elixir.snippets

118 lines
1.7 KiB
Plaintext
Raw Normal View History

2013-06-25 20:40:02 -04:00
snippet do
do
${0}
2013-06-25 20:40:02 -04:00
end
2013-06-01 09:39:30 -04:00
snippet if if .. do .. end
if ${1} do
${0}
2013-06-01 09:39:30 -04:00
end
2015-02-21 06:24:27 -05:00
snippet if: if .. do: ..
if ${1:condition}, do: ${0}
2013-06-01 09:39:30 -04:00
snippet ife if .. do .. else .. end
if ${1:condition} do
${2}
else
${0}
2013-06-01 09:39:30 -04:00
end
2015-02-21 06:24:27 -05:00
snippet ife: if .. do: .. else:
if ${1:condition}, do: ${2}, else: ${0}
snippet unless unless .. do .. end
unless ${1} do
${0}
end
2015-02-21 06:24:27 -05:00
snippet unless: unless .. do: ..
unless ${1:condition}, do: ${0}
snippet unlesse unless .. do .. else .. end
unless ${1:condition} do
${2}
else
${0}
end
2015-02-21 06:24:27 -05:00
snippet unlesse: unless .. do: .. else:
unless ${1:condition}, do: ${2}, else: ${0}
snippet cond
cond do
${1} ->
${0}
end
2013-06-01 09:39:30 -04:00
snippet case
case ${1} do
${2} ->
${0}
2013-06-01 09:39:30 -04:00
end
2014-02-21 01:02:23 -05:00
snippet df
2014-02-26 10:41:19 -05:00
def ${1:name}, do: ${2}
2013-06-01 09:39:30 -04:00
snippet def
def ${1:name} do
${0}
2013-06-01 09:39:30 -04:00
end
2015-02-19 13:01:49 -05:00
snippet defd
@doc """
${1:doc string}
"""
def ${2:name} do
${0}
end
2013-06-01 09:39:30 -04:00
snippet defim
defimpl ${1:protocol_name}, for: ${2:data_type} do
${0}
2013-06-01 09:39:30 -04:00
end
snippet defma
defmacro ${1:name} do
${0}
2013-06-01 09:39:30 -04:00
end
snippet defmo
defmodule ${1:module_name} do
${0}
2013-06-01 09:39:30 -04:00
end
snippet defp
defp ${1:name} do
${0}
2013-06-01 09:39:30 -04:00
end
snippet defpr
defprotocol ${1:name}, [${0:function}]
2013-06-01 09:39:30 -04:00
snippet defr
defrecord ${1:record_name}, ${0:fields}
2013-06-01 09:39:30 -04:00
snippet doc
@doc """
${0}
2013-06-01 09:39:30 -04:00
"""
snippet fn
fn ${1:args} -> ${0} end
snippet fun
function do
${0}
end
2013-06-01 09:39:30 -04:00
snippet mdoc
@moduledoc """
${0}
2013-06-01 09:39:30 -04:00
"""
snippet rec
receive do
${1} ->
${0}
2013-06-01 09:39:30 -04:00
end
snippet req
require ${0:module_name}
snippet imp
import ${0:module_name}
snippet ali
alias ${0:module_name}
2013-06-01 09:39:30 -04:00
snippet test
test "${1:test_name}" do
${0}
2013-06-01 09:39:30 -04:00
end
2015-02-20 04:27:15 -05:00
snippet testa
2015-02-19 13:39:26 -05:00
test "${1:test_name}", %{${2:arg: arg}} do
${0}
end
snippet try try .. rescue .. end
2013-06-01 09:39:30 -04:00
try do
${1}
rescue
${2} -> ${0}
2013-06-01 09:39:30 -04:00
end
2015-02-20 11:03:05 -05:00
snippet pry
require IEx; IEx.pry
$0