neosnippet.vim/neosnippets/cpp.snip

106 lines
2.1 KiB
Plaintext
Raw Normal View History

2012-02-02 04:33:35 +00:00
include c.snip
2013-12-19 10:02:11 +00:00
# #include <...>
snippet inc
alias #inc, #include
#include <${1:iostream}>${0}
# #include "..."
snippet inc2
alias #inc2, #include2
#include "${1}"${0}
2012-02-02 04:33:35 +00:00
snippet template
abbr template <T>
template<typename ${1:T}>
snippet class
abbr class {}
class ${1:#:name} {
${2}
public:
$1(${3});
};
$1::$1($3) {
${0:TARGET}
}
snippet class-without-constructor
2012-02-02 04:33:35 +00:00
abbr class {}
2012-10-30 08:53:14 +00:00
class ${1:#:name} {
2012-02-02 04:33:35 +00:00
${2}
};
snippet try
abbr try catch
try {
2012-10-30 08:53:14 +00:00
${1:TARGET}
} catch (${2:e:xception}) {
2012-02-02 04:33:35 +00:00
${3}
}
# range based for ( C++11 feature )
snippet for_CPP11
abbr for (:) {}
2012-10-30 08:53:14 +00:00
for (${1:#:var} : ${2:#:container}) {
${0:TARGET}
2012-02-02 04:33:35 +00:00
}
# range based for ( C++11 feature )
snippet for_CPP11_const_auto
for (const auto &${1:#:var} : ${2:#:container}) {
${0:TARGET}
}
2012-02-02 04:33:35 +00:00
# lambda expression ( C++11 feature )
snippet lambda
abbr [](){}
2012-10-30 08:53:14 +00:00
[${1}](${2})${3}{ ${4:TARGET} }
2012-02-02 04:33:35 +00:00
# scoped enumeration ( C++11 feature )
snippet enum_scoped
abbr enum struct {}
2012-10-30 08:53:14 +00:00
enum struct { ${1:TARGET} }
2012-02-02 04:33:35 +00:00
# static assert ( C++11 feature )
snippet static_assert
abbr static_assert(,"")
static_assert( ${1}, "${2}" );${0}
delete namespace
snippet namespace
abbr namespace {}
2012-10-21 12:13:26 +00:00
options head
namespace ${1:#:name} {
2012-10-30 08:53:14 +00:00
${0:TARGET}
} // namespace $1
snippet static_cast
abbr static_cast<>()
static_cast<${1}>(${2})${0}
snippet reinterpret_cast
abbr reinterpret_cast<>()
reinterpret_cast<${1}>(${2})${0}
snippet const_cast
abbr const_cast<>()
const_cast<${1}>(${2})${0}
snippet dynamic_cast
abbr dynamic_cast<>()
dynamic_cast<${1}>(${2})${0}
2012-10-16 06:05:24 +00:00
2012-10-30 08:53:14 +00:00
snippet helloworld
abbr #include<iostream> int main...
2012-10-16 06:05:24 +00:00
#include <iostream>
2012-10-16 06:05:24 +00:00
int main(int argc, char const* argv[])
{
std::cout << "hello, world!" << std::endl;
2012-10-16 06:05:24 +00:00
return 0;
}
2012-10-30 08:53:14 +00:00
snippet p
options head
std::cout << ${0:TARGET} << std::endl;