Skip to content

Commit

Permalink
Merge pull request #89 from jeroenbourgois/main
Browse files Browse the repository at this point in the history
feat: update elixir snippets and add eelixir snippets
  • Loading branch information
Rafael Madriz authored Oct 29, 2021
2 parents e2ae3bd + cfc2ebd commit 1614c0a
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ CocInstall https://github.com/rafamadriz/friendly-snippets@main
- Go
- GDScript (Godot)
- Haskell
- Elixir
- Eruby
- Ruby
- Swift
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"language": "elixir",
"path": "./snippets/elixir.json"
},
{
"language": "eelixir",
"path": "./snippets/eelixir.json"
},
{
"language": "fortran",
"path": "./snippets/fortran.json"
Expand Down
44 changes: 44 additions & 0 deletions snippets/eelixir.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"%": {
"prefix": "%",
"body": "<% $0 %>"
},
"=": {
"prefix": "=",
"body": "<%= $0 %>"
},
"gettext": {
"prefix": "gt",
"body": "<%= gettext(\"$0\") %>"
},
"for": {
"prefix": "for",
"body": [
"<%= for %{1:item} <- ${2:items} do %>",
" $0",
"<% end %>"
]
},
"if": {
"prefix": "if",
"body": [
"<%= if ${1} do %>",
" $0",
"<% end %>"
]
},
"ife": {
"prefix": "if",
"body": [
"<%= if ${1} do %>",
" $2",
"<% else %>",
" $0",
"<% end %>"
]
},
"lin": {
"prefix": "if",
"body": "<%= link \"${1:Submit}\", to: ${2:\"/users\"}, method: ${3::delete} %>"
}
}
191 changes: 187 additions & 4 deletions snippets/elixir.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"defmodule": {
"prefix": "defmodule",
"prefix": "defmo",
"body": [
"defmodule ${1:Name} do",
"defmodule ${1:module} do",
" $0",
"end"
],
Expand All @@ -26,12 +26,195 @@
],
"description": "Define a private function"
},
"IO.puts": {
"prefix": "put",
"body": "IO.puts($0)"
},
"IO.inspect": {
"prefix": "ins",
"body": "IO.inspect(${0})",
"body": "IO.inspect($0)"
},
"IO.inspect with label": {
"prefix": "insl",
"body": "IO.inspect(${0}, label: \"${1}\")",
"body": "IO.inspect($1, label: \"$0\")"
},
"if .. do .. end": {
"prefix": "if",
"body": [
"if ${1:condition} do",
" $0",
"end"
]
},
"if .. do:": {
"prefix": "if:",
"body": "if ${1:condition}, do: $0"
},
"if .. do .. else .. end": {
"prefix": "ife",
"body": [
"if ${1:condition} do",
" $2",
"else",
" $0",
"end"
]
},
"if .. do: .. else:": {
"prefix": "ife:",
"body": "if ${1:condition}, do: $2, else: $0"
},
"cond": {
"prefix": "cond",
"body": [
"cond do",
" $1 -> ",
" $0",
"end"
]
},
"case": {
"prefix": "case",
"body": [
"case $1 do",
" $2 -> ",
" $0",
"end"
]
},
"for": {
"prefix": "for",
"body": [
"for ${1:item} <- ${2:items} do",
" $0",
"end"
]
},
"def + doc": {
"prefix": "defd",
"body": [
"@doc \"\"\"",
"${1:doc}",
"\"\"\"",
"def ${2:name} do",
" $0",
"end"
]
},
"def + spec": {
"prefix": "defs",
"body": [
"@spec ${1:name}(${2:args}) :: ${3:no_return}",
"def $1{4:args} do",
" $0",
"end"
]
},
"def + doc + spec": {
"prefix": "defsd",
"body": [
"@doc \"\"\"",
"${1:doc}",
"\"\"\"",
"@spec ${2:name}(${3:args}) :: ${4:no_return}",
"def $2{5:args} do",
" $0",
"end"
]
},
"doc": {
"prefix": "doc",
"body": [
"@doc \"\"\"",
"$0",
"\"\"\""
]
},
"doc s": {
"prefix": "docs",
"body": [
"@doc ~S\"\"\"",
"$0",
"\"\"\""
]
},
"doc false": {
"prefix": "docf",
"body": "@doc false"
},
"moduledoc": {
"prefix": "mdoc",
"body": [
"@moduledoc \"\"\"",
"$0",
"\"\"\""
]
},
"moduledoc s": {
"prefix": "mdocs",
"body": [
"@moduledoc ~S\"\"\"",
"$0",
"\"\"\""
]
},
"moduledoc false": {
"prefix": "mdocf",
"body": "@moduledoc false"
},
"require": {
"prefix": "req",
"body": "require ${0:Logger}"
},
"test": {
"prefix": "test",
"body": [
"test ${1:name} do",
" $0",
"end"
]
},
"des": {
"prefix": "test",
"body": [
"describe \"${1:test group subject}\" do",
" $0",
"end"
]
},
"IEx.pry": {
"prefix": "pry",
"body": [
"require IEx; IEx.pry",
"$0"
]
},
"pipe char": {
"prefix": "p",
"body": "|> $0"
},
"pipe into each": {
"prefix": ">e",
"body": "|> Enum.each($0)"
},
"pipe into map": {
"prefix": ">m",
"body": "|> Enum.map($0)"
},
"pipe into filter": {
"prefix": ">f",
"body": "|> Enum.filter($0)"
},
"pipe into reduce": {
"prefix": ">f",
"body": "|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> $0 end)"
},
"word list": {
"prefix": "wl",
"body": "~w($0)"
},
"atom list": {
"prefix": "wl",
"body": "~w($0)a"
}
}

0 comments on commit 1614c0a

Please sign in to comment.