- 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

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

View File

@ -1,9 +1,9 @@
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
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
@ -15,7 +15,6 @@ snippet vhost
CustomLog logs/${1}-access_log common
</VirtualHost>
snippet dir
<Directory ${1:/Library/WebServer/}>
${0}

View File

@ -1,93 +1,87 @@
snippet script
script ${1:new_object}
script ${1:#:new_object}
on run
${2:-- do something interesting}
${2:TARGET}
end run
end script
snippet on
on ${1:functionName}(${2:arguments})
${3:-- function actions}
on ${1:#:functionName}(${2:#:arguments})
${3:TARGET}
end ${1}
snippet tell
tell ${1:app}
${0:-- insert actions here}
tell ${1:#:app}
${0:TARGET}
end tell
snippet terms
using terms from ${1:app}
${0:-- insert actions here}
using terms from ${1:#:app}
${0:TARGET}
end using terms from
snippet if
if ${1:true} then
${0:-- insert actions here}
${0:TARGET}
end if
snippet rept
abbr rep
repeat ${1} times}
${0:-- insert actions here}
${0:TARGET}
end repeat
snippet repwh
abbr rep
repeat while ${1:condition}
${0}
repeat while ${1:#:condition}
${0:TARGET}
end repeat
snippet repwi
abbr rep
repeat with ${1} in ${2}
${0}
${0:TARGET}
end repeat
snippet try
try
${0:-- actions to try}
${0:TARGET}
on error
-- error handling
end try
<D-c>
snippet timeout
with timeout ${1:number} seconds
${0:-- insert actions here}
with timeout ${1:#:number} seconds
${0:TARGET}
end timeout
snippet con
considering ${1:case}
${0:-- insert actions here}
considering ${1:#:case}
${0:TARGET}
end considering
snippet ign
ignoring ${1:application responses}
${0:-- insert actions here}
ignoring ${1:#:application responses}
${0:TARGET}
end ignoring
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
${0}
snippet delim
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"${1:,}"}
${0:-- insert actions here}
${0:#:TARGET}
set AppleScript's text item delimiters to oldDelims
@ -96,104 +90,94 @@ snippet parent
snippet alert
display alert "${1:alert text}"
${2:message} "${3:message text}"
${4:as warning}
display alert "${1:#:alert text}"
${2:#:message} "${3:#:message text}"
${4:#:as warning}
snippet dialog_OK
abbr dialog
display dialog "${1:text}"
${2:with icon} ${3:1}
display dialog "${1:#:text}"
${2:#:with icon} ${3:1}
buttons {"${4:OK}"} default button 1
snippet dialog_OK/Cancel
abbr dialog
display dialog "${1:text}"
${2:with icon}
display dialog "${1:#:text}"
${2:#:with icon}
buttons {"${3:Cancel}", "${4:OK}"}
default button "${4}"
set button_pressed to button returned of result
if button_pressed is "${4}" then
${5:-- action for default button button goes here}
${5:#:TARGET}
else
-- action for cancel button goes here
end if
snippet dialog_OK/Cancel/Other
abbr dialog
display dialog "${1:text}"
${2:with icon}
display dialog "${1:#:text}"
${2:#:with icon}
buttons {"${3:Cancel}", "${4:Other Choice}", "${5:OK}"}
default button "${5}"
set button_pressed to button returned of result
if button_pressed is "${5}" then
${6:-- action for default button button goes here}
${6:TARGET}
else if button_pressed is "${3}" then
-- action for cancel button goes here
else
-- action for other button goes here
end if
snippet dialog_TextFierld
abbr dialog
set the_result to display dialog "${1:text}"
default answer "${2:type here}"
${3:with icon}
set the_result to display dialog "${1:#:text}"
default answer "${2:#:type here}"
${3:#:with icon}
buttons {"${4:Cancel}", "${5:OK}"}
default button "${5}"
set button_pressed to button returned of the_result
set text_typed to text returned of the_result
if button_pressed is "${5}" then
${6:-- action for default button button goes here}
${6:#:TARGET}
else
-- action for cancel button goes here
end if
snippet choose_Applications
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
abbr choose
${1:set the_file to }choose file with prompt "${2:Pick a file:}"
${3:default location path to home folder}
${4:with invisibles}
${5:with multiple selections allowed}
${6:with showing package contents}
${1:#:set the_file to }choose file with prompt "${2:#:Pick a file:}"
${3:#:default location path to home folder}
${4:#:with invisibles}
${5:#:with multiple selections allowed}
${6:#:with showing package contents}
snippet choose_Folders
abbr choose
${1:set the_folder to }choose folder with prompt "${2:Pick a folder:}"
${3:default location path to home folder}
${4:with invisibles}
${5:with multiple selections allowed}
${6:with showing package contents}
${1:#:set the_folder to }choose folder with prompt "${2:#:Pick a folder:}"
${3:#:default location path to home folder}
${4:#:with invisibles}
${5:#:with multiple selections allowed}
${6:#:with showing package contents}
${0}
snippet choose_NewFile
abbr choose
${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}
${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}
snippet choose_URL
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
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
abbr choose

View File

@ -1,11 +1,11 @@
snippet vital_of_without_let
abbr vital#of('...')
vital#of('${1:vital}')
vital#of('${1:#:vital_name}')
snippet vital_of
abbr let s:V = vital#of('...')
options head
let ${1:s:V} = vital#of('${2:vital}')
let ${1:s:V} = vital#of('${2:#:vital_name}')
snippet vital_import_without_let
abbr import
@ -14,16 +14,16 @@ abbr import
snippet vital_import
abbr let s:M = s:V.import('...')
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
abbr s:V.load('...')
${1:s:V}.load('${2:Module}')
${1:s:V}.load('${2:#:module_name}')
snippet vital_load
abbr call s:V.load('...')
options head
call ${1:s:V}.load('${2:Module}')
call ${1:s:V}.load('${2:#:module_name}')
# FAQ
# 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 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 match neosnippetPrevWords '^prev_word\s\+.*$' contains=neosnippetPrevWord,neosnippetKeyword
syn match neosnippetStatementName '^snippet\s.*$' contains=neosnippetName,neosnippetKeyword