Book Image

IntelliJ IDEA Essentials

By : Jaroslaw Krochmalski
Book Image

IntelliJ IDEA Essentials

By: Jaroslaw Krochmalski

Overview of this book

Table of Contents (17 chapters)
IntelliJ IDEA Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Crafting your settings


In the next section, we will discuss the options of the IDE—setting keyboard shortcuts, colors, fonts, and plugins.

Searching for options

The settings dialog is available from the main menu by navigating to File | Settings (PC) or IntelliJ IDEA | Preferences (Mac). You can also use the wrench icon on the toolbar or Ctrl + Alt + S (PC) or cmd + , (Mac) keyboard shortcuts. All of the settings are divided into two groups: one for project-specific settings (such as code style, version control, and so on) and one for global, IDE settings (such as appearance or HTTP proxy, for example).

There are many options here. The good thing is you can use the search field to search for a specific option. Just start typing the option name and the dialog box will be searched from top to bottom to present you the result.

For example, if you introduce a "typo" in the search box, you will be presented with the Inspection project settings, where you can turn the Spelling/Typo inspection option off. In the Editor/Colors & Font/General section, you can change colors for misspelled words.

Setting keyboard shortcuts

IntelliJ IDEA is a keyboard-centric IDE. Any action you can do by using your mouse, you can do by using the keyboard as well.

It's possible to completely redefine default IntelliJ IDEA keymaps to suit your needs. The keyboard shortcuts configuration is available in the Keymap section in the IDE settings.

There are some predefined keymaps available. Whether you come from using Eclipse or NetBeans, you can find your well-known keymap here and apply it. Please note that predefined keymaps are not editable. To modify the keymap, you must create and edit a copy.

When defining a new keyboard shortcut, the Second Stroke keyboard shortcut editor feature is very useful. You can use this to set up double strokes, easy to remember keyboard shortcuts, or even shortcut groups. You can define your base shortcut, such as Ctrl + Shift + O for example, and then numbers as second strokes, as shown in the following screenshot:

The Abbreviation option in the keyboard shortcut editor is used to quickly find the Search Everything (double Shift) dialog box. The Search Everything dialog box will be discussed in Chapter 3, The Editor.

Colors and fonts

In IntelliJ IDEA, you can change your preferable colors and font's layout for syntax and error highlighting in the editor, search results, debugger, and consoles.

To do this, open Editor and then Colors & Fonts in the IDE settings dialog box.

IntelliJ IDEA comes with some predefined color schemes. You can select one of them, or create your own, and configure its settings to your liking.

Note that you are not allowed to change any of the predefined schemes. If you decide to tweak the existing theme, you have to copy it first. To change the editor font, select Font from the Colors & Fonts section of the IDE settings page.

Note

Many nice color themes can be found at http://www.ideacolorthemes.org.

For example, if you use the Darcula IDE theme, the Obsidian color scheme looks good, as shown in the following screenshot:

Tip

There is a truly great font designed especially for developers: Source Code Pro. This font family was created specifically for coding environments—it's very readable. It's available free of charge from Adobe, at GitHub https://github.com/adobe/source-code-pro.

You can download Source Code Pro for Windows, Linux, and OS X as well.

Picking your plugins

The IntelliJ IDEA plugin repository is available on the Internet at http://plugins.jetbrains.com/?idea or from the IDE itself, by going to the Plugins section in the Settings page. Going to the Plugins section in the IDE is more convenient in comparison to the Internet repository. All you have to do is find your plugin, install, and restart the IDE.

To install JetBrains' plugin, click on the Install JetBrains plugin… button. To install a third-party plugin, choose Browse repositories. In the next dialog box, you can filter the available plugins by category, or find a specific plugin just by typing its name.

Tip

You can sort the list of plugins by the download count or rating to see the most popular (and probably the most useful) plugins at the top of the list:

To deactivate the installed plugin, uncheck the checkbox next to its name. To uninstall the plugin, use the context menu, but take note that bundled JetBrains plugins cannot be uninstalled from within the IDE, as shown here:

Some of the plugins add new languages to the IntelliJ IDEA arsenal. If you develop in a language other than Java, just filter the plugins list using the Custom Languages option. When you install the plugins, the on-the-fly analysis, hints, and refactoring will be available in your IDE. These plugins include, for example, Scala, Python, Ruby, PHP, and many others.

The next huge group of plugins is available when you filter using Framework Integration. There is a big chance you will find support for the framework you use in your project, such as AngularJS or Play, for example.

If you are new to IntelliJ IDEA, there is a plugin that is especially useful called Key promoter. It will show you a banner with the keyboard shortcut for the action you just performed using the mouse. It will help you memorize keyboard shortcuts and quickly become a keyboard ninja:

Tip

Use the Key promoter plugin available in the plugins repository to see how easy you can make the same action you just did using your mouse, by only using your keyboard!

Feel free to browse JetBrains and the third-party plugins directory. It's a real gold mine to extend the IDE functionality. Select the plugin, read the description to the right, click on Install, restart the IDE, and you're all set.