2014-03-11 16:59:33 -04:00
|
|
|
# Closure loop
|
|
|
|
snippet forindo
|
|
|
|
for ${1:name} in ${2:array}
|
|
|
|
do ($1) ->
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:// body}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Array comprehension
|
|
|
|
snippet fora
|
|
|
|
for ${1:name} in ${2:array}
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Object comprehension
|
|
|
|
snippet foro
|
|
|
|
for ${1:key}, ${2:value} of ${3:object}
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Range comprehension (inclusive)
|
|
|
|
snippet forr
|
|
|
|
for ${1:name} in [${2:start}..${3:finish}]
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
snippet forrb
|
|
|
|
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Range comprehension (exclusive)
|
|
|
|
snippet forrex
|
|
|
|
for ${1:name} in [${2:start}...${3:finish}]
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
snippet forrexb
|
|
|
|
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Function
|
|
|
|
snippet fun
|
|
|
|
(${1:args}) ->
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Function (bound)
|
|
|
|
snippet bfun
|
|
|
|
(${1:args}) =>
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Class
|
|
|
|
snippet cla class ..
|
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
|
|
|
${0}
|
|
|
|
snippet cla class .. constructor: ..
|
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
|
|
|
constructor: (${2:args}) ->
|
|
|
|
${3}
|
|
|
|
|
|
|
|
${0}
|
|
|
|
snippet cla class .. extends ..
|
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
|
|
|
${0}
|
|
|
|
snippet cla class .. extends .. constructor: ..
|
|
|
|
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
|
|
|
constructor: (${3:args}) ->
|
|
|
|
${4}
|
|
|
|
|
|
|
|
${0}
|
|
|
|
# If
|
|
|
|
snippet if
|
2022-09-25 06:10:28 -04:00
|
|
|
if ${1:condition}
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2014-03-11 16:59:33 -04:00
|
|
|
# If __ Else
|
|
|
|
snippet ife
|
2022-09-25 06:10:28 -04:00
|
|
|
if ${1:condition}
|
2017-02-11 08:01:38 -05:00
|
|
|
${2:${VISUAL}}
|
2014-03-11 16:59:33 -04:00
|
|
|
else
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Else if
|
|
|
|
snippet eif
|
2022-09-25 06:10:28 -04:00
|
|
|
else if ${1:condition}
|
2017-02-11 08:01:38 -05:00
|
|
|
${0:${VISUAL}}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Ternary If
|
2022-09-25 06:10:28 -04:00
|
|
|
snippet ifte
|
|
|
|
if ${1:condition} then ${2:value} else ${0:other}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Unless
|
2022-09-25 06:10:28 -04:00
|
|
|
snippet unl
|
|
|
|
${1:action} unless ${0:condition}
|
2014-03-11 16:59:33 -04:00
|
|
|
# Switch
|
|
|
|
snippet swi
|
|
|
|
switch ${1:object}
|
|
|
|
when ${2:value}
|
2022-09-25 06:10:28 -04:00
|
|
|
${0:# body...}
|
2014-03-11 16:59:33 -04:00
|
|
|
|
|
|
|
# Log
|
|
|
|
snippet log
|
|
|
|
console.log ${0}
|
|
|
|
# Try __ Catch
|
|
|
|
snippet try
|
|
|
|
try
|
2017-02-11 08:01:38 -05:00
|
|
|
${1:${VISUAL}}
|
2014-03-11 16:59:33 -04:00
|
|
|
catch ${2:error}
|
|
|
|
${0}
|
|
|
|
# Require
|
|
|
|
snippet req
|
|
|
|
${2:$1} = require '${1:sys}'
|
|
|
|
# Export
|
|
|
|
snippet exp
|
|
|
|
${0:root} = exports ? this
|
|
|
|
|
|
|
|
snippet jsonp
|
|
|
|
JSON.parse ${0:jstr}
|
|
|
|
# JSON.stringify
|
|
|
|
snippet jsons
|
|
|
|
JSON.stringify ${0:object}
|