1
0
Fork 0
mirror of synced 2024-12-23 15:23:21 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/tcl.snippets

97 lines
1.4 KiB
Text
Raw Normal View History

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