Using Code Templates

See Also

The Source Editor has a set of customizable code templates for common snippets of C and C++ code. The code templates are assigned abbreviations to identify them. You type an abbreviation in your source file, press the Tab key, and the code snippet from the template is inserted in the file. You can modify, create, or remove code templates.

To insert a code snippet from a template:

To view all the defined code templates:

To customize the list of code templates:

  1. Choose Tools > Options.
  2. Click Editor and select the Code Templates tab.
  3. Select the language of the code templates you want to customize.
  4. If you want to change a code template, select a code template from list and edit the Expanded Text field in the bottom panel.
  5. If you want to add a new code template, click New.
  6. You can use the Expand Template On list to change the key or key combination that expands the abbreviations. By default, abbreviations are expanded when you press Tab. The Expand Template On list also contains the options of Space, Shift-Space, and Enter.
See Also
Using Code Completion

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.