diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-27 15:32:50 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-27 15:32:50 -0200 |
commit | 5032aca04f4d0bce092ade66fe914c34af357a5e (patch) | |
tree | 3ba885989ff09b1ab3eb0a16ac865e797c8ca0e7 /vim.dot.link/snippets/cpp.snippets | |
download | vim-5032aca04f4d0bce092ade66fe914c34af357a5e.tar.gz vim-5032aca04f4d0bce092ade66fe914c34af357a5e.tar.bz2 |
Initial import
Diffstat (limited to 'vim.dot.link/snippets/cpp.snippets')
-rw-r--r-- | vim.dot.link/snippets/cpp.snippets | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vim.dot.link/snippets/cpp.snippets b/vim.dot.link/snippets/cpp.snippets new file mode 100644 index 0000000..e4850cd --- /dev/null +++ b/vim.dot.link/snippets/cpp.snippets @@ -0,0 +1,30 @@ +# Read File Into Vector +snippet readfile + std::vector<char> v; + if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), $2)) + v.insert(v.end(), buf, buf + len); + fclose($2); + }${3} +# std::map +snippet map + std::map<${1:key}, ${2:value}> map${3}; +# std::vector +snippet vector + std::vector<${1:char}> v${2}; +# Namespace +snippet ns + namespace ${1:`Filename('', 'my')`} { + ${2} + } /* $1 */ +# Class +snippet cl + class ${1:`Filename('$1_t', 'name')`} { + public: + $1 (${2:arguments}); + virtual ~$1 (); + + private: + ${3:/* data */} + }; |