Skip to content

Commit cb7864b

Browse files
author
acustodioo
committed
Primeiro commit
0 parents  commit cb7864b

40 files changed

+6196
-0
lines changed

all.snippets

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This file contains snippets that are always defined. I personally
2+
# have snippets for signatures and often needed texts
3+
4+
##############
5+
# NICE BOXES #
6+
##############
7+
global !p
8+
import string, vim
9+
def _parse_comments(s):
10+
i = iter(s.split(","))
11+
12+
rv = []
13+
try:
14+
while True:
15+
n = i.next()
16+
if n[0] == 's':
17+
ctriple = []
18+
indent = ""
19+
if n[1] in string.digits:
20+
indent = " " * int(n[1])
21+
ctriple.append(n.split(":",1)[1])
22+
n = i.next()
23+
assert(n[0] == 'm')
24+
ctriple.append(n.split(":",1)[1])
25+
n = i.next()
26+
assert(n[0] == 'e')
27+
ctriple.append(n.split(":",1)[1])
28+
ctriple.append(indent)
29+
rv.append(ctriple)
30+
elif n[0] == 'b':
31+
cm = n.split(":", 1)[1]
32+
if len(cm) == 1:
33+
rv.insert(0, (cm,cm,cm, ""))
34+
except StopIteration:
35+
return rv
36+
37+
def make_box(twidth, bwidth = None):
38+
if bwidth is None:
39+
bwidth = twidth + 2
40+
b,m,e,i = _parse_comments(vim.eval("&comments"))[0]
41+
sline = b + m + bwidth*m + 2*m
42+
nspaces = (bwidth - twidth)//2
43+
mlines = i + m + " " + " "*nspaces
44+
mlinee = " " + " "*(bwidth-twidth-nspaces) + m
45+
eline = i + 2*m + bwidth*m + m + e
46+
return sline, mlines, mlinee, eline
47+
endglobal
48+
49+
snippet box "A nice box with the current comment symbol" b
50+
`!p
51+
box = make_box(len(t[1]))
52+
snip.rv = box[0] + '\n' + box[1]
53+
`${1:content}`!p
54+
box = make_box(len(t[1]))
55+
snip.rv = box[2] + '\n' + box[3]`
56+
$0
57+
endsnippet
58+
59+
snippet bbox "A nice box over the full width" b
60+
`!p
61+
box = make_box(len(t[1]), 71)
62+
snip.rv = box[0] + '\n' + box[1]
63+
`${1:content}`!p
64+
box = make_box(len(t[1]), 71)
65+
snip.rv = box[2] + '\n' + box[3]`
66+
$0
67+
endsnippet
68+
69+
##########################
70+
# LOREM IPSUM GENERATORS #
71+
##########################
72+
snippet lorem "Lorem Ipsum - 50 Words" w
73+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
74+
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
75+
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
76+
no sea takimata sanctus est Lorem ipsum dolor sit amet.
77+
endsnippet
78+
79+
# vim:ft=snippets:

bindzone.snippets

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
global !p
2+
def newsoa():
3+
import datetime
4+
now = datetime.datetime.now()
5+
# return standard SOA formatted serial for today
6+
return now.strftime("%Y%m%d00")
7+
endglobal
8+
9+
snippet zone "Bootstrap a new Bind zonefile" b
10+
$TTL 86400
11+
@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.(
12+
`!p snip.rv = newsoa()`; serial
13+
21600; refresh every 6 hours
14+
3600; retry after one hour
15+
604800; expire after a week
16+
86400 ); minimum TTL of 1 day
17+
18+
IN NS ns01.$1.
19+
IN MX 10 mail.$1.
20+
21+
ns01.$1 IN A
22+
mail.$1 IN A
23+
endsnippet
24+
25+
snippet A "Insert A Record" b
26+
${1:hostname} IN A ${2:ip}
27+
endsnippet

c.snippets

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
2+
###########################################################################
3+
# TextMate Snippets #
4+
###########################################################################
5+
snippet def "#ifndef ... #define ... #endif"
6+
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
7+
#define ${1:SYMBOL} ${2:value}
8+
#endif
9+
endsnippet
10+
11+
snippet #if "#if #endif" !b
12+
#if ${1:0}
13+
${VISUAL:code}$0
14+
#endif
15+
endsnippet
16+
17+
snippet inc "#include local header (inc)"
18+
#include "${1:`!p snip.rv = snip.basename + '.h'`}"
19+
endsnippet
20+
21+
snippet Inc "#include <> (Inc)"
22+
#include <${1:.h}>
23+
endsnippet
24+
25+
snippet mark "#pragma mark (mark)"
26+
#if 0
27+
${1:#pragma mark -
28+
}#pragma mark $2
29+
#endif
30+
31+
$0
32+
endsnippet
33+
34+
snippet main "main() (main)"
35+
int main(int argc, char const *argv[])
36+
{
37+
${0:/* code */}
38+
return 0;
39+
}
40+
endsnippet
41+
42+
snippet for "for int loop (fori)"
43+
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
44+
{
45+
${0:/* code */}
46+
}
47+
endsnippet
48+
49+
snippet enum "Enumeration"
50+
enum ${1:name} { $0 };
51+
endsnippet
52+
53+
snippet once "Include header once only guard"
54+
#ifndef ${1:`!p
55+
if not snip.c:
56+
import random, string
57+
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
58+
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
59+
snip.rv = ('%s_%s' % (name,rand)).upper()
60+
else:
61+
snip.rv = snip.c`}
62+
#define $1
63+
64+
${0}
65+
66+
#endif /* end of include guard: $1 */
67+
68+
endsnippet
69+
70+
snippet td "Typedef"
71+
typedef ${1:int} ${2:MyCustomType};
72+
endsnippet
73+
74+
snippet do "do...while loop (do)"
75+
do {
76+
${0:/* code */}
77+
} while(${1:/* condition */});
78+
endsnippet
79+
80+
snippet fprintf "fprintf ..."
81+
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
82+
endsnippet
83+
84+
snippet if "if .. (if)"
85+
if (${1:/* condition */})
86+
{
87+
${0:/* code */}
88+
}
89+
endsnippet
90+
91+
snippet printf "printf .. (printf)"
92+
printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
93+
endsnippet
94+
95+
snippet st "struct"
96+
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
97+
{
98+
${0:/* data */}
99+
};
100+
endsnippet
101+
102+
# vim:ft=snippets:

coffee.snippets

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# From the TextMate bundle
2+
3+
snippet fun "Function" b
4+
${1:name} = (${2:args}) ->
5+
${0:# body...}
6+
endsnippet
7+
8+
snippet bfun "Function (bound)" b
9+
${1:(${2:args}) }=>
10+
${0:# body...}
11+
endsnippet
12+
13+
snippet if "If" b
14+
if ${1:condition}
15+
${0:# body...}
16+
endsnippet
17+
18+
snippet ife "If .. Else" b
19+
if ${1:condition}
20+
${2:# body...}
21+
else
22+
${3:# body...}
23+
endsnippet
24+
25+
snippet elif "Else if" b
26+
else if ${1:condition}
27+
${0:# body...}
28+
endsnippet
29+
30+
snippet ifte "Ternary if" b
31+
if ${1:condition} then ${2:value} else ${3:other}
32+
endsnippet
33+
34+
snippet unl "Unless" b
35+
${1:action} unless ${2:condition}
36+
endsnippet
37+
38+
snippet fora "Array Comprehension" b
39+
for ${1:name} in ${2:array}
40+
${0:# body...}
41+
endsnippet
42+
43+
snippet foro "Object Comprehension" b
44+
for ${1:key}, ${2:value} of ${3:Object}
45+
${0:# body...}
46+
endsnippet
47+
48+
snippet forr "Range Comprehension (inclusive)" b
49+
for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step}}
50+
${0:# body...}
51+
endsnippet
52+
53+
snippet forrex "Range Comprehension (exclusive)" b
54+
for ${1:name} in [${2:start}...${3:finish}]${4: by ${5:step}}
55+
${0:# body...}
56+
endsnippet
57+
58+
snippet swi "Switch" b
59+
switch ${1:object}
60+
when ${2:value}
61+
${0:# body...}
62+
endsnippet
63+
64+
snippet cla "Class" b
65+
class ${1:ClassName}${2: extends ${3:Ancestor}}
66+
67+
${4:constructor: (${5:args}) ->
68+
${6:# body...}}
69+
$7
70+
endsnippet
71+
72+
snippet try "Try .. Catch" b
73+
try
74+
$1
75+
catch ${2:error}
76+
$3
77+
endsnippet
78+
79+
snippet req "Require" b
80+
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
81+
endsnippet
82+
83+
snippet # "Interpolated Code"
84+
#{$1}$0
85+
endsnippet
86+
87+
snippet log "Log" b
88+
console.log ${1:"${2:msg}"}
89+
endsnippet
90+

0 commit comments

Comments
 (0)