]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/snippets/tcl.snippets
Add license
[rbdr/dotfiles] / vim / snippets / tcl.snippets
CommitLineData
0d23b6e5
BB
1# #!/usr/bin/env tclsh
2snippet #!
3 #!/usr/bin/env tclsh
4
5# Process
6snippet pro
7 proc ${1:function_name} {${2:args}} {
8 ${3:#body ...}
9 }
10#xif
11snippet xif
12 ${1:expr}? ${2:true} : ${3:false}
13# Conditional
14snippet if
15 if {${1}} {
16 ${2:# body...}
17 }
18# Conditional if..else
19snippet ife
20 if {${1}} {
21 ${2:# body...}
22 } else {
23 ${3:# else...}
24 }
25# Conditional if..elsif..else
26snippet ifee
27 if {${1}} {
28 ${2:# body...}
29 } elseif {${3}} {
30 ${4:# elsif...}
31 } else {
32 ${5:# else...}
33 }
34# If catch then
35snippet ifc
36 if { [catch {${1:#do something...}} ${2:err}] } {
37 ${3:# handle failure...}
38 }
39# Catch
40snippet catch
41 catch {${1}} ${2:err} ${3:options}
42# While Loop
43snippet wh
44 while {${1}} {
45 ${2:# body...}
46 }
47# For Loop
48snippet for
49 for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {
50 ${4:# body...}
51 }
52# Foreach Loop
53snippet fore
54 foreach ${1:x} {${2:#list}} {
55 ${3:# body...}
56 }
57# after ms script...
58snippet af
59 after ${1:ms} ${2:#do something}
60# after cancel id
61snippet afc
62 after cancel ${1:id or script}
63# after idle
64snippet afi
65 after idle ${1:script}
66# after info id
67snippet afin
68 after info ${1:id}
69# Expr
70snippet exp
71 expr {${1:#expression here}}
72# Switch
73snippet sw
74 switch ${1:var} {
75 ${3:pattern 1} {
76 ${4:#do something}
77 }
78 default {
79 ${2:#do something}
80 }
81 }
82# Case
83snippet ca
84 ${1:pattern} {
85 ${2:#do something}
86 }${3}
87# Namespace eval
88snippet ns
89 namespace eval ${1:path} {${2:#script...}}
90# Namespace current
91snippet nsc
92 namespace current