1
0
Fork 0
mirror of synced 2024-12-23 07:20:42 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/coffee.snippets

110 lines
2.3 KiB
Text
Raw Normal View History

# Closure loop
snippet forindo
for ${1:name} in ${2:array}
do ($1) ->
${0:// body}
2012-08-16 23:41:25 -04:00
# Array comprehension
snippet fora
for ${1:name} in ${2:array}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Object comprehension
snippet foro
for ${1:key}, ${2:value} of ${3:object}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Range comprehension (inclusive)
snippet forr
for ${1:name} in [${2:start}..${3:finish}]
${0:# body...}
2012-08-16 23:41:25 -04:00
snippet forrb
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Range comprehension (exclusive)
snippet forrex
for ${1:name} in [${2:start}...${3:finish}]
${0:# body...}
2012-08-16 23:41:25 -04:00
snippet forrexb
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Function
snippet fun
(${1:args}) ->
${0:# body...}
2012-08-16 23:41:25 -04:00
# Function (bound)
snippet bfun
(${1:args}) =>
${0:# body...}
2012-08-16 23:41:25 -04:00
# Class
snippet cla class ..
2013-07-17 19:06:05 -04:00
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${0}
2012-08-16 23:41:25 -04:00
snippet cla class .. constructor: ..
2013-07-17 19:06:05 -04:00
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
2012-08-16 23:41:25 -04:00
constructor: (${2:args}) ->
${3}
${0}
2012-08-16 23:41:25 -04:00
snippet cla class .. extends ..
2013-07-17 19:06:05 -04:00
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
${0}
2012-08-16 23:41:25 -04:00
snippet cla class .. extends .. constructor: ..
2013-07-17 19:06:05 -04:00
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
2012-08-16 23:41:25 -04:00
constructor: (${3:args}) ->
${4}
${0}
2012-08-16 23:41:25 -04:00
# If
snippet if
if ${1:condition}
${0:# body...}
2012-08-16 23:41:25 -04:00
# If __ Else
snippet ife
if ${1:condition}
2013-04-26 12:17:22 -04:00
${2:# body...}
2012-08-16 23:41:25 -04:00
else
${0:# body...}
2012-08-16 23:41:25 -04:00
# Else if
2013-07-17 19:06:05 -04:00
snippet eif
2012-08-16 23:41:25 -04:00
else if ${1:condition}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Ternary If
snippet ifte
if ${1:condition} then ${2:value} else ${0:other}
2012-08-16 23:41:25 -04:00
# Unless
snippet unl
${1:action} unless ${0:condition}
2012-08-16 23:41:25 -04:00
# Switch
snippet swi
switch ${1:object}
when ${2:value}
${0:# body...}
2012-08-16 23:41:25 -04:00
# Log
snippet log
console.log ${0}
2012-08-16 23:41:25 -04:00
# Try __ Catch
snippet try
try
${1}
catch ${2:error}
${0}
2012-08-16 23:41:25 -04:00
# Require
snippet req
${2:$1} = require '${1:sys}'
# Export
snippet exp
${0:root} = exports ? this
2014-01-06 19:25:41 -05:00
snippet ajax
$.ajax
url: "${1:mydomain.com/url}"
type: "${2:POST}"
dataType: "${3:xml/html/script/json}"
data: ${4:data}
complete: (jqXHR, textStatus) ->
${5:// callback}
success: (data, textStatus, jqXHR) ->
${6:// success callback}
error: (jqXHR, textStatus, errorThrown) ->
${0:// error callback}