IntelliJ IDEA: code snippet auto-complete

In this tutorial I will show how to create auto-complete snippets using IntelliJ IDEA. This is a very convenient for such things as copyright information that I need to include in clients' files.



Step: Create snippet

Open Preferences > "Live Templates" > Click "+" > Create "Java > copyright" as shown in the screenshot
Abbreviation will be the keyword you will use to trigger the completion.



Step: Set what it is applicable to

Mark it for Java and XML (or any other files you may want to)


Step: Use the abbreviation



In your code start typing "copyright" and the auto-completion will suggest the right snippet.



/*
 * Copyright (C) 2014 CNH Industrial NV. All rights reserved.
 *
 * This software contains proprietary information of CNH Industrial NV. Neither
 * receipt nor possession thereof confers any right to reproduce, use, or
 * disclose in whole or in part any such information without written
 * authorization from CNH Industrial NV.
 *
 */
package com.cnh....


I hope this will save you some time!

It take time and effort to create tutorials, please support my efforts with a couple dollar donation, any amount will be greatly appreciated!



As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles