]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/snippets/cpp.snippets
Remove prezto
[rbdr/dotfiles] / vim / snippets / cpp.snippets
1 # Read File Into Vector
2 snippet readfile
3 std::vector<char> v;
4 if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) {
5 char buf[1024];
6 while (size_t len = fread(buf, 1, sizeof(buf), $2))
7 v.insert(v.end(), buf, buf + len);
8 fclose($2);
9 }${3}
10 # std::map
11 snippet map
12 std::map<${1:key}, ${2:value}> map${3};
13 # std::vector
14 snippet vector
15 std::vector<${1:char}> v${2};
16 # Namespace
17 snippet ns
18 namespace ${1:`Filename('', 'my')`} {
19 ${2}
20 } /* $1 */
21 # Class
22 snippet cl
23 class ${1:`Filename('$1_t', 'name')`} {
24 public:
25 $1 (${2:arguments});
26 virtual ~$1 ();
27
28 private:
29 ${3:/* data */}
30 };
31 snippet fori
32 for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
33 ${4:/* code */}
34 }