2012-08-16 23:41:25 -04:00
|
|
|
# #!/usr/bin/env tclsh
|
|
|
|
snippet #!
|
|
|
|
#!/usr/bin/env tclsh
|
2013-07-17 19:06:05 -04:00
|
|
|
|
2012-08-16 23:41:25 -04:00
|
|
|
# Process
|
|
|
|
snippet pro
|
|
|
|
proc ${1:function_name} {${2:args}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${3}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
#xif
|
|
|
|
snippet xif
|
|
|
|
${1:expr}? ${2:true} : ${3:false}
|
|
|
|
# Conditional
|
|
|
|
snippet if
|
|
|
|
if {${1}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${2}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Conditional if..else
|
|
|
|
snippet ife
|
|
|
|
if {${1}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${2}
|
2012-08-16 23:41:25 -04:00
|
|
|
} else {
|
|
|
|
${3:# else...}
|
|
|
|
}
|
2013-07-17 19:06:05 -04:00
|
|
|
snippet eif
|
|
|
|
elseif {${1}} {
|
|
|
|
${2}
|
|
|
|
}
|
2012-08-16 23:41:25 -04:00
|
|
|
# Conditional if..elsif..else
|
|
|
|
snippet ifee
|
|
|
|
if {${1}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${2}
|
2012-08-16 23:41:25 -04:00
|
|
|
} elseif {${3}} {
|
|
|
|
${4:# elsif...}
|
|
|
|
} else {
|
|
|
|
${5:# else...}
|
|
|
|
}
|
|
|
|
# If catch then
|
|
|
|
snippet ifc
|
|
|
|
if { [catch {${1:#do something...}} ${2:err}] } {
|
|
|
|
${3:# handle failure...}
|
|
|
|
}
|
|
|
|
# Catch
|
|
|
|
snippet catch
|
|
|
|
catch {${1}} ${2:err} ${3:options}
|
|
|
|
# While Loop
|
|
|
|
snippet wh
|
|
|
|
while {${1}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${2}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# For Loop
|
|
|
|
snippet for
|
|
|
|
for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${4}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# Foreach Loop
|
|
|
|
snippet fore
|
|
|
|
foreach ${1:x} {${2:#list}} {
|
2013-07-17 19:06:05 -04:00
|
|
|
${3}
|
2012-08-16 23:41:25 -04:00
|
|
|
}
|
|
|
|
# after ms script...
|
|
|
|
snippet af
|
|
|
|
after ${1:ms} ${2:#do something}
|
|
|
|
# after cancel id
|
|
|
|
snippet afc
|
|
|
|
after cancel ${1:id or script}
|
|
|
|
# after idle
|
|
|
|
snippet afi
|
|
|
|
after idle ${1:script}
|
|
|
|
# after info id
|
|
|
|
snippet afin
|
|
|
|
after info ${1:id}
|
|
|
|
# Expr
|
|
|
|
snippet exp
|
|
|
|
expr {${1:#expression here}}
|
|
|
|
# Switch
|
|
|
|
snippet sw
|
|
|
|
switch ${1:var} {
|
|
|
|
${3:pattern 1} {
|
|
|
|
${4:#do something}
|
|
|
|
}
|
|
|
|
default {
|
|
|
|
${2:#do something}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Case
|
|
|
|
snippet ca
|
|
|
|
${1:pattern} {
|
|
|
|
${2:#do something}
|
|
|
|
}${3}
|
|
|
|
# Namespace eval
|
|
|
|
snippet ns
|
|
|
|
namespace eval ${1:path} {${2:#script...}}
|
|
|
|
# Namespace current
|
|
|
|
snippet nsc
|
|
|
|
namespace current
|