Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Instagram Youtube

Github Stackoverflow Pinterest

This gives you more, free for Java users (who have Eclipse)


Overview

This section provides those new to IntelliJ a hands-on guided introduction.

Install

PROTIP: Before installing, create a folder that houses your various projects. I call mine “gits”. Some use “dev”. IntelliJ defaults to “IdeaProjects”.

  1. download a folder containing an IntelliJ .idea folder (see below).

    Complete Installation Folder

    PROTIP: The tilde character that Macs recognize as taking the place of folder path “/User/username”? It’s not recognized by IntelliJ.

https://www.jetbrains.com/help/idea/working-with-projects.html

  1. brew cask install intellij
  2. Open IntelliJ from your /Applications folder.
  3. Unless you have a file from a previous installation, choose “Do not import settings” and click OK.
  4. Accept the Privacy Policy.
  5. Many choose the “Dracula” theme because it’s healthier on the eyes.
  6. For compatibiity with Windows (most enterprises need this), select “I used IDEA before” to use the Mac’s control button and G to generate, and command key with N to Go to a class and with Y to delete a line.
  7. Use the launcher script at /usr/local/bin/idea. This path must be in the PATH variable as defined in file ~/.bash_profile.
  8. Click customize under Version Controls.
  9. Click Disable under Swing, Android, and Plugin Development unless you’ll be doing them.

  10. When the “Tip of the Day” dialog appears, most people un-check “Show Tips on Startup”.

  11. In the Project pane, expand a folder by clicking the arrow to the left of that folder.

Welcome screen

PROTIP: Look at how the most productive developers work and you’ll see that their hands stay on the keyboard and reach for the mouse much less frequently. This is why interviewers of developers ask “show me how you enter and exit Full Screen”.

### Key map

Apple’s keyboard: https://support.apple.com/en-us/HT201236

  1. Menu Help > Keymap Reference brings up a pdf file online.

  2. PROTIP: To prepare to refer to this while off-line, right-click and save the pdf to your Documents folder as “IntelliJIDEA_Keymap_Reference_Card.pdf”.

  3. Press command + tab to switch among apps until the Finder is highlighted. This opens Finder.
  4. Open the pdf.
  5. Press command + tab to switch between IntelliJ and the pdf shown by the Adobe app.
  6. Drag the corners to take the whole screen (so you don’t have to scroll).
  7. Hide the left navigation pane by clicking the black arrow in the vertical divider.
  8. Search text in the pdf.

    PROTIP: By investing time to try each keyboard shortcut, you will discover some that can save you time here and there that not only add up to time available for other things, but enable you to have a more enjoyable time using the software. For example:

    Project view filters

    In IntelliJ:

  9. command 1 (Alt 1 on Windows) hides and unhides the Project pane, for more space to code.

    NOTE: In the Project pane, the sort order is for files beginning with special characters. At the top of the list are files with a dot (period) which, in the Linux world, specifies a hidden file.

    File or folder names beginning with a capital letter are sorted below the same name in lower case.

    Full Screen Toggle

  10. In menu View, there is a Distraction Free Mode and Full Screen mode.

    intelij-views-1328x750

  11. Toggle to enter Full Screen view by holding control with your left thumb and command with your right thumb, then pressing F with your left hand.

    PROTIP: Some switch the control and command keys on the left side so that they can get to all such keys using thumbs, pressing two keys at once by pressing between the keys.

  12. Mouse up to the top edge exposes the menu bar again.
  13. Toggle to exit Full Screen view by pressing control + command + F

    Views

  14. Click the View selection “Project” for a drop-down of views:

    intellij-views-232x388

  15. Select to filter out.

Project

In each project making use of IntelliJ:

IntelliJ creates an .iml file to house basic module metadata for each discrete unit of functionality that can be independently run, tested, and debugged. Each IntelliJ module includes source code, build scripts, unit tests, deployment descriptors. It’s not related to “modules” in the Java language.

### Expand

The project opens with the cursor at the project name.

  1. To expand the list, press the right cursor.

  2. Keep pressing the right cursor to keep opening the hierarchy.

  3. Press the down cursor key to move down the list without expanding.

  4. Press the left cursor key to contract.

    Open

  5. Press Enter to open highlighted item.

    Search Everywhere

  6. For a search box to pop up, press a Shift keys twice quickly.

  7. Press the dowm cursor.

    Go To File Keys

  8. To invoke the “Got To File” key combination, while you have your left forefinger resting on the “F” key, hold down the shift key with your left pinkie. Then while your right forefinger on the J home key, hold down the command key. Now press N with your right forefinger.

.idea folder

Projects edited by IntelliJ contain a folder named .idea which IntelliJ creates in the root of each project because it is applicable to all the modules within the project.

modules.xml

misc.xml

.gitignore

Add to the .gitignore file:

.idea/workspace.xml

This file many ignore when pushing up to a shared repository because it contains personal preferences that can be different for each individual in the team.

See https://www.jetbrains.com/help/idea/configuring-ignored-files.html

Actions

Actions are automated by IntelliJ, such as Inspect code by pressing command+Z.

For a new, press control+N.

IntelliJ “Intentions” define the rules for flagging code inspectins.

Modules

Groovy is a programming language working within a JVM

Griffon is a desktop development platform working within a JVM

IntelliJ plug-ins are added to support languages such as Scala, Go, Dart, Erlang, Python, JPython, etc.

Code Inspection

https://github.com/bentolor/idea-cli-inspector

Kotlin

Kotlin is a programming language invented by JetBrains (the owner of IntelliJ)

https://kotlinlang.org/docs/tutorials/getting-started.html

Tutorials

https://app.pluralsight.com/library/courses/intellij-ce-getting-started/table-of-contents Getting Started with IntelliJ CE 2h 47m Released1 Sep 2017 by David Starr (@elegantcoder, ElegantCode.com)

https://www.jetbrains.com/help/idea/discover-intellij-idea.html

https://medium.com/@andrey_cheptsov/intellij-idea-pro-tips-6da48acafdb7

IntelliJ IDE Automation

IntelliJ IDEA from Jetbrains, the free Community Edition (CE), provides check-boxes to activate Git hooks.

git intellij before commit 302x418-87kb

PROTIP: We don’t see how to get to Version Control in IntelliJ on videos because it’s often accessed via a hotkey - Apple command 9 on macs and Alt+9 on Windows.

See https://www.youtube.com/watch?v=V8KSaQKgR1Y for VCS improvements in IntelliJ 2016.3.

Let’s use a sample project that already has .idea folder containing files that define configurations for IntelliJ.

IntelliJ has a project wizard to start from scratch on various languages.

But Andrew Krug’s Java example also has integration with testing utilities.