To share your code snippets, you can create gists right from IntelliJ IDEA.
Creation of gists in IntelliJ IDEA requires that the following preconditions are fulfilled:
- In the editor, open the file that contains the snippet to be shared.
- Select the code snippet to be shared. If no selection is made, the gist will contain the entire file.
- Click the right mouse button anywhere in the editor and choose Create gist on the context menu.
In the Create Gist dialog box, that opens, provide a brief
description of the gist to be created
and configure the gist's visibility.
- By default, the new gist will be public, that is, visible for all registered users with your login displayed as owner. To accept this default behaviour, just click OK.
- To create a private gist that will be available for you only, select the Private check box.
- To make the gist available for all registered users without displaying your login, select the Anonymous check box.
- To have the gist opened in the default IntelliJ IDEA browser so you can edit it right now, select the Open in browser check box. When you click OK, the https://gist.github.com/ page, that opens, shows the new gist with the selection or the entire contents of the current file. By default, the gist is named after the file the gist originates from. To update the code snippet, if necessary, click Edit.
- If you do not want to open the gist right now, clear the Open in browser check box. IntelliJ IDEA displays the URL address of the gist so you you can access it later.