Simple C++ snippets
- decltype(expression)
- typeof(type)/ typeof expression - GNU extension
- alignas(expression) or _Alignas(expression)
- static_assert(expression, message); or _Static_assert(expression, message); - we complete static_assert(<cursor>);
- asm(string-literal)
- try { statements }
- if (condition)
- if constexpr (condition)
- else if (condition)
- constexpr (condition) - after existing if
- while (condition)
- public:
- private:
- protected:
- default:
- do { statemants }
- for (expressions)
- continue;
- break;
- return; or return expression; or return true; or return false; or return nullptr;
- typeid(expression-or-type)
- throw expression
- alignof(type)
- noexcept(expression)
- sizeof(expression-or-type)
- sizeof...(parameter-pack)
- _Generic(controlling-expression, association-list)
- alignas(expression)
- #if condition
- #ifdef macro
- #ifndef macro
- #elif condition
- #include "header"
- #include <header>
- #include_next "header"
- #include_next <header>
- #define macro
- #undef macro
- #line number
- #error message
- #warning message
- #pragma arguments
- defined(macro) - after #if
- pop_macro("") - after #pragma
- push_macro("") - after #pragma
Simple Objective-C snippets
- #import "header"
- #import <header>
- (__bridge <type>)<expression>
- (__bridge_transfer <Objective-C type>)<expression>
- (__bridge_retained <CF type>)<expression>
- @dynamic property
- @synthesize property
- @class name
- @interface name
- @protocol name
- @implementation name
- @compatibility_alias name
- @import name
- @encode ( type-name )
- @protocol ( protocol-name )
- @selector ( selector )
- @"string"
- @[objects, ...]
- @{key : object, ...}
- @(expression)
- @try { statements }
- @throw
- @synchronized ( expression ) { statements }
- setter, getter
- IBAction)<#selector#>:(id)sender
- -(id)objectInKeyAtIndex:(NSUInteger)index
Snippets as live templates
Just start typing a keyword, select the snippet from the completion list, and use the Tab key to move the cursor between stubs (in [ ]).
- typedef [type] [name];
- using [name] [type];
- namespace [name] = [namespace];
- using namespace [identifier];
- using [qualifier]::[name];
- using typename [qualifier]::[name];
- template<class [name]>
- template<typename [name]>
- switch ([condition]) { [cases] } - cursor in [cases] ends the live template
- case [expression]:
- goto [label];
- dynamic_cast<[type]>([expression])
- static_cast<[type]>([expression])
- reinterpret_cast<[type]>([expression])
- const_cast<[type]>([expression])
- catch ([declaration]) { [statements] } - cursor in [statements] ends the live template
- concept [name] = [constraint];
- #define [macro]([args])