- Improved default snippet files.

This commit is contained in:
Shougo Matsushita 2012-10-30 12:06:31 +09:00
parent 6a2c34bdaa
commit efb7202876
5 changed files with 116 additions and 140 deletions

View File

@ -1,4 +1,4 @@
snippet ec snippet ec
#endinitclip #endinitclip
@ -11,13 +11,13 @@ snippet br
snippet ca snippet ca
call(${1:frame}); call(${1:#:frame});
snippet case snippet case
abbr ce abbr ce
case ${1:expression} : case ${1:#:expression} :
${1:statement} ${1:TARGET}
snippet catch snippet catch
@ -25,24 +25,22 @@ abbr ch
catch ($1) { catch ($1) {
$2 $2
} }
snippet class snippet class
class ${1:ClassName} { class ${1:#:ClassName} {
var _${2}; var _${2};
function ${1}(${2}){ function ${1}(${2}){
_${2} = ${2};${0} _${2} = ${2};${0}
} }
} }
snippet co snippet co
continue; continue;
snippet dt snippet dt
default : default :
${1:statement} ${1:TARGET}
snippet de snippet de
@ -51,43 +49,42 @@ snippet de
snippet do snippet do
do { do {
${1} ${1:TARGET}
} while (${2:condition}); } while (${2:#:condition});
snippet dm snippet dm
duplicateMovieClip(${1:target}, ${2:newName}, ${3:depth}); duplicateMovieClip(${1:#:target}, ${2:#:newName}, ${3:#:depth});
snippet ei snippet ei
else if (${1}) { else if (${1}) {
${2} ${2:TARGET}
} }
snippet fori snippet fori
abbr fi abbr fi
for ( var ${1} in ${2} ){ for (var ${1} in ${2}){
${3} ${3:TARGET}
}; };
snippet for snippet for
abbr fr abbr fr
for ( var ${1}=0; ${1}<${3}.length; ${1}++ ) { for (var ${1} = 0; $1 < ${2}.length; $1++) {
${4} ${0:TARGET}
}; };
snippet fs snippet fs
fscommand(${1:command}, ${2:paramaters}); fscommand(${1:#:command}, ${2:#:paramaters});
snippet fn snippet fn
function ${1}(${2}):${3}{ function ${1}(${2}):${3}{
${4} ${0:TARGET}
}; };
snippet gu snippet gu
getURL(${1}); getURL(${1});
@ -102,15 +99,13 @@ snippet gs
snippet if snippet if
if (${1}) { if (${1}) {
${2} ${0:TARGET}
} }
snippet il snippet il
ifFrameLoaded (${1}) { ifFrameLoaded (${1}) {
${2} ${0:TARGET}
} }
snippet ip snippet ip
import ${1}; import ${1};
@ -118,24 +113,24 @@ snippet ip
snippet it snippet it
interface ${1}{ interface ${1}{
${2} ${0:TARGET}
} }
snippet lm snippet lm
loadMovie( ${1:url}, ${2:target}, ${3:method}); loadMovie(${1:url}, ${2:target}, ${3:method});
snippet ln snippet ln
loadMovieNum( ${1:url}, ${2:level}, ${3:method}); loadMovieNum(${1:url}, ${2:level}, ${3:method});
snippet lv snippet lv
loadVariables( ${1:url}, ${2:target}, ${3:method}); loadVariables(${1:url}, ${2:target}, ${3:method});
snippet vn snippet vn
loadVariables( ${1:url}, ${2:level}, ${3:method}); loadVariables(${1:url}, ${2:level}, ${3:method});
snippet mc snippet mc
@ -158,9 +153,8 @@ snippet on
snippet oc snippet oc
onClipEvent (${1}) { onClipEvent (${1}) {
${2} ${0:TARGET}
}; };
snippet pl snippet pl
play(); play();
@ -175,19 +169,19 @@ snippet ps
snippet pr snippet pr
print( ${1:target}, ${2:type} ); print(${1:#:target}, ${2:#:type});
snippet bn snippet bn
printAsBitmapNum( ${1:level}, ${2:type} ); printAsBitmapNum(${1:#:level}, ${2:#:type});
snippet pn snippet pn
printNum( ${1:level}, ${2:type} ); printNum(${1:#:level}, ${2:#:type});
snippet rm snippet rm
removeMovieClip( ${1:target} ); removeMovieClip(${1:#:target});
snippet rt snippet rt
@ -195,15 +189,15 @@ snippet rt
snippet sp snippet sp
setProperty( ${1:target}, ${2:property}, ${3:value} ); setProperty(${1:#:target}, ${2:#:property}, ${3:#:value});
snippet sv snippet sv
set( ${1:name}, ${2:value} ); set(${1:#:name}, ${2:#:value});
snippet dr snippet dr
startDrag(${1:target}, ${2:lockcenter}, ${3:l}, ${4:t}, ${5:r}, ${6:b} ); startDrag(${1:#:target}, ${2:#:lockcenter}, ${3:#:l}, ${4:#:t}, ${5:#:r}, ${6:#:b} );
snippet st snippet st
@ -219,16 +213,15 @@ snippet sd
snippet sw snippet sw
switch ( ${1:condition} ) { switch ( ${1:#:condition} ) {
${2} ${0:TARGET}
} }
snippet tt snippet tt
tellTarget( ${1:target} ) { tellTarget( ${1:#:target} ) {
${2} ${0:TARGET}
} }
snippet th snippet th
throw ${1}; throw ${1};
@ -244,16 +237,15 @@ snippet tr
snippet ty snippet ty
try { try {
${1} ${0:TARGET}
}; };
snippet um snippet um
unloadMovie(${1:target}); unloadMovie(${1:#:target});
snippet un snippet un
unloadMovieNum(${1:level}); unloadMovieNum(${1:#:level});
snippet vr snippet vr
@ -261,13 +253,13 @@ snippet vr
snippet wh snippet wh
while (${1:condition}) { while (${1:#:condition}) {
${2} ${0:TARGET}
}; };
snippet wt snippet wt
with (${1:target}); with (${1:#:target});
${2} ${0:TARGET}
}; };

View File

@ -1,9 +1,9 @@
snippet allow snippet allow
AllowOverride ${1:AuthConfig} ${2:FileInfo} ${3:Indexes} ${4:Limit} ${5:Options} AllowOverride ${1:#:AuthConfig} ${2:#:FileInfo} ${3:#:Indexes} ${4:#:Limit} ${5:#:Options}
snippet opt snippet opt
Options ${1:All} ${2:ExecCGI} ${3:FollowSymLinks} ${4:Includes} ${5:IncludesNOEXEC} ${6:Indexes} ${7:MultiViews} ${8:SymLinksIfOwnerMatch} Options ${1:#:All} ${2:#:ExecCGI} ${3:#:FollowSymLinks} ${4:#:Includes} ${5:#:IncludesNOEXEC} ${6:#:Indexes} ${7:#:MultiViews} ${8:#:SymLinksIfOwnerMatch}
snippet vhost snippet vhost
@ -14,10 +14,9 @@ snippet vhost
ErrorLog logs/${1}-error_log ErrorLog logs/${1}-error_log
CustomLog logs/${1}-access_log common CustomLog logs/${1}-access_log common
</VirtualHost> </VirtualHost>
snippet dir snippet dir
<Directory ${1:/Library/WebServer/}> <Directory ${1:/Library/WebServer/}>
${0} ${0}
</Directory> </Directory>

View File

@ -1,93 +1,87 @@
snippet script snippet script
script ${1:new_object} script ${1:#:new_object}
on run on run
${2:-- do something interesting} ${2:TARGET}
end run end run
end script end script
snippet on snippet on
on ${1:functionName}(${2:arguments}) on ${1:#:functionName}(${2:#:arguments})
${3:-- function actions} ${3:TARGET}
end ${1} end ${1}
snippet tell snippet tell
tell ${1:app} tell ${1:#:app}
${0:-- insert actions here} ${0:TARGET}
end tell end tell
snippet terms snippet terms
using terms from ${1:app} using terms from ${1:#:app}
${0:-- insert actions here} ${0:TARGET}
end using terms from end using terms from
snippet if snippet if
if ${1:true} then if ${1:true} then
${0:-- insert actions here} ${0:TARGET}
end if end if
snippet rept snippet rept
abbr rep abbr rep
repeat ${1} times} repeat ${1} times}
${0:-- insert actions here} ${0:TARGET}
end repeat end repeat
snippet repwh snippet repwh
abbr rep abbr rep
repeat while ${1:condition} repeat while ${1:#:condition}
${0} ${0:TARGET}
end repeat end repeat
snippet repwi snippet repwi
abbr rep abbr rep
repeat with ${1} in ${2} repeat with ${1} in ${2}
${0} ${0:TARGET}
end repeat end repeat
snippet try snippet try
try try
${0:-- actions to try} ${0:TARGET}
on error on error
-- error handling -- error handling
end try end try
<D-c>
snippet timeout snippet timeout
with timeout ${1:number} seconds with timeout ${1:#:number} seconds
${0:-- insert actions here} ${0:TARGET}
end timeout end timeout
snippet con snippet con
considering ${1:case} considering ${1:#:case}
${0:-- insert actions here} ${0:TARGET}
end considering end considering
snippet ign snippet ign
ignoring ${1:application responses} ignoring ${1:#:application responses}
${0:-- insert actions here} ${0:TARGET}
end ignoring end ignoring
snippet shell snippet shell
${1:set shell_stdout to }do shell script ${3:"${2:#script}"} ${1:#:set shell_stdout to }do shell script ${3:"${2:#script}"}
without altering line endings without altering line endings
${0} ${0}
snippet delim snippet delim
set oldDelims to AppleScript's text item delimiters set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"${1:,}"} set AppleScript's text item delimiters to {"${1:,}"}
${0:-- insert actions here} ${0:#:TARGET}
set AppleScript's text item delimiters to oldDelims set AppleScript's text item delimiters to oldDelims
@ -96,106 +90,96 @@ snippet parent
snippet alert snippet alert
display alert "${1:alert text}" display alert "${1:#:alert text}"
${2:message} "${3:message text}" ${2:#:message} "${3:#:message text}"
${4:as warning} ${4:#:as warning}
snippet dialog_OK snippet dialog_OK
abbr dialog abbr dialog
display dialog "${1:text}" display dialog "${1:#:text}"
${2:with icon} ${3:1} ${2:#:with icon} ${3:1}
buttons {"${4:OK}"} default button 1 buttons {"${4:OK}"} default button 1
snippet dialog_OK/Cancel snippet dialog_OK/Cancel
abbr dialog abbr dialog
display dialog "${1:text}" display dialog "${1:#:text}"
${2:with icon} ${2:#:with icon}
buttons {"${3:Cancel}", "${4:OK}"} buttons {"${3:Cancel}", "${4:OK}"}
default button "${4}" default button "${4}"
set button_pressed to button returned of result set button_pressed to button returned of result
if button_pressed is "${4}" then if button_pressed is "${4}" then
${5:-- action for default button button goes here} ${5:#:TARGET}
else else
-- action for cancel button goes here -- action for cancel button goes here
end if end if
snippet dialog_OK/Cancel/Other snippet dialog_OK/Cancel/Other
abbr dialog abbr dialog
display dialog "${1:text}" display dialog "${1:#:text}"
${2:with icon} ${2:#:with icon}
buttons {"${3:Cancel}", "${4:Other Choice}", "${5:OK}"} buttons {"${3:Cancel}", "${4:Other Choice}", "${5:OK}"}
default button "${5}" default button "${5}"
set button_pressed to button returned of result set button_pressed to button returned of result
if button_pressed is "${5}" then if button_pressed is "${5}" then
${6:-- action for default button button goes here} ${6:TARGET}
else if button_pressed is "${3}" then else if button_pressed is "${3}" then
-- action for cancel button goes here -- action for cancel button goes here
else else
-- action for other button goes here -- action for other button goes here
end if end if
snippet dialog_TextFierld snippet dialog_TextFierld
abbr dialog abbr dialog
set the_result to display dialog "${1:text}" set the_result to display dialog "${1:#:text}"
default answer "${2:type here}" default answer "${2:#:type here}"
${3:with icon} ${3:#:with icon}
buttons {"${4:Cancel}", "${5:OK}"} buttons {"${4:Cancel}", "${5:OK}"}
default button "${5}" default button "${5}"
set button_pressed to button returned of the_result set button_pressed to button returned of the_result
set text_typed to text returned of the_result set text_typed to text returned of the_result
if button_pressed is "${5}" then if button_pressed is "${5}" then
${6:-- action for default button button goes here} ${6:#:TARGET}
else else
-- action for cancel button goes here -- action for cancel button goes here
end if end if
snippet choose_Applications snippet choose_Applications
abbr choose abbr choose
${1:set the_application to }choose application with prompt "${2:Choose an application:}"${3:with multiple selections allowed} ${1:#:set the_application to }choose application with prompt "${2:#:Choose an application:}"${3:#:with multiple selections allowed}
snippet choose_Files snippet choose_Files
abbr choose abbr choose
${1:set the_file to }choose file with prompt "${2:Pick a file:}" ${1:#:set the_file to }choose file with prompt "${2:#:Pick a file:}"
${3:default location path to home folder} ${3:#:default location path to home folder}
${4:with invisibles} ${4:#:with invisibles}
${5:with multiple selections allowed} ${5:#:with multiple selections allowed}
${6:with showing package contents} ${6:#:with showing package contents}
snippet choose_Folders snippet choose_Folders
abbr choose abbr choose
${1:set the_folder to }choose folder with prompt "${2:Pick a folder:}" ${1:#:set the_folder to }choose folder with prompt "${2:#:Pick a folder:}"
${3:default location path to home folder} ${3:#:default location path to home folder}
${4:with invisibles} ${4:#:with invisibles}
${5:with multiple selections allowed} ${5:#:with multiple selections allowed}
${6:with showing package contents} ${6:#:with showing package contents}
${0} ${0}
snippet choose_NewFile snippet choose_NewFile
abbr choose abbr choose
${1:set the_filename to }choose file name with prompt "${2:Name this file:}" ${1:#:set the_filename to }choose file name with prompt "${2:#:Name this file:}"
default name "${3:untitled}" default location ${4:path to home folder} default name "${3:untitled}" default location ${4:#:path to home folder}
snippet choose_URL snippet choose_URL
abbr choose abbr choose
${1:set the_url to }choose URL showing ${2:Web} servers with editable URL ${1:#:set the_url to }choose URL showing ${2:Web} servers with editable URL
snippet choose_Color snippet choose_Color
abbr choose abbr choose
${1:set the_color to }choose color default color ${2:{65536, 65536, 65536\}} ${1:#:set the_color to }choose color default color ${2:{65536, 65536, 65536\}}
snippet choose_ItemFromList snippet choose_ItemFromList
abbr choose abbr choose
set the_choice to choose from list ${1}"\}} set the_choice to choose from list ${1}"\}}

View File

@ -1,11 +1,11 @@
snippet vital_of_without_let snippet vital_of_without_let
abbr vital#of('...') abbr vital#of('...')
vital#of('${1:vital}') vital#of('${1:#:vital_name}')
snippet vital_of snippet vital_of
abbr let s:V = vital#of('...') abbr let s:V = vital#of('...')
options head options head
let ${1:s:V} = vital#of('${2:vital}') let ${1:s:V} = vital#of('${2:#:vital_name}')
snippet vital_import_without_let snippet vital_import_without_let
abbr import abbr import
@ -14,16 +14,16 @@ abbr import
snippet vital_import snippet vital_import
abbr let s:M = s:V.import('...') abbr let s:M = s:V.import('...')
options head options head
let ${1:s:M} = ${2:s:V}.import('${3:Module}') let ${1:s:M} = ${2:s:V}.import('${3:#:module_name}')
snippet vital_load_without_call snippet vital_load_without_call
abbr s:V.load('...') abbr s:V.load('...')
${1:s:V}.load('${2:Module}') ${1:s:V}.load('${2:#:module_name}')
snippet vital_load snippet vital_load
abbr call s:V.load('...') abbr call s:V.load('...')
options head options head
call ${1:s:V}.load('${2:Module}') call ${1:s:V}.load('${2:#:module_name}')
# FAQ # FAQ
# Q. Why does this snip file has verbose prefix "vital_" for everything? # Q. Why does this snip file has verbose prefix "vital_" for everything?

View File

@ -44,7 +44,8 @@ syn match neosnippetVariable '\$\d\+' contained
syn match neosnippetComment '^#.*$' syn match neosnippetComment '^#.*$'
syn match neosnippetEscape '\\[`]' contained syn match neosnippetEscape '\\[`]' contained
syn match neosnippetKeyword '^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\)' contained syn match neosnippetKeyword
\'^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options|TARGET\)' contained
syn keyword neosnippetOption head word contained syn keyword neosnippetOption head word contained
syn match neosnippetPrevWords '^prev_word\s\+.*$' contains=neosnippetPrevWord,neosnippetKeyword syn match neosnippetPrevWords '^prev_word\s\+.*$' contains=neosnippetPrevWord,neosnippetKeyword
syn match neosnippetStatementName '^snippet\s.*$' contains=neosnippetName,neosnippetKeyword syn match neosnippetStatementName '^snippet\s.*$' contains=neosnippetName,neosnippetKeyword