Small config and highlightning changes
[my-vim-dotfolder.git] / snippets / cpp.snippets
blobe4850cd207d5ec56cb4b0caaa22f09d4c10dd943
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         };