dotfiles/modules/programs/nvim/snippets/elixir.snippets

72 lines
1.0 KiB
Plaintext
Raw Normal View History

2024-10-07 09:31:06 +02:00
snippet defmodule "Define a new module"
defmodule ${1} do
${2}
end
snippet def "Define a function"
def ${1} do
${2}
end
snippet defw "Define a function with guard"
def ${1}(${2}) when ${3} do
${4}
end
snippet defa "Define a function with arguments"
def ${1}(${2}) do
${3}
end
snippet defp "Define a private function"
defp ${1} do
${2}
end
snippet defpw "Define a private function with guard"
defp ${1}(${2}) when ${3} do
${4}
end
snippet defpa "Define a private function with arguments"
defp ${1}(${2}) do
${3}
end
snippet defmacro "Define a macro"
defmacro ${1}(${2}) do
${3}
end
snippet defmacrow "Define a macro with guard"
defmacro ${1}(${2}) when ${3} do
${4}
end
snippet quote "Quote block"
quote do
${1}
end
snippet quoteb "Quote block with bind_quoted"
quote bind_quoted: [${1}] do
${2}
end
snippet do "Do block"
do
${1}
end
snippet if "If block"
if ${1} do
${2}
end
snippet ife "If-Else block"
if ${1} do
${2}
else
${3}
end