From 072f7a47ca71fac6b5156a4b807d89ae4c3e8a49 Mon Sep 17 00:00:00 2001 From: ujihisa Date: Sun, 29 Dec 2013 19:55:17 -0800 Subject: [PATCH] Improve c+ snippets (class, for-in, and misc) --- neosnippets/cpp.snip | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/neosnippets/cpp.snip b/neosnippets/cpp.snip index 4c42cef..639c067 100644 --- a/neosnippets/cpp.snip +++ b/neosnippets/cpp.snip @@ -14,6 +14,17 @@ abbr template template snippet class +abbr class {} + class ${1:#:name} { + ${2} + public: + $1(${3}); + }; + $1::$1($3) { + ${0:TARGET} + } + +snippet class-without-constructor abbr class {} class ${1:#:name} { ${2} @@ -34,6 +45,12 @@ abbr for (:) {} ${0:TARGET} } +# range based for ( C++11 feature ) +snippet for_CPP11_const_auto + for (const auto &${1:#:var} : ${2:#:container}) { + ${0:TARGET} + } + # lambda expression ( C++11 feature ) snippet lambda abbr [](){} @@ -76,10 +93,13 @@ abbr dynamic_cast<>() snippet helloworld abbr #include int main... #include + int main(int argc, char const* argv[]) { - using namespace std; - cout << "hello, world!" << endl; + std::cout << "hello, world!" << std::endl; return 0; } +snippet p +options head + std::cout << ${0:TARGET} << std::endl;