Skip to content

Instantly share code, notes, and snippets.

@carymrobbins
Last active October 16, 2015 23:43
Show Gist options
  • Save carymrobbins/85f64d1f621069e7c9f6 to your computer and use it in GitHub Desktop.
Save carymrobbins/85f64d1f621069e7c9f6 to your computer and use it in GitHub Desktop.
Reasonable default configurations for IntelliJ

Preferences

  • Editor > General > Other
    • Strip trailing spaces on Save: Modified Lines
    • Ensure line feed at file end on Save
  • Editor > General > Smart Keys
    • Backspace smart indent (disable)
  • Editor > General > Appearance
    • Show line numbers
    • Show whitespaces > Trailing
  • Editor > Code Style > Scala
    • Wrapping and Braces
      • The following helps with constructor args so they do not have to be indented with the class name.
        • Align when multiline (disable)
        • Use normal indent for parameters (enable)
  • Tools > Database
    • Custom SQL parameters
      • $\w+ (for Scala interpolation)
      • \{\w+\} (for Anorm prepared statements)
      • Be sure to also remove any unneeded patterns as they might conflict with your newly created ones.

Linux + IdeaVim Friendly Keymap

  • Main menu
    • View
      • Parameter Info - Ctrl+P ⇒ Alt+P
    • Navigate
      • Class - Ctrl+N ⇒ Alt+O
      • File - Ctrl+Shift+N ⇒ Alt+Shift+O
      • Symbol - Ctrl+Shift+Alt+N ⇒ Ctrl+Shift+Alt+O
  • Editor Actions
    • Up/Down - Ctrl+P / Ctrl+N (but don't remove the existing Up/Down bindings)

Memory

While generally not an issue, IntelliJ can come to a halt every now and then. To avoid this, I've updated my idea64.vmoptions to use up to 4 GB of memory. You can find this file under your IntelliJ installation. Be sure to look at JetBrains' suggestions on how to do this properly. Particularly, it seems on Mac this can be tricky. On Linux it was as simple as updating it as -Xmx4g and restarting IntelliJ.

External Tools

style

  1. Put this style script on your PATH.
  2. Go to Settings > Tools > External Tools and add a tool with the following settings -
  • Name: style
  • Program: style
  • Parameters: $FilePath$
  • Working directory: $ProjectFileDir$
  1. Go to Settings > Keymap and add a binding for External Tools > style. I use Ctrl+Shift+S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment