From 2f30c8c83e5f9b544a03f60efbc7960d276c5198 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 16 Oct 2012 14:55:50 +0900 Subject: [PATCH 1/3] Added C++ snippets - static_cast ( this is C++11 feature ) - namespace - new casts --- autoload/neosnippet/snippets/cpp.snip | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/autoload/neosnippet/snippets/cpp.snip b/autoload/neosnippet/snippets/cpp.snip index 6382791..3f18292 100644 --- a/autoload/neosnippet/snippets/cpp.snip +++ b/autoload/neosnippet/snippets/cpp.snip @@ -35,3 +35,31 @@ snippet enum_scoped abbr enum struct {} enum struct { ${1} } +# static assert ( C++11 feature ) +snippet static_assert +abbr static_assert(,"") + static_assert( ${1}, "${2}" );${0} + +delete namespace +snippet namespace +abbr namespace {} +prev_word '^' + namespace ${1:name} + ${0} + } // 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} From 776b5801a3ff3bade1c05b906d4d89ef0060b86f Mon Sep 17 00:00:00 2001 From: ujihisa Date: Mon, 15 Oct 2012 22:06:45 -0700 Subject: [PATCH 2/3] improved lua snip --- autoload/neosnippet/snippets/lua.snip | 13 ++++++++++--- doc/neosnippet.txt | 5 ++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/autoload/neosnippet/snippets/lua.snip b/autoload/neosnippet/snippets/lua.snip index 5389f1b..bcd319d 100644 --- a/autoload/neosnippet/snippets/lua.snip +++ b/autoload/neosnippet/snippets/lua.snip @@ -1,8 +1,9 @@ +# lua's indent plugin doesn't work well partly with markers. Use hard-tab for some of this snippet. snippet func alias function - function ${1:function_name}(${2:argument}) - ${0:// body...} - end + function ${1:function_name}(${2:argument}) + ${0:// body...} + end snippet if if (${1:true}) then @@ -18,3 +19,9 @@ snippet forin for ${2:k}, ${3:v} in ${1:ipairs(xs)} do ${0} end + +snippet print_table +abbr for k, v in ipairs(table) do + for (k, v) in ipairs(${1:table}) do + print(k, v) + end diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index dfd76fb..55add93 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -2,7 +2,7 @@ neo-snippet plugin contains neocomplcache snippets source Version: 3.0 -Author : Shougo +Author: Shougo License: MIT license {{{ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -409,6 +409,9 @@ snippet *neosnippet-unite-action-snippet* ============================================================================== CHANGELOG *neosnippet-changelog* +2012-10-15 +- Improved lua snip. + 2012-10-07 - Improved vim snip. - Improved c snip. From b5afaa33634418d2d5dec8b0ee6e17664c670fe6 Mon Sep 17 00:00:00 2001 From: ujihisa Date: Mon, 15 Oct 2012 23:05:24 -0700 Subject: [PATCH 3/3] Improved C++ snip --- autoload/neosnippet/snippets/cpp.snip | 10 ++++++++++ doc/neosnippet.txt | 1 + 2 files changed, 11 insertions(+) diff --git a/autoload/neosnippet/snippets/cpp.snip b/autoload/neosnippet/snippets/cpp.snip index 3f18292..53d8256 100644 --- a/autoload/neosnippet/snippets/cpp.snip +++ b/autoload/neosnippet/snippets/cpp.snip @@ -63,3 +63,13 @@ abbr const_cast<>() snippet dynamic_cast abbr dynamic_cast<>() dynamic_cast<${1}>(${2})${0} + +snippet helloworld +abbr #include\nint main... + #include + int main(int argc, char const* argv[]) + { + using namespace std; + cout << "hello, world!" << endl; + return 0; + } diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index 55add93..f2d0adb 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -411,6 +411,7 @@ CHANGELOG *neosnippet-changelog* 2012-10-15 - Improved lua snip. +- Improved c++ snip. 2012-10-07 - Improved vim snip.