diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2014-03-13 10:40:19 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2014-03-13 10:40:19 +0100 |
commit | 77a122f0581d02845d8c7f0c1b889984a2627a35 (patch) | |
tree | cc77d8478ebea02b5c46b819639c5e1cae26565f /.vim/snippets/cpp.snippets | |
parent | 5712528bbf80bb8f7b79ea5cdb94314659addba7 (diff) |
Add snipMate
Diffstat (limited to '.vim/snippets/cpp.snippets')
-rw-r--r-- | .vim/snippets/cpp.snippets | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/.vim/snippets/cpp.snippets b/.vim/snippets/cpp.snippets new file mode 100644 index 0000000..30f57fd --- /dev/null +++ b/.vim/snippets/cpp.snippets @@ -0,0 +1,43 @@ +# 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}; +# std::shared_ptr +snippet shared + std::shared_ptr<${1:type}> ptr${2}; +# std::unique_ptr +snippet unique + std::unique_ptr<${1:type}> ptr${2}; +# std::weak_ptr +snippet weak + std::weak_ptr<${1:type}> ptr${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 */} + }; +snippet fori + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + } |