Skip to content

Latest commit

 

History

History
476 lines (367 loc) · 22 KB

intellij.md

File metadata and controls

476 lines (367 loc) · 22 KB

IntelliJ IDEA

https://www.jetbrains.com/idea/

The best IDE ever for coding in my opinion.

Feature rich and easy to use - the opposite end of vim!

IntelliJ IDEA vs PyCharm

If you're only doing Python then you may want to just get PyCharm.

If you're a serious experienced programmer or 'DevOps' you're probably a polyglot programmer who edits other files.

In that case stick to full IntelliJ with plugins (see Plugins section further down).

Plugins supported in PyCharm are usually also compatible with IntelliJ IDEA too as they're based on the same IDE framework by IntelliJ.

Install

Download link

brew install intellij-idea-ce

Settings Sync

Make sure to sync settings to JetBrains.

Settings -> Settings Sync -> Enable Settings Sync

Choose JetBrains (log in with GitHub account or other social login).

Set Web Browser

Defaults to following the system default browser.

IntelliJ -> Settings -> Tools -> Web Browsers and Preview

Distraction Free Mode

Hides all bars, max code space:

View -> Appearance -> Enter Distraction Free Mode

Shortcuts

The Ultimate Shortcut

Cmd-Shift-A

This will allow you to type to search and find any action and hit enter to open it, such as a settings page, but it also shows the actual configured keyboard shortcut for things like commenting out a line.

This is useful because the internet is often wrong on the shortcuts depending on whether your're on Windows / Mac or different versions.

This is the authoritative shortcut of what your local keyboard shortcuts really are.

Keyboard Shortcuts

Alternative Keys when you see Windows vs Mac keyboard shortcuts:

Windows Mac
Ctrl Cmd
Alt Option
Ctrl-Alt Cmd-Option
Command Description
Cmd-; Project Dialog configure JDK
Cmd-, Settings dialogue
Ctrl-Shift-T detect + put handlers around select code block
Ctrl-Alt-T select, Ctrl-W (to increase selection), Right-click -> Surround With -> if, try/catch (finds + adds all exceptions), synchronized ...
Ctrl-W increase selection
Ctrl-N open class by name
Ctrl-Shift-N open file by name
Ctrl-Space autocomplete
Alt-F7 find all places class/variable/method under cursor is used
Ctrl-Q show doc for class/method under cursor
Ctrl-B jump to declaration
Ctrl-Alt-B jump to Abstract Method's implementation
Ctrl-F6 rename all locations of selected variable/method/class (Refactor -> Rename)
Ctrl-F12 show methods of class to jump to
Ctrl-Shift-Space prompt for available methods/variables or objects of type if type specified on left
Ctrl-P in parens() opens pop-up list of valid parameters
Ctrl-I implements methods for class interface
Ctrl-O overrides method of class
Alt-Insert / Code -> Generate creates setters + getters
Shift-F1 / View -> External Document opens in browser

Code completion Tab to replace rest of name rather than Enter.

Shortcuts differ between Windows and Mac, and even between versions.

Plugins

You can use this command (doc) to install plugins quickly from the command line:

idea installPlugins "$plugin_name_or_id"

You must exit IntelliJ before running this as only one idea program can be running at a time.

Scripted Plugin Install

These can be installed all in one shot using the script install_intellij_plugins.sh in the DevOps-Bash-tools repo:

install_intellij_plugins.sh

You can add / comment / uncomment which plugins to install in the adjacent setup/intellij-plugins.txt config file in that same repo.

Readme Card

Manual Plugin Installation

Can download plugin zips + install from disk where direct internet/proxy access is blocked (eg. banks).

Zips must align to IntelliJ version.

Docker, Kubernetes and Terraform

idea installPlugins \
  Docker \
  org.intellij.plugins.hcl
  #com.intellij.kubernetes  # only available in Ultimate Edition :-(

Languages

idea installPlugins \
  com.jetbrains.sh \
  BashSupport \
  com.perl5 \
  com.ypwang.plugin.go-linter \
  org.jetbrains.intellij.scripting-ruby

Core Editing, Git & File Formats

idea installPlugins \
  mobi.hsz.idea.gitignore \
  org.editorconfig.editorconfigjetbrains \
  uk.co.ben-gibson.remote.repository.mapper \
  zielu.gittoolbox \
  net.vektah.codeglance \
  GrepConsole \
  com.clutcher.comments_highlighter \
  BrowseWordAtCaret \
  net.seesharpsoft.intellij.plugins.csv \
  com.godwin.json.parser \
  de.netnexus.camelcaseplugin \
  org.intellij.RegexpTester \
  DBN \
  com.vladsch.idea.multimarkdown \
  com.ultrahob.zerolength.plugin \
  ru.adelf.idea.dotenv \
  "String Manipulation" \
  izhangzhihao.rainbow.brackets \
  com.andrey4623.rainbowcsv \
  indent-rainbow.indent-rainbow \
  com.github.lppedd.idea-return-highlighter

Usage Stats

idea installPlugins \
  com.wakatime.intellij.plugin \
  com.softwareco.intellij.plugin \
  Statistic \

Cloud

idea installPlugins \
  aws.toolkit \
  com.microsoft.tooling.msservices.intellij.azure \
  com.google.gct.core

CI/CD

idea installPlugins \
  com.github.mikesafonov.jenkins-linter-idea-plugin \
  'Jenkins Control Plugin' \
  org.intellij.groovy \
  "Jetbrains TeamCity Plugin" \
  io.snyk.snyk-intellij-plugin \
  org.sonarlint.idea  # use with SonarQube / SonarCloud

Optional - Nice to Haves

idea installPlugins \
  training \
  "Key Promoter X" \
  com.chrisrm.idea.MaterialThemeUI \
  lermitage.intellij.extra.icons \
  com.mallowigi \
  com.github.shiraji.yaemoji
  #"Mongo Plugin"  # who uses Mongo any more?

Python

idea installPlugins \
  PythonCore \
  ru.meanmail.plugin.requirements \
  com.leinardi.pycharm.pylint \
  com.leinardi.pycharm.mypy \
  io.github.donkirkby.livepycharm \
  com.pythondce \
  org.tonybaloney.security.pycharm-security \
  ru.meanmail.plugin.pyannotations

For IntelliJ Ultimate swap PythonCore for Pythonid.

JavaScript

idea installPlugins \
  NodeJS \
  com.wix.eslint \
  intellij.prettierJS
  quokka.js \

Java / Groovy / Scala / Kotlin & JVM Tools

idea installPlugins \
  org.intellij.scala \
  org.jetbrains.kotlin \
  MavenRunHelper \
  SBT \
  com.intellij.gradle \
  tv.twelvetone.gradle.plugin.navigation \
  dev.flikas.idea.spring.boot.assistant.plugin \
  Lombook Plugin \
  JRebelPlugin

Misc Languages

idea installPlugins \
  com.albertoventurini.jetbrains.graphdbplugin \
  org.apache.pig.plugin.idea

Debugging

idea installPlugins \
  org.jetbrains.plugins.spotbugs \
  com.intellij.plugins.html.instantEditing \
  com.lightrun.idea.plugin.saas.LightrunPlugin \
  com.rookout.intellij-plugin

AI Plugins

idea installPlugins \
  com.tabnine.TabNine

Pair Programming

More Plugins

Troubleshooting

Markdown Images with Relative Paths Not Displaying in Preview

This is caused by opening markdown files (eg. README.md) in the same IntelliJ that is already opened in another project.

IntelliJ interprets the relative paths to be from the root of the repo instead of from the path of the opened markdown file.

Solution: open the project directory in a separate IntelliJ window and then open the markdown file in that instance window of IntelliJ.

External Tool - unexpected EOF while looking for matching `''

When configuring External Tools to run scripts (recommended with hotkeys), you may encounter this error running the external tool configuration if using single quotes.

[: -c: line 1: unexpected EOF while looking for matching `''

This is caused by an Args configuration like this (eg. for a Program: bash):

-c '[ -f .envrc ] && . .envrc; markdown_replace_index.sh $FilePath$'

which works on the command line but not in IntelliJ.

Solution: replace the single quotes with double quotes:

-c "[ -f .envrc ] && . .envrc; markdown_replace_index.sh $FilePath$"

See Also

Expression Evaluation

Productivity Guide (tracks how often you use each shortcut)

Ported from various private Knowledge Base pages 2013+