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