vimrc/sources_non_forked/vim-snippets/snippets/coffee.snippets

96 lines
1.9 KiB
Text
Raw Normal View History

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