2012-09-25 16:05:04 -04:00
|
|
|
# Closure loop
|
|
|
|
snippet forindo
|
|
|
|
for ${1:name} in ${2:array}
|
2012-09-25 16:42:44 -04:00
|
|
|
do ($1) ->
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:// body}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Array comprehension
|
|
|
|
snippet fora
|
|
|
|
for ${1:name} in ${2:array}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Object comprehension
|
|
|
|
snippet foro
|
|
|
|
for ${1:key}, ${2:value} of ${3:object}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Range comprehension (inclusive)
|
|
|
|
snippet forr
|
|
|
|
for ${1:name} in [${2:start}..${3:finish}]
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
snippet forrb
|
|
|
|
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Range comprehension (exclusive)
|
|
|
|
snippet forrex
|
|
|
|
for ${1:name} in [${2:start}...${3:finish}]
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
snippet forrexb
|
|
|
|
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Function
|
|
|
|
snippet fun
|
|
|
|
(${1:args}) ->
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Function (bound)
|
|
|
|
snippet bfun
|
|
|
|
(${1:args}) =>
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Class
|
|
|
|
snippet cla class ..
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
snippet cla class .. constructor: ..
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
2011-11-29 13:28:19 -05:00
|
|
|
constructor: (${2:args}) ->
|
2012-03-18 19:44:33 -04:00
|
|
|
${3}
|
|
|
|
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
snippet cla class .. extends ..
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
snippet cla class .. extends .. constructor: ..
|
2013-07-07 21:41:11 -04:00
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
2011-11-29 13:28:19 -05:00
|
|
|
constructor: (${3:args}) ->
|
2012-03-18 19:44:33 -04:00
|
|
|
${4}
|
|
|
|
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
# If
|
|
|
|
snippet if
|
|
|
|
if ${1:condition}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# If __ Else
|
|
|
|
snippet ife
|
|
|
|
if ${1:condition}
|
2013-04-25 14:59:03 -04:00
|
|
|
${2:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
else
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Else if
|
2013-06-22 20:30:26 -04:00
|
|
|
snippet eif
|
2011-11-29 13:28:19 -05:00
|
|
|
else if ${1:condition}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Ternary If
|
|
|
|
snippet ifte
|
2013-07-25 17:17:32 -04:00
|
|
|
if ${1:condition} then ${2:value} else ${0:other}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Unless
|
|
|
|
snippet unl
|
2013-07-25 17:17:32 -04:00
|
|
|
${1:action} unless ${0:condition}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Switch
|
|
|
|
snippet swi
|
|
|
|
switch ${1:object}
|
|
|
|
when ${2:value}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:# body...}
|
2011-11-29 13:28:19 -05:00
|
|
|
|
|
|
|
# Log
|
|
|
|
snippet log
|
2013-07-25 17:17:32 -04:00
|
|
|
console.log ${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Try __ Catch
|
|
|
|
snippet try
|
|
|
|
try
|
|
|
|
${1}
|
|
|
|
catch ${2:error}
|
2013-07-25 17:17:32 -04:00
|
|
|
${0}
|
2011-11-29 13:28:19 -05:00
|
|
|
# Require
|
|
|
|
snippet req
|
2013-07-25 17:17:32 -04:00
|
|
|
${2:$1} = require '${1:sys}'
|
2012-09-27 17:51:09 -04:00
|
|
|
# Export
|
|
|
|
snippet exp
|
2013-07-25 17:17:32 -04:00
|
|
|
${0:root} = exports ? this
|