From c133679866955d64762c1fc2befbdd296b569ea1 Mon Sep 17 00:00:00 2001 From: Laurent Georget Date: Sat, 2 Apr 2016 11:15:17 +0200 Subject: [PATCH] C++: Add a snippet to generate an entire .h skeleton --- UltiSnips/cpp.snippets | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/UltiSnips/cpp.snippets b/UltiSnips/cpp.snippets index c2cb3d0..f7c2bd8 100644 --- a/UltiSnips/cpp.snippets +++ b/UltiSnips/cpp.snippets @@ -54,4 +54,20 @@ snippet tp "template (template)" template endsnippet +snippet cla "An entire .h generator" b +#ifndef ${2:`!v substitute(vim_snippets#Filename('$1_H','ClassName'),'.*','\U&\E','')`} +#define $2 + +class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`} +{ +private: + ${3} + +public: + $1(); + virtual ~$1(); +}; + +#endif /* $2 */ +endsnippet # vim:ft=snippets: